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

Dependencies from v3 -> v4 State #27020

Closed
xescugc opened this issue Nov 24, 2020 · 3 comments
Closed

Dependencies from v3 -> v4 State #27020

xescugc opened this issue Nov 24, 2020 · 3 comments
Labels
working as designed confirmed as reported and closed because the behavior is intended

Comments

@xescugc
Copy link

xescugc commented Nov 24, 2020

Terraform Version

0.13.5

Terraform Configuration Files

...

Debug Output

Crash Output

Expected Behavior

To migrate (if possible) dependencies from State v3 -> v4

Actual Behavior

Not migrating them even if they are read from the TFState

Steps to Reproduce

Additional Context

Basically I know that the depends_on has been dropped and moved to dependencies and on this commit 9fe87fe it was removed from the v3->v4 which IDK if it was intentional (9fe87fe#diff-3736e46b6f903757c3c43803e893c47b659e961020e674b63d701235cd00fe6dL373).

The dependencies are calculated but then they are not used (https://github.com/hashicorp/terraform/blob/master/states/statefile/version3_upgrade.go#L339) so I'm curious about them:

  • Should they be migrated to v4? "Basically" instead of DependsOn: dependencies, do Dependencies: dependencies,. This fails if I try to do it with Invalid address: A resource address is required here. The module path must be followed by a resource specification.
  • Not migrate them and remove that code and potentially document it somewhere as it's not clear and IDK if it would generate other errors.

The TFState I'm using as reference it's a terraform_version: 0.11.14.

I'm also basically using statefile.Read, I know Terraform is not meant to be used as a lib, but this behavior is not expected and would happend anyway using it normally.

References

@xescugc xescugc added bug new new issue not yet triaged labels Nov 24, 2020
@jbardin jbardin added working as designed confirmed as reported and closed because the behavior is intended and removed bug new new issue not yet triaged labels Nov 24, 2020
@jbardin
Copy link
Member

jbardin commented Nov 24, 2020

Hi @xescugc

The contents of the fields are not directly transferrable, and in most cases will not match, so there is no reason to migrate them from the old state version. Upgrading the terraform state requires more than the translation from the previous state format, it also requires successfully applying the configuration to ensure that the state contains all the necessary information.

Thanks!

@jbardin jbardin closed this as completed Nov 24, 2020
@xescugc
Copy link
Author

xescugc commented Nov 25, 2020

Ok then I would suggest to clean the https://github.com/hashicorp/terraform/blob/master/states/statefile/version3_upgrade.go#L339 as it's not used :).

@ghost
Copy link

ghost commented Dec 25, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
working as designed confirmed as reported and closed because the behavior is intended
Projects
None yet
Development

No branches or pull requests

2 participants