I'm trying to convert an AWS Cloudformation Managed Policy document into a Terraform file to create policies. However, I'm having trouble with the Join format under the Resource section which it seems Terraform doesn't accept even when I tried wrapping it with ", ' or trying to convert it to JSON. May I seek some help o how do I format it the way terraform interpret it correctly? Below is the terraform file I'm working on. Many thanks in advance.
module "my_policy" {
source = "../modules/policy"
policy = {
name = "my_access"
description = "my access account"
path = "/"
document = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "MyBeanstalkPermissions",
"Effect": "Allow",
"Action": [
"elasticbeanstalk:CreateApplicationVersion",
"elasticbeanstalk:DeleteApplicationVersion",
"elasticbeanstalk:UpdateEnvironment",
"elasticbeanstalk:CreateStorageLocation",
"elasticbeanstalk:Check*",
"elasticbeanstalk:Describe*",
"elasticbeanstalk:List*",
"elasticbeanstalk:RequestEnvironmentInfo",
"elasticbeanstalk:RetrieveEnvironmentInfo",
"elasticbeanstalk:RestartAppServer",
"elasticbeanstalk:UpdateApplication",
"elasticbeanstalk:UpdateApplicationVersion"
],
"Resource": !Join ["", ["arn:aws:elasticbeanstalk:*:", !Ref "AWS::AccountId", ":*" ] ]
}
]
}
EOF
}
}
I get this error:
"policy" contains an invalid JSON: invalid character '!' looking for beginning of value