aws / aws/aws-sam-cli

Bug: SAM deploy only sets env vars once

Open
#4,048 6 comments 0 reactions 0 assignees View on GitHub
area/deploy
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### Description:

When using env vars in the template file, the values will only be used once and will never update when the values are changes in the template.

They will **only** change when the name of the ref is changed.

Furthermore, the values seem somehow pulled from a "cache", because when we change the Refs back to their original names, the value that gets deployed is an old one we no longer use.

### Steps to reproduce:

1. Sam deploy with a template file and a new env var from a ref.
2. Change the ref's **value**
3. Deploy
4. Confirm value has _not_ updated
5. Change the ref's **name** and value
6. Deploy
7. Confirm value _has_ updated

### Observed result:

I can't provide everything for obvious security reasons, but the debugger **does** pick up the right value:
`2022-07-11 11:40:09,407 | Collected default values for parameters: {'TheGraphProjectSlug': 'remx-subgraph2'}`

Result in Lambda (incorrect):
![image](https://user-images.githubusercontent.com/1668207/178303247-dc07d741-3c6a-40ca-9bba-2df6c0c4a330.png)

### Expected result:

Env vars to just update their values correctly.

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

1. OS: MacOS 12.3.1
2. `sam --version`: 1.53.0
8. AWS region: us-east-1

`Add --debug flag to command you are running`

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.