logo
Menu

Amazon CodeCatalyst workflow for AWS CloudFormation PR branch

Example CodeCatalyst workflow to run CloudFormation plan on a PR branch.

Rohini Gaonkar
Amazon Employee
Published May 5, 2023
Last Modified Mar 28, 2024
This snippet shows a CodeCatalyst workflow that will run super-linter on the CloudFormation template, and then create a changeset, but not apply any changes. It is intended to be used on a PR branch - see this example of the main branch workflow.
Used in:

Snippet

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Name: PR_Branch_Workflow
SchemaVersion: "1.0"

# Optional - Set automatic triggers.
Triggers:
- Type: PULLREQUEST
Branches:
- main
Events:
- OPEN
- REVISION

# Required - Define action configurations.
Actions:
Super-Linter_0d:
# Identifies the action. Do not modify this value.
Identifier: aws/github-actions-runner@v1

# Specifies the source and/or artifacts to pass to the action as input.
Inputs:
# Optional
Sources:
- WorkflowSource # This specifies that the action requires this Workflow as a source

# Defines the action's properties.
Configuration:
# Required - Steps are sequential instructions that run shell commands
# Action URL: https://github.com/marketplace/actions/super-linter
# Please visit the action URL to look for examples on the action usage.
# Be aware that a new version of the action could be available on GitHub.
Steps:
- name: Lint Code Base
uses: github/super-linter@v4
env:
VALIDATE_CLOUDFORMATION: "true"
CreateChangeSet:
Identifier: aws/cfn-deploy@v1
DependsOn:
- Super-Linter_0d
Configuration:
parameter-overrides: SSHLocation=54.10.10.2/32,WebServerInstanceType=t2.micro
capabilities: CAPABILITY_IAM,CAPABILITY_NAMED_IAM,CAPABILITY_AUTO_EXPAND
no-execute-changeset: "1"
template: VPC_AutoScaling_With_Public_IPs.json
region: us-west-2
name: PreProdEnvStack
Timeout: 10
Environment:
Connections:
- Role: pr_branch_IAM_role
Name: "123456789012"
Name: PreProdEnv
Inputs:
Sources:
- WorkflowSource
 

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.

Comments