-
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
[Bug]: -target option is not respected #34962
Comments
Hi @EugenKon, can you share the configuration you are using to reproduce this? The target option will automatically select any resources that the target resource depends on. Is this the case here? If so, Terraform is behaving as expected. When targeting a specific resource, Terraform will need to fetch the values for any references within that resource. As such, it must refresh and update any resources that contain those references. The whole chain of dependencies must be applied as one. Given that you've mentioned that you've applied some changes within the AWS Console, I think you can avoid including those changes with the |
Hi @EugenKon, I'm going to close this issue as I believe this is a case of Terraform behaving as expected in terms of applying changes to the complete chain of dependencies for a given target. If your targeted resource does not depend on the resources that are being included in the plan, please leave a comment and I will reopen this. Thanks! |
I believe that the resources does not depend on the resources that are being included in the plan. Sorry, I can return to this during the month or even later. I hope I will not lose this closed issue. Thank you. |
@liamcervante
TF plan
How to reproduce:
So here I added Elastic IP and switched But Terraform should not updated resources if it was told to not do so. |
Hi @EugenKon, based on your configuration the new If you don't want Terraform to overwrite changes to your infrastructure made outside of Terraform you can:
I'm sorry that we can't really change the behaviour of the |
@liamcervante I'll try to look at But I am curious. The To improve the behaviour of terraform in such situations, I want to propose next:
Show the warning message with a list of resources need to be refreshed/updated and mention
|
I'm afraid I can't say for sure. There may not be changes to the If you run
This is something we could think about. You should file another issue with this as an enhancement / feature request rather than a bug. This would then be picked up by our product and community team for triage, discovery and prioritisation. You can link back to the discussion here to add more context. |
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. |
Terraform Core Version
1.7.4
AWS Provider Version
4.67.0
Affected Resource(s)
and others
Expected Behavior
If I provide
-target
option only target resources should be plannedActual Behavior
Other resources planned
Relevant Error/Panic Output Snippet
TF plan
Terraform Configuration Files
not relevant
Steps to Reproduce
terraform plan
with-target
optionDespite I have planned only one resource the other resources changed via AWS Console are also planned.
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
Copied from here: hashicorp/terraform-provider-aws#36698
Would you like to implement a fix?
None
The text was updated successfully, but these errors were encountered: