amancevice/terraform-aws-custom-ecr-domain

MalformedPolicyDocument: The policy failed legacy parsing

pat-s opened this issue · 3 comments

pat-s commented

Happens for https://github.com/amancevice/terraform-aws-custom-ecr-domain/blob/main/main.tf#L137C2-L148.

module.custom-ecr-domain.aws_iam_role.proxy: Creating...
╷
│ Error: 1 error occurred:
│       * creating inline policy (logs): MalformedPolicyDocument: The policy failed legacy parsing
│       status code: 400, request id: 88d59375-4baf-4f48-9843-f641c2d087f5

Comparing the visual editor policy below, could it be that the inline module is missing the square brackets in the Statement part?

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": "logs:*",
            "Resource": "*"
        }
    ]
}

what version of the AWS provider are you using? Can you try upgrading?

pat-s commented

Ah that helped! Was on 4.44 before, upgrade to 4.65 and it went through successfully afterwards! 👍

I'll push an update with a harder constraint on the provider. thanks for helping improve the repo!