Skip to content

Commit

Permalink
Merge pull request #111 from MeroFuruya/feature/changeSetNameParameter
Browse files Browse the repository at this point in the history
implement change-set-name parameter
  • Loading branch information
kddejong authored Nov 2, 2023
2 parents e13f212 + 15936c7 commit 608d7ad
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ inputs:
http-proxy:
description: 'Proxy to use for the AWS SDK agent'
required: false
change-set-name:
description: "The name of the change set to create. Defaults to '<stack-name>-CS'"
required: false
outputs:
stack-id:
description: "The id of the deployed stack. In addition, any outputs declared in the deployed CloudFormation stack will also be set as outputs for the action, e.g. if the stack has a stack output named 'foo', this action will also have an output named 'foo'."
Expand Down
4 changes: 2 additions & 2 deletions src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ async function getStack(

export async function deployStack(
cfn: aws.CloudFormation,
params: CreateStackInput,
params: CreateStackInput & CreateChangeSetInput,
noEmptyChangeSet: boolean,
noExecuteChangeSet: boolean,
noDeleteFailedChangeSet: boolean
Expand All @@ -144,7 +144,7 @@ export async function deployStack(
cfn,
stack,
{
ChangeSetName: `${params.StackName}-CS`,
ChangeSetName: params.ChangeSetName || `${params.StackName}-CS`,
...{
StackName: params.StackName,
TemplateBody: params.TemplateBody,
Expand Down
8 changes: 6 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ export async function run(): Promise<void> {
required: false
})
)
const changeSetName = core.getInput('change-set-name', {
required: false
})

// Configures proxy
configureProxy(httpProxy)
Expand All @@ -108,7 +111,7 @@ export async function run(): Promise<void> {
}

// CloudFormation Stack Parameter for the creation or update
const params: CreateStackInput = {
const params: CreateStackInput & CreateChangeSetInput = {
StackName: stackName,
Capabilities: [...capabilities.split(',').map(cap => cap.trim())],
RoleARN: roleARN,
Expand All @@ -118,7 +121,8 @@ export async function run(): Promise<void> {
TemplateBody: templateBody,
TemplateURL: templateUrl,
Tags: tags,
EnableTerminationProtection: terminationProtections
EnableTerminationProtection: terminationProtections,
ChangeSetName: changeSetName
}

if (parameterOverrides) {
Expand Down

0 comments on commit 608d7ad

Please sign in to comment.