Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParameterOverrides with commas in them fail #47

Open
damian-bisignano opened this issue Nov 19, 2020 · 10 comments
Open

ParameterOverrides with commas in them fail #47

damian-bisignano opened this issue Nov 19, 2020 · 10 comments

Comments

@damian-bisignano
Copy link

damian-bisignano commented Nov 19, 2020

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

@Masumpatwary121
Copy link

  • name: AWS CloudFormation "Deploy CloudFormation Stack" Action for GitHub Actions
    uses: aws-actions/aws-cloudformation-github-deploy@v1.0.3

@timharris777
Copy link

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.

@dror-weiss
Copy link

Hi @damian-bisignano , were you able to find a solution?

@matthewmrichter
Copy link

Argh, this is a killer, any movement toward a fix here?

@dror-weiss
Copy link

@matthewmrichter , multi-value key is supported by using the very intuitive syntax:

parameter-overrides: >-
    SubnetId=subnet-11111111,
    SubnetId=subnet-22222222

@matthewmrichter
Copy link

@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

@DimDroll
Copy link

DimDroll commented Feb 3, 2023

@matthewmrichter As per:

ParameterValue: 'myValue2,myValue3'

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.

@monemihir
Copy link

monemihir commented Feb 15, 2023

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.

@paulvav
Copy link

paulvav commented Mar 2, 2023

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?

@kddejong
Copy link
Contributor

kddejong commented Mar 3, 2023

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants