From 4397c566a0df4e38803a51820e06c31f0798e405 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 5 Jun 2014 12:09:25 -0700 Subject: [PATCH] terraform: computed key --- terraform/semantics.go | 5 +++-- terraform/terraform.go | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/terraform/semantics.go b/terraform/semantics.go index 2499bb6f7d..0e8a64e9bb 100644 --- a/terraform/semantics.go +++ b/terraform/semantics.go @@ -7,8 +7,9 @@ import ( "github.com/hashicorp/terraform/config" ) -// smcProviders matches up the resources with a provider -// those providers and does the initial `Configure` on the provider. +// smcProviders matches up the resources with a provider and initializes +// it. This does not call "Configure" on the ResourceProvider, since that +// might actually depend on upstream resources. func smcProviders(c *Config) (map[*config.Resource]ResourceProvider, []error) { var errs []error diff --git a/terraform/terraform.go b/terraform/terraform.go index de91e307ff..3f54151241 100644 --- a/terraform/terraform.go +++ b/terraform/terraform.go @@ -24,6 +24,8 @@ type Config struct { Config *config.Config Providers map[string]ResourceProviderFactory Variables map[string]string + + computedPlaceholder string } // New creates a new Terraform structure, initializes resource providers @@ -35,6 +37,9 @@ type Config struct { func New(c *Config) (*Terraform, error) { var errs []error + // Calculate the computed key placeholder + c.computedPlaceholder = "tf_computed_placeholder" + // Validate that all required variables have values if err := smcVariables(c); err != nil { errs = append(errs, err...)