-
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
Add support for targeted applies on import blocks only #35497
Comments
Hi @eric-at-cmd, Thanks for filing the issue. Can you explain further, perhaps with an example, what you are suggesting here? You are asking for targeted applies for imports, but then follow up saying that it is already possible but not feasible. In order to plan and apply the import, there needs to be some sort of configuration given. The legacy |
Thanks @jbardin what I want is effectively be able to execute the import blocks in a file without actually applying any changes into the resources that file is declaring. An example of why this would get used is sometimes a developer might replace or add new non-root EBS volumes on EC2 Instances and then want to bring those resources into Terraform State. Currently with how we're set up if we were going to do this via import blocks someone would need to:
Sometimes can end up with difficulty getting the green-light to get the apply performed, most of the time it's not an issue but some stakeholders can be really resistant to running a terraform apply which can change infrastructure just to effectively update the state file. The legacy |
The intent with most of the operations in Terraform is that Because a plan has to be created and applied, what would be the desired workflow for your import scenario? |
While I acknowledge working this way probably isn't optimal its still something that comes up for us sometimes. The issue with the current way it works is that for some stakeholders it is challenging to get approval to do this apply because the intention is to update the state so that it matches the deployed infrastructure. Yet, it is done through the same operation that can execute destructive changes. A lot of the time its not an issue, but being able to tell someone "This command has no capability of destroying or modifying any of your infrastructure" is a big help in communication to these stakeholders. Having it also justifies adding it as a Standard Change in a CAB for organisations that operate like that.
I'd say workflow wise it'd be the same as you'd expect from any plan/apply its just that it will only run import commands and not execute any changes, adds, or removes. |
Thanks for the extra info @eric-at-cmd. I'm not sure what Terraform would do to satisfy the stakeholders in this case. In order to use import blocks you will need to complete a plan, and the command to apply a plan is always Even if a special If the users are already allowed to run ad-hoc commands, then you are already trusting the user to not run anything destructive, and perhaps |
So I have a similar issue, however I think a Essentially I need to
I hope I have understood the request and the proposed, solution correctly |
Terraform Version
Use Cases
terraform apply
to import the resources.Attempted Solutions
Proposal
No response
References
No response
The text was updated successfully, but these errors were encountered: