Skip to content

sam delete needs to care about profile defined in the samconfig #3621

@organom

Description

@organom

Description:

With an environment defined in the samconfig.saml, that requires a profile different from the default aws profile, running sam delete --config-env ENV_FROM_SAMCONFIG --stack-name STACK_TO_DELETE will fail because the profile is not taken into account.
If running with AWS_PROFILE=XXX before the above sam delete command, the environment is found and sam can proceed.
sam deploy behaves correctly in the system.

Steps to reproduce:

On macOS Monterey 12.2 with sam installed over brew (v 1.37.0)
Use an environment from samconfig.saml that requires a profile (different from the AWS default profile)
Run sam delete --config-env ENV_FROM_SAMCONFIG --stack-name STACK_TO_DELETE

Observed result:

Error: The input stack STACK_TO_DELETE does not exist on Cloudformation in the region REGION_FROM_ENV

Expected result:

Same behavior as when adding AWS_PROFILE=XXXX before running the sam delete command.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions