1
votes

I am getting this error message "Policy containes an invalid JSON policy"when i run terraform apply but when i do terraform validate policy is validated.I dont know what am doing wrongly.please help.

policy = <<EOF

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect":"Allow",
            "Action":["s3:ListBucket"],
            "Resource":["arn:aws:s3:::${var.bucket_name}"]
        },
        {
            "Effect":"Allow",
            "Action":[
                "s3:PutObject",
                "s3:GetObject",
                "s3:GetObjectVersion"
            ],
            "Resource":["arn:aws:s3:::${var.bucket_name}/*"]
        },
        {
            "Effect":"Allow",
            "Action":[
                "kms:Decrypt"
            ],
            "Resource":"arn:aws:kms:${var.region}:${var.aws_account_id}:key/${var.key_id}"
        }
    ]
}

} EOF

1

1 Answers

0
votes

Looks like your final Resource is not wrapped in a bracket []...