aws / aws/aws-sam-cli

Use the default profile for default values with custom config-env

Open
#2,258 7 comments 24 reactions 0 assignees View on GitHub
area/sam-config maintainer/need-response type/feature
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### Describe your idea/feature/enhancement

I would like to be able to specify multiple `env` profiles in my `samconfig.toml`, and share common settings via the `default` profile.

As an example of what I would like to do:

```
version = 0.1
[default]
[default.deploy]
[default.deploy.parameters]
s3_bucket =
s3_prefix =
region = "us-east-1"
confirm_changeset = false
capabilities = "CAPABILITY_NAMED_IAM"

[env1]
[env1.deploy]
[env1.deploy.parameters]
stack_name = "Environment 1"
parameter_overrides = "Environment=\"Environment1\""

[env2]
[env2.deploy]
[env2.deploy.parameters]
stack_name = "Environment 2"
parameter_overrides = "Environment=\"Environment2\""
```

Currently, the selected profile needs to have all of the parameters provided, which will lead to extensive duplication with a large number of profiles.

### Proposal

One possibility would be to process the config file twice. The first pass would load the defaults, with the second pass augmenting & overriding these defaults. The command line overrides would then follow as normal.

### Additional Details

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.