I have the following resource:
resource "aws_iam_user_policy" "ses_send_policy" {
count = var.enabled ? 1 : 0
name_prefix = var.user_policy_name_prefix
user = aws_iam_user.ses_smtp_user[0].name
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ses:SendEmail",
"ses:SendRawEmail"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"ses:FromAddress": [
"${var.user_email_address}"
]
}
}
}
]
}
EOF
}
I'd like to ask how to make the "Condition" block in the policy optional and based on a bool type variable? I want to have it only if var.condition = true
.