I am learning to deploy AWS infrastructure using terraform. I have written below code to create IAM policy-
resource "aws_iam_role_policy" "s3_access_policy"
{
name = "s3_access_policy"
role = aws_iam_role.s3_access_role.id
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3.*",
"Resource": "*"
}
]
}
EOF
}
When I run terraform apply I am getting below error-
Error: Error putting IAM role policy s3_access_policy: MalformedPolicyDocument: Actions/Conditions must be prefaced by a vendor, e.g., iam, sdb, ec2, etc.
status code: 400, request id: cdd4d629-4f43-450c-a4f1-b6d475e363f0
on main.tf line 14, in resource "aws_iam_role_policy" "s3_access_policy":
14: resource "aws_iam_role_policy" "s3_access_policy" {
Not able to resolve this and would greatly appreciate your help
I think you need a colon (not a period) in your Action
so s3:*
rather than s3.*
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With