Plannable import 3: Make import plannable (#33085)

During a plan, Terraform now checks for the presence of import blocks.

For each resource in config, if an import block is present with a matching address, planning that node will now trigger an ImportResourceState and ReadResource. The resulting state is treated as the node's "refresh state", and planning proceeds as normal from there.

The walkImport operation is now only used for the legacy "terraform import" CLI command. This is the only case under which the plan should produce graphNodeImportStates.
This commit is contained in:
kmoe
2023-04-28 23:45:43 +01:00
committed by GitHub
parent b3a49a2fa7
commit 28643516b2
9 changed files with 407 additions and 41 deletions

View File

@@ -230,8 +230,9 @@ func (cs *ChangeSrc) Decode(ty cty.Type) (*Change, error) {
}
return &Change{
Action: cs.Action,
Before: before.MarkWithPaths(cs.BeforeValMarks),
After: after.MarkWithPaths(cs.AfterValMarks),
Action: cs.Action,
Before: before.MarkWithPaths(cs.BeforeValMarks),
After: after.MarkWithPaths(cs.AfterValMarks),
Importing: cs.Importing,
}, nil
}