Hello,
I’m try to create a AWS Organizations Tag Policy.
I’m using terraform 1.2.8. and hashicorp/aws v4.27.0
resource "aws_organizations_policy" "tagging_policy" {
name = "tags"
type = "TAG_POLICY"
content = <<CONTENT
{
"tags": {
"Domaine": {
"tag_key": {
"@@assign": "Domaine"
},
"tag_value": {
"@@assign": [
"OPERATIONS"
]
},
"enforced_for": {
"@@assign": [
"ec2:instance"
]
}
}
}
}
CONTENT
}
when i apply i 've this error, could you help me please ?
terraform apply
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# module.deploy_organizations.aws_organizations_policy.tagging_policy will be created
+ resource "aws_organizations_policy" "tagging_policy" {
+ arn = (known after apply)
+ id = (known after apply)
+ name = "tags"
+ type = "TAG_POLICY"
}
Plan: 1 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
module.deploy_organizations.aws_organizations_policy.tagging_policy: Creating...
╷
│ Error: error creating Organizations Policy (tags): InvalidParameter: 1 validation error(s) found.
│ - minimum field size of 1, CreatePolicyInput.Content.
│
│
│ with module.deploy_organizations.aws_organizations_policy.tagging_policy,
│ on ../../infrastructure/tag_policy.tf line 1, in resource "aws_organizations_policy" "tagging_policy":
│ 1: resource "aws_organizations_policy" "tagging_policy" {
│
╵