question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

parameter-overrides on command line block samconfig.toml values

See original GitHub issue

Description:

I have most of my parameter_overrides defined in my samconfig.toml file for my local commands. However, I want to pass a single value via the command line --parameter-overrides value. The documentation states:

For the parameter_overrides entry, both the parameter values that you provide on the command line and entries in the configuration file take precedence over corresponding objects declared in the Parameters section of the template file.

This would indicate to me that you can provide both and they’ll be merged but this doesn’t appear to be happening.

Steps to reproduce:

samconfig.toml

version = 0.1
[default.local_invoke.parameters]
parameter_overrides = "myFuncBucket=\"dev-my-func\"" 

Make the following call:

sam local invoke MyFunc --parameter-overrides 'ParameterKey=myFuncQueue,ParameterValue=QueueValue'

Observed result:

The value of myFuncQueue is passed to the function but the value of myFuncBucket is not.

Expected result:

Both myFuncQueue and myFuncBucket should be available to the function.

or…

The documentation should be updated to reflect that passing a command line parameter-overrides will prevent the use of the parameter_overrides.

I can make that documentation update if that is the case. However, I’m hoping that this is a bug.

Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

$ cat /etc/issue
Ubuntu 20.04.1 LTS \n \l
$ sam --version
SAM CLI, version 1.7.0
$ go version
go version go1.15.4 linux/amd64

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:18
  • Comments:22 (5 by maintainers)

github_iconTop GitHub Comments

7reactions
kyler-hyunacommented, Feb 8, 2021

I just came across this. It would be great to have samcofig.toml parameter_overrides merged with the cli values.

In my samconfig.toml I used parameter_overrides to specify staging/prod environments:

version = 0.1
[staging]
[staging.deploy]
[staging.deploy.parameters]
stack_name = "boom-staging"
parameter_overrides = "Environment=\"staging\""

[prod]
[prod.deploy]
[prod.deploy.parameters]
stack_name = "boom-prod"
parameter_overrides = "Environment=\"prod\""

This makes it super easy to do a deploy script by just passing --config-env in ci. However I also pass in values to my stack that are generated at deploy time, so I pass these in via --parameter-overrides.

For example:

sam deploy --config-env staging --parameter-overrides LastUpdated=$(date '+%Y-%m-%d')

Since --parameter-overrides via the cli overrides the samconfig.toml, the settings defined there are basically useless and I have to type them over again.


So what should happen should be a merge, with the command-line taking preference.

4reactions
mousedownmikecommented, Feb 2, 2021

Please don’t close this issue. The referenced issue (#2176) does not resolve the underlying problem of not being able to consistently override individual paramters.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS SAM CLI configuration file
Parameter values that you provide on the command line take precedence over corresponding entries in the configuration file. For example, if your configuration ......
Read more >
Doug Tangren on Twitter: "@sapessi Thanks. Small discussion ...
#awswishlist sam cli merges samconfig.toml parameter overrides with cli provided parameter overrides rather than be replaced by them.
Read more >
sam deploy - Amazon Serverless Application Model
A string that contains Amazon CloudFormation parameter overrides encoded as key-value pairs. Use the same format as the Amazon Command Line Interface (Amazon ......
Read more >
Alternatives to parameter overrides for AWS SAM deployment ...
I'm using Parameters for the domain values so they can be different for each ... In my samconfig.toml I end up with a...
Read more >
Build & deploy all AWS resources as easy as: npm run deploy ...
It's all quite self-explanatory, except maybe the last line where I remove ... sam-deploy () { # check if samconfig.toml exists.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found