0
votes

I can Terraform Plan the below with zero issues:

resource "aws_iam_group_policy" "devops-admin-write" {
  group = data.aws_iam_group.devops-admin-group.group_name
  policy = <<POLICY
{
  "Version": "2020-10-21",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "s3:PutObject",
      "Resource": [
        "arn:aws:s3:::bucketname",
        "arn:aws:s3:::bucketname/*"
      ]
    }
  ]
}
POLICY
}

...but when I Terraform Apply, I get this: "Error: Error putting IAM group policy terraform-20201022014517696700000001: MalformedPolicyDocument: Syntax errors in policy. status code: 400, request id: d531aabd-839a-4ebb-9813-b37d7dcad21a"

The syntax error is apparently in the policy itself, I think. But I can't locate it. Any ideas?

1

1 Answers

0
votes

The IAM policy version should be:

"Version": "2012-10-17"

rather then

"Version": "2020-10-21"