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

sam deploy incorrectly displays parameter override when value has a space in it #2018

Closed
Aleksandr-Filichkin opened this issue Jun 2, 2020 · 12 comments
Assignees
Labels
area/deploy sam deploy command type/bug

Comments

@Aleksandr-Filichkin
Copy link

Aleksandr-Filichkin commented Jun 2, 2020

sam version is 0.52.0
Cannot send parameter with whitespace in value

sam deploy --template-file sam_output.yaml --stack-name test --parameter-overrides "PARAM__KEY=PARAM VALUE"

but in log I see

Parameter overrides : {''PARAM__KEY': 'PARAM'}

Looks like it was not fixed for #1652

@sriram-mv
Copy link
Contributor

Did you try single quoting all the parameters as referenced in: #1652

@Aleksandr-Filichkin
Copy link
Author

Hi @sriram-mv, no. it doesn't help

@karahanozturk
Copy link

I had similar issue passing an xml file as parameter for SSO and it gets truncated after the first space.
AWS Support also managed to replicate the issue and confirmed it's a bug.
v0.53.0 doesn't work either. Temporary workaround is to downgrade to v0.32.0

@karahanozturk
Copy link

Can you label this as a bug? This needs more attention

@awood45 awood45 added area/deploy sam deploy command type/bug labels Jun 24, 2020
@awood45
Copy link
Member

awood45 commented Jun 24, 2020

Treating as a bug and investigating.

@awood45
Copy link
Member

awood45 commented Jun 25, 2020

I can confirm this bug does not exist, at least for the given example, when using sam deploy --guided - consider the following samconfig.toml:

version = 0.1
[default]
[default.deploy]
[default.deploy.parameters]
stack_name = "issue2018"
s3_bucket = "REDACTED"
s3_prefix = "issue2018"
region = "us-east-1"
capabilities = "CAPABILITY_IAM"
parameter_overrides = "TestParam=\"hello test\""

This works in 0.53.0.

@awood45
Copy link
Member

awood45 commented Jun 25, 2020

This doesn't preclude the issue in the original issue post, but it's at least a workaround. Looking at the original issue as well.

@awood45
Copy link
Member

awood45 commented Jun 25, 2020

$ sam deploy --parameter-overrides "TestParam='hello test'"

        Deploying with following values
        ===============================
        Stack name                 : issue2018
        Region                     : us-east-1
        Confirm changeset          : False
        Deployment s3 bucket       : aws-sam-cli-managed-default-samclisourcebucket-1fme5yordvskg
        Capabilities               : ["CAPABILITY_IAM"]
        Parameter overrides        : {'TestParam': "'hello"}

So this issue is confirmed by me as well, will try to see what the difference in behavior is. I can also note that double-quotes seem to behave differently and are another workaround:

$ sam deploy --parameter-overrides "TestParam=\"hello test\""

        Deploying with following values
        ===============================
        Stack name                 : issue2018
        Region                     : us-east-1
        Confirm changeset          : False
        Deployment s3 bucket       : aws-sam-cli-managed-default-samclisourcebucket-1fme5yordvskg
        Capabilities               : ["CAPABILITY_IAM"]
        Parameter overrides        : {'TestParam': 'hello test'}

@luchees
Copy link

luchees commented Jul 20, 2020

I'm still experiencing this issue. I've tried several combinations mentionned in the issues but none of them worked for me
"Key1=rate(1 hours)" "Key2=someValue"
"Key1='rate(1 hours)'" "Key2=someValue"
"Key1='rate(1\ hours)'" "Key2=someValue"
"Key1='rate(1\ hours)'" "Key2=someValue"
"Key1="rate(1 hours)"" "Key2=someValue"

@wchengru
Copy link
Contributor

Hi @Aleksandr-Filichkin @luchees ,
I have created a pr to support single quoting parameter overrides.
You can use single quotes to wrap string with spaces after this pr is released.

$samdev deploy --parameter-overrides "TestParam='hello test'"
	Deploying with following values
	===============================
	Stack name                 : sam-app
	Region                     : us-east-1
	Confirm changeset          : False
	Deployment s3 bucket       : aws-sam-cli-managed-default-samclisourcebucket-6wsl7tf21dut
	Capabilities               : ["CAPABILITY_IAM"]
	Parameter overrides        : {'TestParam': 'hello test'}
$ samdev deploy --parameter-overrides "Key1='rate(1 hours)' Key2=someValue"

	Deploying with following values
	===============================
	Stack name                 : sam-app
	Region                     : us-east-1
	Confirm changeset          : False
	Deployment s3 bucket       : aws-sam-cli-managed-default-samclisourcebucket-6wsl7tf21dut
	Capabilities               : ["CAPABILITY_IAM"]
	Parameter overrides        : {'Key1': 'rate(1 hours)', 'Key2': 'someValue'}

@wchengru
Copy link
Contributor

PR is released.

@PalituxD
Copy link

I resolved this scenario using options below:

"scripts": { "invoke": "sam ... --parameter-overrides \"$(jq -j 'to_entries[] | \"\\(.key)='\\\\\\\"'\\(.value)'\\\\\\\"''\\ '\"' params.json)\"" }

Or

sam ... --parameter-overrides "$(jq -j 'to_entries[] | "\(.key)='\\\"'\(.value)'\\\"''\ '"' params.json)"

KallynGowdy added a commit to casual-simulation/casualos that referenced this issue Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/deploy sam deploy command type/bug
Projects
None yet
Development

No branches or pull requests

7 participants