Skip to content

Commit 50182a4

Browse files
committed
backport of commit ae5316c
1 parent 5a23876 commit 50182a4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: internal/terraform/node_resource_plan_instance.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,15 @@ func (n *NodePlannableResourceInstance) managedResourceExecute(ctx EvalContext)
386386
}
387387

388388
if importing {
389-
change.Importing = &plans.Importing{Target: n.importTarget}
389+
// There is a subtle difference between the import by identity
390+
// and the import by ID. When importing by identity, we need to
391+
// make sure to use the complete identity return by the provider
392+
// instead of the (potential) incomplete one from the configuration.
393+
if n.importTarget.Type().IsObjectType() {
394+
change.Importing = &plans.Importing{Target: instanceRefreshState.Identity}
395+
} else {
396+
change.Importing = &plans.Importing{Target: n.importTarget}
397+
}
390398
}
391399

392400
// FIXME: here we udpate the change to reflect the reason for

0 commit comments

Comments
 (0)