terraform-provider-aws: Error: "policy" contains an invalid JSON: invalid character '}' looking for beginning of object key string
This issue was originally opened by @LennyCastaneda as hashicorp/terraform#22600. It was migrated here as a result of the provider split. The original body of the issue is below.
Terraform Version
...0.12.6
Terraform Configuration Files
...{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Access-from-specific-VPCE-only",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:DeleteObject",
"s3:GetObject",
"s3:PutObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::${s3_bucket}${aws_environment}",
"arn:aws:s3:::${s3_bucket}${aws_environment}/*"
],
"Condition": {
"StringEquals": {
"aws:sourceVpc": "${security_vpc_endpoint}"
}
}
},
{
"Sid": "Accept Any Principal Access From within Prod AWS Account",
"Effect": "Allow",
"Principal": {
"AWS": [
"arn:aws:iam::00000000000:role/FedCwatchRead",
"arn:aws:iam::00000000000:role/admin"
]
},
"Action": [
"s3:DeleteObject",
"s3:GetObject",
"s3:PutObject",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::${s3_bucket}${aws_environment}",
"arn:aws:s3:::${s3_bucket}${aws_environment}/*"
]
}
]
}
Debug Output
Crash Output
Expected Behavior
Actual Behavior
Steps to Reproduce
Additional Context
References
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 20 (3 by maintainers)
@JayMaree I think your error is here:
I had the same issue which brought me here but mine was just a pythonic way of writing json 😛
I have the same issue.
I am able to create a resource with the following content:
When I change the Action to:
it produces the error
Error: "policy" contains an invalid JSON: invalid character ']' looking for beginning of valueVersion
Terraform v0.12.24
Had same issue, just want to clarify that solution above (quite helpful btw, thank you) is referring to the last comma, not the colon.