I am trying to pass in a CommaDelimitedList to populate a List of Certs in a AWS::ElasticLoadBalancingV2::ListenerCertificate
resource.
Error: Value of property Certificates must be a list of objects
I tried a few formats, including the following:
Parameters:
pAdditionalAlbListenerCertArns:
Type: CommaDelimitedList
Default: "arn:someCert1, arnsomeCert2"
Description: enter list of the ACM Certificates (Arns)
## Resource Format 1 - I would think this way would work as the result is [thing1, thing2]
Resources:
rCertificatesList:
Type: AWS::ElasticLoadBalancingV2::ListenerCertificate
Properties:
Certificates: ! Ref pAdditionalAlbListenerCertArns
## Resource Format 2 - I know this should not work, because it's a single item trying to be populated by a list.
Resources:
rCertificatesList:
Type: AWS::ElasticLoadBalancingV2::ListenerCertificate
Properties:
Certificates:
CertificateArn: ! Ref pAdditionalAlbListenerCertArns
Apparently Cfn is not smart enough to prepend each item with CertificateArn:
.
I have also tried combinations of !Split
, !Sub
, and !Join
which gave the same error. Currently I am having to key in the certs directly, which is not viable. While I could create individual parameters for each cert, or use a !Select
to grab them out of the list, I don't know how many I will have in each environment (DEV/TEST/PROD).
I know this works cleanly for things like security groups; am I missing something?
Thanks in advance!
The format of AWS::ElasticLoadBalancingV2::ListenerCertificate Certificate is:
Certificates:
- CertificateArn: String
Non of your uses will work with that. In fact, nothing will work, as this would require looping, which is not supported by CloudFormation. The only feasibale way to achieve what you want is by developing your own custom CFN macro.
Alliteratively, if you will be requiring a lot of iteration in your CFN code, maybe CFN is not the right tool for you. Have a look at CDK or terraform which have rich support for loops.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With