terraform: target at the right moment to get the right values
This commit is contained in:
parent
bb9820cc0b
commit
1efdba9b30
|
@ -5121,8 +5121,10 @@ func TestContext2Apply_targetedModuleDep(t *testing.T) {
|
||||||
Targets: []string{"aws_instance.foo"},
|
Targets: []string{"aws_instance.foo"},
|
||||||
})
|
})
|
||||||
|
|
||||||
if _, err := ctx.Plan(); err != nil {
|
if p, err := ctx.Plan(); err != nil {
|
||||||
t.Fatalf("err: %s", err)
|
t.Fatalf("err: %s", err)
|
||||||
|
} else {
|
||||||
|
t.Logf("Diff: %s", p)
|
||||||
}
|
}
|
||||||
|
|
||||||
state, err := ctx.Apply()
|
state, err := ctx.Apply()
|
||||||
|
|
|
@ -81,15 +81,19 @@ func (b *PlanGraphBuilder) Steps() []GraphTransformer {
|
||||||
Module: b.Module,
|
Module: b.Module,
|
||||||
},
|
},
|
||||||
|
|
||||||
// Target
|
|
||||||
&TargetsTransformer{Targets: b.Targets},
|
|
||||||
|
|
||||||
// Attach the configuration to any resources
|
// Attach the configuration to any resources
|
||||||
&AttachResourceConfigTransformer{Module: b.Module},
|
&AttachResourceConfigTransformer{Module: b.Module},
|
||||||
|
|
||||||
// Attach the state
|
// Attach the state
|
||||||
&AttachStateTransformer{State: b.State},
|
&AttachStateTransformer{State: b.State},
|
||||||
|
|
||||||
|
// Connect so that the references are ready for targeting. We'll
|
||||||
|
// have to connect again later for providers and so on.
|
||||||
|
&ReferenceTransformer{},
|
||||||
|
|
||||||
|
// Target
|
||||||
|
&TargetsTransformer{Targets: b.Targets},
|
||||||
|
|
||||||
// Create all the providers
|
// Create all the providers
|
||||||
&MissingProviderTransformer{Providers: b.Providers, Factory: providerFactory},
|
&MissingProviderTransformer{Providers: b.Providers, Factory: providerFactory},
|
||||||
&ProviderTransformer{},
|
&ProviderTransformer{},
|
||||||
|
@ -103,7 +107,8 @@ func (b *PlanGraphBuilder) Steps() []GraphTransformer {
|
||||||
// Add module variables
|
// Add module variables
|
||||||
&ModuleVariableTransformer{Module: b.Module},
|
&ModuleVariableTransformer{Module: b.Module},
|
||||||
|
|
||||||
// Connect references so ordering is correct
|
// Connect references again to connect the providers, module variables,
|
||||||
|
// etc. This is idempotent.
|
||||||
&ReferenceTransformer{},
|
&ReferenceTransformer{},
|
||||||
|
|
||||||
// Single root
|
// Single root
|
||||||
|
|
Loading…
Reference in New Issue