Hi, I would like to know how to remove the duplicate SID. I am getting MalformedPolicyDocument: The following Statement Ids are invalid: room,
same error again for the another vir_env:
MalformedPolicyDocument: The following Statement Ids are invalid: room,
My SID is repeating more than one time.
resource "aws_iam_role" "cctv_role" {
for_each = {
for v in local.all_roles :
v.virtual_env => v...
}
name = "${each.key}-cctv_role"
assume_role_policy = jsonencode({
"Version": "2012-10-17",
"Statement": concat(distinct(
[
for k, v in local.call_roles : {
"Effect": "Allow",
"Sid": "${v.clus-name}",
"Principal": {
"Federated": "arn:aws:iam::123456789:oidc-provider/oidc.eks...amazonaws.com/id/${v.oidc}",
},
"Action": "sts:AssumeRoleWithWebIdentity",
"Condition": {
"StringEquals": {
"oidc.eks...amazonaws.com/id/${v.oidc}:sub": "system:serviceaccount:*"
}
local {
oidc = {
room = "1A23456789"
hall = "2B34567890"
deck = "3C98765432"
}
variable "virtual_env " {
type = list(string)
default = ["blue", "green"]
}