terraform: just hardcode a UUID in there for computed placeholders

This commit is contained in:
Mitchell Hashimoto 2014-06-05 20:03:16 -07:00
parent d58feeeafe
commit 796dfd54e9
3 changed files with 7 additions and 23 deletions

View File

@ -1,9 +1,9 @@
package terraform
// ComputedPlaceholderKey is the configuration key given to Configure
// in a ResourceProvider that contains the value for the computed value
// placeholder when diffs are being done.
const ComputedPlaceholderKey = "tf_computed_placeholder"
// ComputedPlaceholder is the placeholder value for computed attributes.
// ResourceProviders can compare values to this during a diff to determine
// if it is just a placeholder.
const ComputedPlaceholder = "74D93920-ED26-11E3-AC10-0800200C9A66"
// ResourceProvider is an interface that must be implemented by any
// resource provider: the thing that creates and manages the resources in
@ -33,14 +33,6 @@ type ResourceProvider interface {
map[string]interface{}) (ResourceDiff, error)
}
// ResourceProviderCommonConfig contains the common configuration
// keys that are sent with every resource provider configuration.
// This can be used with something like mapstructure to extract
// the proper value.
type ResourceProviderCommonConfig struct {
TFComputedPlaceholder string `mapstructure:"tf_computed_placeholder"`
}
// ResourceType is a type of resource that a resource provider can manage.
type ResourceType struct {
Name string

View File

@ -1,9 +1,5 @@
package terraform
import (
"github.com/mitchellh/mapstructure"
)
// MockResourceProvider implements ResourceProvider but mocks out all the
// calls for testing purposes.
type MockResourceProvider struct {
@ -11,7 +7,6 @@ type MockResourceProvider struct {
Meta interface{}
ConfigureCalled bool
ConfigureCommonConfig ResourceProviderCommonConfig
ConfigureConfig map[string]interface{}
ConfigureReturnWarnings []string
ConfigureReturnError error
@ -28,11 +23,6 @@ type MockResourceProvider struct {
func (p *MockResourceProvider) Configure(c map[string]interface{}) ([]string, error) {
p.ConfigureCalled = true
p.ConfigureConfig = c
if err := mapstructure.Decode(&p.ConfigureCommonConfig, c); err != nil {
return nil, err
}
return p.ConfigureReturnWarnings, p.ConfigureReturnError
}

View File

@ -123,7 +123,9 @@ func (t *Terraform) diffWalkFn(
switch n.Meta.(type) {
case *config.ProviderConfig:
// Ignore, we don't treat this any differently.
// Ignore, we don't treat this any differently since we always
// initialize the provider on first use and use a lock to make
// sure we only do this once.
return nil
case *config.Resource:
// Continue