Skip to content

Instantly share code, notes, and snippets.

@chrisj-au
Created November 27, 2020 00:28
Show Gist options
  • Save chrisj-au/ab1fdd554a815cde52a786bb82ad35b7 to your computer and use it in GitHub Desktop.
Save chrisj-au/ab1fdd554a815cde52a786bb82ad35b7 to your computer and use it in GitHub Desktop.
Parameter handling in CloudFormation
# Reminder of how to do some basic parameter handling in CFN - not syntatically correct (conditions don't match params etc) just a dump of way to handle things
Parameters:
ProjectName:
Type: String
Default: cicd-terraform
AllowedPattern: [a-zA-Z][a-zA-Z0-9-]*
MinLength: 3
MaxLength: 64
Description: Adhere to S3 naming standard; must begin with a letter and contain only alphanumeric characters or hyphens.
SnsTopicEmailAddress:
Type: String
Default: ''
AllowedPattern: (^$|^[^@\s]+@[^@\s]+\.[^@\s]+$)
Description: >-
'Email address for recipients who wish to recieve notifications when someone approves/rejects an approval gate in any pipeline in the account.
(Leave blank if there is no need for notifications)'
DeployApprovalAudit:
Type: String
Default: true
AllowedValues:
- true
- false
Conditions:
ShouldCreateSchedule:
!Not
- !Equals ["None", !Ref TFSchdule]
ShouldCreateDestroy:
!Equals [true, !Ref TFDestroyCodePipe]
SnsEmailAddressExists:
!Not
- !Equals
- !Ref SnsTopicEmailAddress
- ''
Metadata:
AWS::CloudFormation::Interface:
ParameterLabels:
ProjectName:
default: Project Name
ParameterGroups:
-
Label:
default: Environment Details
Parameters:
- ProjectName
- Environment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment