简体   繁体   中英

Defining new policy with Terraform on AWS, but gets error in Version

I'm trying to create a new policy in the AWS by Terraform.
But I'm getting errors when I want to put Version equal to today's date, something like "Version": "2022-03-06" .
Why is this happening? (It worked fine with this date: "Version": "2012-12-17" ).
main.tf:

resource "aws_iam_policy" "adminUsers" {
  name = "AdminUsers"
  policy = file("admin-policy.json")
}

admin-policy.json

{
  "Version": "2022-03-06",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "*",
      "Resource": "*"
    }
  ]
}

https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_elements_version.html

You can check in the URL above. It's like the version of the policy and at this time, there are 2 versions: 2012-10-17 and 2008-10-17.

To note the version of Policy, you can use Sid instead

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM