aws-cloudformation-github-deploy
aws-cloudformation-github-deploy copied to clipboard
ParameterOverrides with commas in them fail
I've got a parameter that is a comma separated list. this doesn't work it instead splits on this value, expecting it to be another Key-Value pair
i've tried with all sorts of combinations of " and ' around the parameters and couldn't get it working.
env:
SECURITY_GROUP_ID: sg-11111111
SUBNET_ID: subnet-11111111,subnet-22222222
- name: Deploy to AWS CloudFormation
id: cloudformation
uses: aws-actions/aws-cloudformation-github-deploy@v1
with:
name: MyStack
template: ./infrastructure.json
parameter-overrides: >-
SecurityGroupId=${{ env.SECURITY_GROUP_ID }},
SubnetId=${{ env.SUBNET_ID }}
the error i get is
Error: Invalid input for parameter key subnet-22222222". Need to specify either usePreviousValue as true or a value for the parameter
I imagine the update just needs to be update src/utils.ts line 52 to update to a regex that ignores if you have an escape character before the comma
Alternatively. update to use newline character for seperating. you won't have a newline character in your parameters from what i can think of in my use cases
- name: AWS CloudFormation "Deploy CloudFormation Stack" Action for GitHub Actions uses: aws-actions/[email protected]
I can confirm that this is an issue. It doesn't even honor quotes around the comma delimited list. Working on a fix. Will submit a pull request soon.
Hi @damian-bisignano , were you able to find a solution?
Argh, this is a killer, any movement toward a fix here?
@matthewmrichter , multi-value key is supported by using the very intuitive syntax:
parameter-overrides: >-
SubnetId=subnet-11111111,
SubnetId=subnet-22222222
@dror-weiss This issue is talking about individual parameters that have commas within them:
parameter-overrides: >-
SubnetIdList=subnet-11111111,subnet-22222222,subnet-333333,
VPCId=vpc-abcdefg1234
There seems to be no syntax, very intuitive or not, to accomplish that
@matthewmrichter As per: https://github.com/aws-actions/aws-cloudformation-github-deploy/blob/780e9430141a26b3bee5e0fa36aa3aa227a12ffd/tests/utils.test.ts#L70
Specifying multiple duplicate "ParameterKey" will concatenate them in one with comma separated ParameterValues.
So:
parameter-overrides: >-
SubnetIdList=subnet-11111111,
SubnetIdList=subnet-22222222,
SubnetIdList=subnet-333333,
VPCId=vpc-abcdefg1234
Will be passed to Cloudformation as
{
ParameterKey: 'SubnetIdList',
ParameterValue: 'subnet-11111111,subnet-22222222,subnet-333333'
},
{
ParameterKey: 'VPCId',
ParameterValue: 'vpc-abcdefg1234'
}
Thank you @dror-weiss for noticing this.
Confirming that the issue still exists.
Specifying multiple duplicate keys is not necessarily feasible in all scenarios. I may not always know how many subnets I have in the action and that also limits me creating a generic action that can handle multiple subnets - could be 2/3/4. I can't get it to work w/o writing convoluted code in my action to generate the proper syntax and inject it into the call.
Handling commas in the value field is really a missing feature here.
This is still an issue. Situations where the parameter contains a comma but is not an array cannot be addressed by the "duplicate parameter" workaround. For example a parameter with the value of a cronjob string - is not passable at the moment if it has a comma in it. Has anyone discovered out a workaround?
@paulvav can you look at release v1.2.0
there is a fix in there for handling this. You should now be able to do
parameter-overrides: >-
SubnetIdList="subnet-11111111,subnet-22222222,subnet-333333",
VPCId=vpc-abcdefg1234
I'm also updating documentation in the README