Various bug fixes.

Actually initialize the ProviderMetas map for the Module when calling
configs.NewModules so we don't panic.

Check the NodeValidatableResource implements
GraphNodeAttachProviderMetaConfigs.

When calling terraform.loadProviderSchemas, actually set the
ProviderMeta block.

Add ProviderMeta to state. For some reason? I don't know why.

Fix the ProviderTransformer to use the ProviderConfig.Type instead of
String() output for the provider when looking up the ProviderMeta to
use.
paddy_module_attribution_tmp
Paddy Carver 7 years ago
parent 94eaf46732
commit 5dbd9699f2

@ -93,6 +93,7 @@ func NewModule(primaryFiles, overrideFiles []*File) (*Module, hcl.Diagnostics) {
ModuleCalls: map[string]*ModuleCall{},
ManagedResources: map[string]*Resource{},
DataResources: map[string]*Resource{},
ProviderMetas: map[string]*ProviderMeta{},
}
for _, file := range primaryFiles {

@ -88,7 +88,6 @@ func (n *EvalApply) Eval(ctx EvalContext) (interface{}, error) {
Subject: &n.ProviderMeta.ProviderRange,
})
} else {
var configDiags tfdiags.Diagnostics
metaConfigVal, _, configDiags = ctx.EvaluateBlock(n.ProviderMeta.Config, (*n.ProviderSchema).ProviderMeta, nil, EvalDataForNoInstanceKey)
diags = diags.Append(configDiags)

@ -15,12 +15,13 @@ type NodeValidatableResource struct {
}
var (
_ GraphNodeSubPath = (*NodeValidatableResource)(nil)
_ GraphNodeEvalable = (*NodeValidatableResource)(nil)
_ GraphNodeReferenceable = (*NodeValidatableResource)(nil)
_ GraphNodeReferencer = (*NodeValidatableResource)(nil)
_ GraphNodeResource = (*NodeValidatableResource)(nil)
_ GraphNodeAttachResourceConfig = (*NodeValidatableResource)(nil)
_ GraphNodeSubPath = (*NodeValidatableResource)(nil)
_ GraphNodeEvalable = (*NodeValidatableResource)(nil)
_ GraphNodeReferenceable = (*NodeValidatableResource)(nil)
_ GraphNodeReferencer = (*NodeValidatableResource)(nil)
_ GraphNodeResource = (*NodeValidatableResource)(nil)
_ GraphNodeAttachResourceConfig = (*NodeValidatableResource)(nil)
_ GraphNodeAttachProviderMetaConfigs = (*NodeValidatableResource)(nil)
)
// GraphNodeEvalable

@ -160,6 +160,10 @@ func loadProviderSchemas(schemas map[string]*ProviderSchema, config *configs.Con
}
}
if resp.ProviderMeta.Block != nil {
s.ProviderMeta = resp.ProviderMeta.Block
}
schemas[typeName] = s
}

@ -1634,6 +1634,8 @@ type InstanceState struct {
// and collections.
Meta map[string]interface{} `json:"meta"`
ProviderMeta cty.Value
// Tainted is used to mark a resource for recreation.
Tainted bool `json:"tainted"`

@ -140,7 +140,7 @@ func (t *ProviderTransformer) Transform(g *Graph) error {
log.Printf("[TRACE] ProviderTransformer: no provider metas defined for %s", dag.VertexName(v))
continue
}
if meta, ok := t.Config.Module.ProviderMetas[p.String()]; ok {
if meta, ok := t.Config.Module.ProviderMetas[p.ProviderConfig.Type]; ok {
gnapmc.AttachProviderMetaConfigs(meta)
}
}

Loading…
Cancel
Save