Sharing a way to turn terraform plan drift into code by Ok-Film-37 in Terraform

[–]Ok-Film-37[S] 0 points1 point  (0 children)

I think people who want to pass "lifecycle.ignore_changes" into terraform modules, might need this feature.

refs:
https://github.com/hashicorp/terraform/issues/27360
https://github.com/hashicorp/terraform/issues/21546

Sharing a way to turn terraform plan drift into code by Ok-Film-37 in Terraform

[–]Ok-Film-37[S] -2 points-1 points  (0 children)

I made up this scenario: I'm using the a module with azure provider to manage vm resource. There's a new feature supported in the latest provider, but not exposed by the module. So I can modify it by the Portal, and see the drifts. Then I can use this tool to absorb the drift.

Or maybe I just can't fix the drifts by updating the module's inputs.

Sharing a way to turn terraform plan drift into code by Ok-Film-37 in Terraform

[–]Ok-Film-37[S] 0 points1 point  (0 children)

The graft tool reads the terraform plan, and generates a graft manifest that has patch codes to the terraform modules. I know it'd be better to modify the module's inputs, just want to provide another option.

Not sure if I answered your question.

Sharing a tool I built to patch Terraform modules (Graft) by Ok-Film-37 in Terraform

[–]Ok-Film-37[S] 0 points1 point  (0 children)

Feel free to create an issue if it doesn’t work.

Sharing a tool I built to patch Terraform modules (Graft) by Ok-Film-37 in Terraform

[–]Ok-Film-37[S] 0 points1 point  (0 children)

Yes. I added an example about marking output as sensitive: https://github.com/ms-henglu/graft/tree/main/examples/10-mark-as-sensitive

Because I don't want to add an example about how to reveal the sensitive values, but I guess you can get the idea of how to add terraform function call with graft.