Open t0yv0 opened 4 days ago
This might just be a variation of https://github.com/pulumi/pulumi-terraform-bridge/issues/2272 that is specific to pulumi import
vs pulumi up
with the import option.
As for alternative solutions.
https://github.com/pulumi/pulumi/issues/16886 was requested in this area but it's unclear it's a net win to me; it adds some complication to the protocol . Also https://pulumi-developer-docs.readthedocs.io/latest/developer-docs/architecture/import.html#challenges
The key issue is overloading Read() for refresh, import, R.get scenarios. If we were revisiting import protocol specifically with the understanding that the provider could opt to support a "better" import we could potentially design for that holistically rather than overloading Read() some more with extra flags.
https://github.com/pulumi/pulumi-aws/pull/4510 works surprisingly well, could scale it out as default possibly.
Hello!
Issue details
When a user runs
pulumi import
and then inserts the generated code in the program and runspulumi up
,pulumi
may generate unwanted diffs that imply editing the resource inputs from undefined to default values.An excellent example is found in https://github.com/pulumi/pulumi-aws/issues/4457
The imported code does not specify e.g.
force_delete=False
which is a good thing for aesthetics as the generated code needs to be as small as possible.However the imported state does not have an entry for
force_delete=False
.Subsequent preview generates a diff that is distracting to the user:
It would be nice if the diff was not there.
Generalization
It would appear that this issue should occur commonly in bridged providers; the affected fields have simple default values defined against SDKv2, but Terraform does not place guarantees that these defaults will be applied in the Read() method.
It is possible to reproduce the diff in question in Terrraform proper, it appears it's accepted there:
Historical Context
One additional bit of information is that our behavior apparently regressed here with the PlanResourceChange rollout, that is we used to be able to do better.
Affected area/feature
import