Skip to content
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

Show if arguments require a new resource i.e. ForceNew: true #34

Open
nitrocode opened this issue Jul 30, 2021 · 1 comment
Open

Show if arguments require a new resource i.e. ForceNew: true #34

nitrocode opened this issue Jul 30, 2021 · 1 comment

Comments

@nitrocode
Copy link

nitrocode commented Jul 30, 2021

Hi @minamijoyo.

Is it possible to grab the ForceNew arguments for resources and build a new column to show which resource arguments cause a recreation ?

For example: https://github.com/hashicorp/terraform-provider-aws/blob/main/aws/resource_aws_ecs_service.go

✗ tfschema resource show aws_ecs_service
+------------------------------------+-------------+----------+----------+----------+-----------+-----------+
| ATTRIBUTE                          | TYPE        | REQUIRED | OPTIONAL | COMPUTED | SENSITIVE | FORCENEW  |
+------------------------------------+-------------+----------+----------+----------+-----------+-----------+
| cluster                            | string      | false    | true     | true     | false     | true      |
@minamijoyo
Copy link
Owner

Hi, @nitrocode Thank you for your proposal.

Unfortunately it's technically impossible for now because the ForceNew attribute you linked is just an attribute for terraform-plugin-sdk and is not a part of terraform plugin protocol. We cannot inspect it outside of plugin.

https://github.com/hashicorp/terraform-plugin-sdk/blob/5f0e47111e779cb308990590c18d0ed547f0dd37/helper/schema/schema.go#L140

https://github.com/hashicorp/terraform/blob/5b07bb70401093a9ddbb3f2ebc3e2598ec9642d7/docs/plugin-protocol/tfplugin5.2.proto#L90-L100

I agree that it would be useful if it were exposed to users via the plugin protocol so that other tools such as not only tfschema but also terraform-ls (the official LSP server) can use it. I suggest you to open a new issue to the upstream hashicorp/terraform repo.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants