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

Terraform overrides constructed ID #32

Open
sergenyalcin opened this issue Jul 5, 2022 · 0 comments
Open

Terraform overrides constructed ID #32

sergenyalcin opened this issue Jul 5, 2022 · 0 comments
Milestone

Comments

@sergenyalcin
Copy link
Member

sergenyalcin commented Jul 5, 2022

In provider-gcp for many resources there are more than one possible import statements:

$ terraform import google_compute_resource_policy.default projects/{{project}}/regions/{{region}}/resourcePolicies/{{name}}
$ terraform import google_compute_resource_policy.default {{project}}/{{region}}/{{name}}
$ terraform import google_compute_resource_policy.default {{region}}/{{name}}
$ terraform import google_compute_resource_policy.default {{name}}

Now, for external name configuration, we choose the longest one (in the first order) and use this string for constructing Terraform ID.

In the previous days, we discuss that using the shortest one (in the last order). So we tried to use the NameAsIdentifier configuration choice.

During this test we observed that the Terraform ID was overridden after Terraform call.

In first loop, we construct the ID by using only external name: example and write to the terraform.tfstate. After Terraform calls, Terraform overrides the ID in the terraform.tfstate and sets to the longest one: projects/official-provider-testing/regions/us-central/resourcePolicies/example.

So, I opened this issue to discuss the possible impacts of this behavior.

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

No branches or pull requests

2 participants