-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
allow interpolation in import block id #33618
Conversation
14568b6
to
26e91b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just some very minor style nits
The import block id field can now reference variables, attributes, and module outputs, as long as the result is a known non-empty string at plan time. A null or unknown value will result in an error. This commit slightly modifies the legacy CLI terraform import code path to construct a synthetic hcl.Expression from the import id passed in from the command line, with no intended change of functionality.
26e91b8
to
207b49b
Compare
Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch. |
Hey, just wondering when this will be released as I will need to import a lot of existing resources into the state in the coming weeks. |
Hi @lightpeak, we just released this change today as part of the alpha for v1.6. This will enter general availability within September or October depending on the feedback we get for the alpha and beta release periods. It's worth noting that importing resources via config more generally was made available in the v1.5: https://www.hashicorp.com/blog/terraform-1-5-brings-config-driven-import-and-checks You might be able to make some progress with the v1.5 release for any resources that you don't need |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
A simple approach permitting the import block id field to reference variables, attributes, and module outputs, as long as the result is a known non-empty string at plan time. A null or unknown value will result in an error.
This PR slightly modifies the legacy CLI terraform import code path to construct a synthetic
hcl.Expression
from the import id passed in from the command line, with no intended change of functionality. I thought this was a little better than maintaining two separate versions of theconfigs.Import
andterraform.ImportTarget
structs.