forked from artyom/update-cloudformation-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update action to support multiple parameter changes
The code now allows updating multiple CloudFormation stack parameters at once instead of being limited to a single parameter change. Parameters are specified in a Name=Value format, with each pair on a separate line. This is a breaking change, but since the code is barely two days old, it's unlikely somebody depends on it already.
- Loading branch information
Showing
4 changed files
with
97 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,19 @@ | ||
name: Update CloudFormation stack by changing a single parameter | ||
name: Update CloudFormation stack by only changing its parameters | ||
description: > | ||
Updates a single parameter in an existing CloudFormation stack while preserving all other settings. | ||
Updates CloudFormation stack by updating its parameters while preserving all other settings. | ||
inputs: | ||
stack: | ||
description: CloudFormation stack name | ||
required: true | ||
key: | ||
description: Name of stack parameter to update | ||
required: true | ||
value: | ||
description: New value to set for a given parameter | ||
parameters: | ||
description: > | ||
Newline-separated parameters to change in the Name=Value format. | ||
Stack parameters not set here would retain their existing values. | ||
required: true | ||
|
||
runs: | ||
using: docker | ||
image: docker://ghcr.io/artyom/update-cloudformation-stack:latest | ||
args: | ||
- '-stack=${{ inputs.stack }}' | ||
- '-key=${{ inputs.key }}' | ||
- '-value=${{ inputs.value }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package main | ||
|
||
import "testing" | ||
|
||
func Test_parseKvs(t *testing.T) { | ||
for _, tc := range []struct { | ||
input []string | ||
pairsParsed int | ||
wantErr bool | ||
}{ | ||
{input: nil}, | ||
{input: []string{"\n"}}, | ||
{input: []string{"k=v"}, pairsParsed: 1}, | ||
{input: []string{"k=v", "k=v"}, wantErr: true}, | ||
{input: []string{"k=v", "k2=v"}, pairsParsed: 2}, | ||
{input: []string{"k=v", "", "k2=v", ""}, pairsParsed: 2}, | ||
{input: []string{"k=v", "k2=v", "k=v"}, wantErr: true}, | ||
{input: []string{"k=v", "junk"}, wantErr: true}, | ||
{input: []string{"k= ", "k2=v"}, wantErr: true}, | ||
} { | ||
got, err := parseKvs(tc.input) | ||
if tc.wantErr != (err != nil) { | ||
t.Errorf("input: %q, want error: %v, got error: %v", tc.input, tc.wantErr, err) | ||
} | ||
if l := len(got); l != tc.pairsParsed { | ||
t.Errorf("input: %q, got %d kv pairs, want %d", tc.input, l, tc.pairsParsed) | ||
} | ||
} | ||
} |