-
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
aws_vpc_endpoint policy being seen as "modified" on every terraform run #3519
Comments
Different runs of plan show the exact same policy. If I actually run an apply, it shows the exact same policy block and doesn't mention anything else changing. |
Can you share the |
@catsby I may have redacted too much in my first post for it to be valid. Here's my plan output: https://gist.github.com/nwalke/901bb7059b83e30d1592 |
nvm, found my issue. Here's the plan I got after initial apply: ~ aws_vpc_endpoint.private-s3
policy: "{\"Statement\":[{\"Action\":\"*\",\"Effect\":\"Allow\",\"Principal\":\"*\",\"Resource\":\"*\",\"Sid\":\"\"}],\"Version\":\"2008-10-17\"}" => "{\"Statement\":[{\"Action\":\"*\",\"Effect\":\"Allow\",\"Principal\":\"*\",\"Resource\":\"*\"}]}" Which breaks down to these, in the state: {
"Statement": [
{
"Action": "*",
"Effect": "Allow",
"Principal": "*",
"Resource": "*",
"Sid": ""
}
],
"Version": "2008-10-17"
} and what it's trying to change it to (matching the config): {
"Statement": [
{
"Action": "*",
"Effect": "Allow",
"Principal": "*",
"Resource": "*"
}
]
} So, AWS is adding the resource "aws_vpc_endpoint" "private-s3" {
vpc_id = "${aws_vpc.default.id}"
service_name = "com.amazonaws.us-west-2.s3"
route_table_ids = ["${aws_route_table.priv1.id}", "${aws_route_table.priv2.id}"]
policy = <<POLICY
{
"Statement": [
{
"Effect": "Allow",
"Principal": "*",
"Action": "*",
"Resource": "*",
"Sid":""
}
],
"Version": "2008-10-17"
}
POLICY
} breaks the Hope that helps! |
Ah, so in your case, the thing I notice is missing |
Do I need to add the |
@nwalke yes, that then makes it a valid Policy according to AWS API |
That did the trick. Thanks guys! |
Hmmm... I've not seen this particular validation issue on other IAM policy attributes. Does the AWS API do different IAM policy normalization for different objects? If so, that's a rather awkward constraint that #3124 didn't consider. 😞 |
@apparentlymart yes. Different types of systems have different policy structure requirements (from experience) - S3 bucket policy acted completely differently for me than IAM policies |
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. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
I have an aws_vpc_endpoint configured with a policy and any time I run terraform plan or apply, it wants to modify the endpoint. Here's my configuration:
Since I am not altering the policy between each plan or apply, I would assume that it would not modify the resource.
The text was updated successfully, but these errors were encountered: