-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid default value diffs upon pulumi import #2436
Comments
This might just be a variation of #2272 that is specific to |
As for alternative solutions. pulumi/pulumi#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. |
pulumi/pulumi-aws#4510 works surprisingly well, could scale it out as default possibly. |
I think pulumi/pulumi-aws#4644 is another problem that seems to be caused by this; it is much worse in this case since the program is trying to generate a replace, which the user emphatically cannot accept. |
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 pulumi/pulumi-aws#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
The text was updated successfully, but these errors were encountered: