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

Bug: sam delete works with global parameters defined in toml, but not yaml #6449

Closed
rhbecker opened this issue Dec 14, 2023 · 2 comments
Closed
Labels
area/delete stage/waiting-for-release Fix has been merged to develop and is waiting for a release type/bug

Comments

@rhbecker
Copy link

Description:

The sam delete command cannot seem to find parameters defined in a global section of samconfig.yaml (but the same parameters specified in samconfig.toml work fine).

Steps to reproduce:

These commands work fine with both toml and yaml editions of samconfig ...

sam build --config-env test
sam deploy --config-env test

This command works fine with the toml edition, but not the yaml edition of samconfig ...

sam delete --config-env test

Example toml file ...

version = 0.1

[test.global.parameters]
confirm_changeset = true
image_repositories = [ ]
parameter_overrides = [ ]
region = "us-west-2"
s3_bucket = "build-artifacts-REDACTED-ID"
s3_prefix = "cloudformation/sam-cli/test"
stack_name = "test"
template = ".dev/tests/test.yaml"

Example yaml file ...

version: 0.1
test:
  global:
    parameters:
      confirm_changeset: true
      image_repositories: []
      parameter_overrides: []
      region: us-west-2
      s3_bucket: build-artifacts-REDACTED-ID
      s3_prefix: cloudformation/sam-cli/test
      stack_name: test
      template: .dev/tests/test.yaml

Observed result:

Executing sam delete --config-env test with the yaml edition of samconfig results in a prompt ...

Enter stack name you want to delete

... but stack_name is specified.

If I play along, and execute ...

sam delete --config-env test --stack-name test

... it deletes the stack, but then can't find the parameters it needs to use to find the template in S3 ...

Warning: Cannot resolve s3 bucket information from command options , local config file or cloudformation template. Please use --s3-bucket next time and delete s3 files manually if required.

Expected result:

Configuration specified via yaml should function in an equivalent manner to configuration specified via toml.

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

  1. OS: Ubuntu via WSL on Windows 10
  2. sam --version: 1.105.0
  3. AWS region: us-west-2
# Paste the output of `sam --info` here
{
  "version": "1.105.0",
  "system": {
    "python": "3.11.3",
    "os": "Linux-5.15.90.1-microsoft-standard-WSL2-x86_64-with-glibc2.31"
  },
  "additional_dependencies": {
    "docker_engine": "Not available",
    "aws_cdk": "Not available",
    "terraform": "Not available"
  },
  "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"
  ]
}
@rhbecker rhbecker added the stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. label Dec 14, 2023
@hnnasit
Copy link
Contributor

hnnasit commented Dec 15, 2023

Hi @rhbecker, thanks for reporting the issue. You're right, as per docs sam delete should pick up the samconfig.yaml file without providing the --config-file option. Removing this function call from delete_context and adding the configuration decorator for delete command should fix the issue. Marking this as a bug.

@hnnasit hnnasit added type/bug area/delete and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Dec 15, 2023
@sidhujus sidhujus added the stage/waiting-for-release Fix has been merged to develop and is waiting for a release label Jan 19, 2024
Copy link
Contributor

Patch is released in v1.108.0. Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/delete stage/waiting-for-release Fix has been merged to develop and is waiting for a release type/bug
Projects
None yet
Development

No branches or pull requests

3 participants