aws / aws/aws-sam-cli

Bug: Paths for deploy command flags conflict

Open
#7,575 3 comments 0 reactions 0 assignees View on GitHub
type/documentation
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### Description:
I'm attempting to specify both a `--config-file` and `--template-file` in different directories. Both files exist, but if the template file is in a different directory, that seems to become the working directory.

Working commands:
`sam deploy --config-file samconfig.foo.toml --template-file foo-template.yaml`
`sam deploy --config-file ../../samconfig.foo.toml --template-file path/to/foo-template.yaml`

Command fails:
` sam deploy --config-file samconfig.foo.toml --template-file path/to/foo-template.yaml`

Error message: `Error: Config file samconfig.foo.toml does not exist or could not be read!`

### Steps to reproduce:
1. Create a config file in your working directory
2. Create a template file in a different directory
3. Attempt to run a `sam deploy` command specifying the locations of both

### Observed result:
```
2024-10-16 10:26:28,535 | Config file samconfig.foo.toml does not exist or could not be read!
Error: Config file samconfig.foo.toml does not exist or could not be read!
```

### Expected result:
The deploy is able advance with the proper configs. I was unable to find any info in the docs saying that specifying the `--template-file` command would change the working directory.

### Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
```
sam --info
{
"version": "1.98.0",
"system": {
"python": "3.8.13",
"os": "macOS-14.6.1-arm64-arm-64bit"
},
"additional_dependencies": {
"docker_engine": "Not available",
"aws_cdk": "Not available",
"terraform": "1.9.7"
},
"available_beta_feature_env_vars": [
"SAM_CLI_BETA_FEATURES",
"SAM_CLI_BETA_BUILD_PERFORMANCE",
"SAM_CLI_BETA_TERRAFORM_SUPPORT",
"SAM_CLI_BETA_RUST_CARGO_LAMBDA"
]
}
```

`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.