I am trying to add a condition to the ManagedPolicyArns based on the environment, it has to run a specify policy
Here's my code:
Conditions:
IsEnvProd: Fn::Equals [!Ref Env, 'prod']
ManagedPolicyArns:
- Fn::If:
- IsEnvProd:
- "arn:aws:iam::111111111111:policy/prod_policy"
- "arn:aws:iam::111111111111:policy/stage_policy"
Getting the following error: ValidateTemplate operation: Template error: Fn::If requires a list argument with three elements
Try this:
Fn::Iftakes three parameters. The first one is the condition name, the second is the value if true, and the third is the value if false. You passed a map instead.