-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
inline_policy configuration blocks using file() func not generating specific diff #20961
Comments
Hey @celik0311 👋 Thanks for getting this filed! By chance, can you provide the (redacted as needed) output that you're seeing? I'd like to get a better idea, so that I can compare it against what I may see while reproducing this. |
resource definition
initial apply
update anything in the inline policy
plan changes
I see that it indicates 1 to change, but what I am confused about is the output generated. My interpretation of that is that terraform will create an inline policy then delete one. My expected behavior was just an update to the existing inline policy since I only modified it. |
Hey @celik0311, thanks for providing that. I did a bit of reproducing and found the same behavior. To test further, I switched away from using the After seeing that, I took a look at the codebase to see how this resource is configured and found that the I was able to finally get around this by switching away from using
|
Thank you for the thorough and quick investigation. Is there any technical reason for not supporting this behavior for |
I did just test that I can use |
@celik0311 you just beat me to it! I did the same, but used the source_json argument of the As far as why the behavior is different, I'm not quite sure without digging further into it. I assume it's a difference in how the resources are handled, but frankly I'm not strong enough a Go developer to give an authoritative answer at this point in time. That said, given that we've figured out a path forward that gives the desired results, I'm going to go ahead and close this issue out for now. If you feel I've done this in error, or have further questions, please do let me know. |
Nope, @justinretzolk, thanks again for your help. I really appreciate it. |
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. |
Community Note
Terraform CLI and Terraform AWS Provider Version
terraform -v
Terraform v1.0.2
on linux_amd64
Your version of Terraform is out of date! The latest version
is 1.0.7. You can update by downloading from https://www.terraform.io/downloads.html
Affected Resource(s)
aws_iam_role
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
Expected Behavior
When a change to baz.json occurs a diff should be generated displaying that change, and only that change.
Actual Behavior
The terraform plan generated a diff that deletes and recreates the entire inline policy not just modifying the single change.
Steps to Reproduce
file()
function.Important Factoids
I wonder if this has something to do with the use of the
file()
function when referencing the inline_policy.The text was updated successfully, but these errors were encountered: