terraform: just hardcode a UUID in there for computed placeholders
This commit is contained in:
parent
d58feeeafe
commit
796dfd54e9
|
@ -1,9 +1,9 @@
|
||||||
package terraform
|
package terraform
|
||||||
|
|
||||||
// ComputedPlaceholderKey is the configuration key given to Configure
|
// ComputedPlaceholder is the placeholder value for computed attributes.
|
||||||
// in a ResourceProvider that contains the value for the computed value
|
// ResourceProviders can compare values to this during a diff to determine
|
||||||
// placeholder when diffs are being done.
|
// if it is just a placeholder.
|
||||||
const ComputedPlaceholderKey = "tf_computed_placeholder"
|
const ComputedPlaceholder = "74D93920-ED26-11E3-AC10-0800200C9A66"
|
||||||
|
|
||||||
// ResourceProvider is an interface that must be implemented by any
|
// ResourceProvider is an interface that must be implemented by any
|
||||||
// resource provider: the thing that creates and manages the resources in
|
// resource provider: the thing that creates and manages the resources in
|
||||||
|
@ -33,14 +33,6 @@ type ResourceProvider interface {
|
||||||
map[string]interface{}) (ResourceDiff, error)
|
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.
|
// ResourceType is a type of resource that a resource provider can manage.
|
||||||
type ResourceType struct {
|
type ResourceType struct {
|
||||||
Name string
|
Name string
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
package terraform
|
package terraform
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/mitchellh/mapstructure"
|
|
||||||
)
|
|
||||||
|
|
||||||
// MockResourceProvider implements ResourceProvider but mocks out all the
|
// MockResourceProvider implements ResourceProvider but mocks out all the
|
||||||
// calls for testing purposes.
|
// calls for testing purposes.
|
||||||
type MockResourceProvider struct {
|
type MockResourceProvider struct {
|
||||||
|
@ -11,7 +7,6 @@ type MockResourceProvider struct {
|
||||||
Meta interface{}
|
Meta interface{}
|
||||||
|
|
||||||
ConfigureCalled bool
|
ConfigureCalled bool
|
||||||
ConfigureCommonConfig ResourceProviderCommonConfig
|
|
||||||
ConfigureConfig map[string]interface{}
|
ConfigureConfig map[string]interface{}
|
||||||
ConfigureReturnWarnings []string
|
ConfigureReturnWarnings []string
|
||||||
ConfigureReturnError error
|
ConfigureReturnError error
|
||||||
|
@ -28,11 +23,6 @@ type MockResourceProvider struct {
|
||||||
func (p *MockResourceProvider) Configure(c map[string]interface{}) ([]string, error) {
|
func (p *MockResourceProvider) Configure(c map[string]interface{}) ([]string, error) {
|
||||||
p.ConfigureCalled = true
|
p.ConfigureCalled = true
|
||||||
p.ConfigureConfig = c
|
p.ConfigureConfig = c
|
||||||
|
|
||||||
if err := mapstructure.Decode(&p.ConfigureCommonConfig, c); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return p.ConfigureReturnWarnings, p.ConfigureReturnError
|
return p.ConfigureReturnWarnings, p.ConfigureReturnError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,7 +123,9 @@ func (t *Terraform) diffWalkFn(
|
||||||
|
|
||||||
switch n.Meta.(type) {
|
switch n.Meta.(type) {
|
||||||
case *config.ProviderConfig:
|
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
|
return nil
|
||||||
case *config.Resource:
|
case *config.Resource:
|
||||||
// Continue
|
// Continue
|
||||||
|
|
Loading…
Reference in New Issue