I'm trying to use an optional field in my CFT, where the field is actually a list of AZs in the account. by 'optional' I mean that the AZs selection should be take into account based on condition:
AWSTemplateFormatVersion: '2010-09-09'
Parameters:
AvailabilityZones:
Type: List<AWS::EC2::AvailabilityZone::Name>
EnableAZLogic:
Type: String
Default: 'Disabled'
AllowedValues:
- 'Disabled'
- 'Enabled'
Conditions:
AZEnabled: !Equals [ !Ref EnableAZLogic, 'Enabled' ]
Resources:
MyResource:
Condition: AZEnabled
Type: "AWS::CloudFormation::CustomResource"
Properties:
ServiceToken: !GetAtt MyResourceLambda.Arn
StackName: !Ref "AWS::StackName"
AvailabilityZones: !Ref AvailabilityZones
...
but, when I select "Disabled" and select no AZs, I get this error:
Parameter validation failed: parameter value for parameter name AvailabilityZones does not exist
How to address that? I want the user to be able to select none of the AZs (the Lambda itself may check the list, if applicable)