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

Support for terraform state show #336

Open
magodo opened this issue Sep 15, 2022 · 0 comments
Open

Support for terraform state show #336

magodo opened this issue Sep 15, 2022 · 0 comments

Comments

@magodo
Copy link
Contributor

magodo commented Sep 15, 2022

The difference of terraform state show and terraform show is that the former only shows one resource, while the latter shows every resources in the state file.

One use case when we want to only show one resource is when we have an existing state file, which was originally generated from provider, e.g. v1.1.0. Later, if we initialized another terraform working directory with an old provider version, .e.g v1.0.0, whose main purpose is to import new resources to the state file (as v1.1.0 is backward compatible with v1.0.0, so it is not a problem to import with an older version). By following the official import guide, after importing the resource, we will need to leverage the terraform state show/terraform show to construct the corresponding HCL, at this point, terraform show might raise error if there are resources (properties) in the state file that only exist in v1.1.0. While what we actually want to show is only the imported resources (for v1.0.0).

I've also found #27 said that:

Output from the latter (terraform state show) is intended for human consumption, so we will not be implementing it.

If that is the case, can we extend the terraform show with some option to make it able to only show one resource?

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

1 participant