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 deploy --guided doesn't remove conflicting properties #4841

Closed
mildaniel opened this issue Mar 9, 2023 · 7 comments
Closed

Bug: sam deploy --guided doesn't remove conflicting properties #4841

mildaniel opened this issue Mar 9, 2023 · 7 comments
Labels
area/deploy sam deploy command type/bug

Comments

@mildaniel
Copy link
Contributor

Description:

When running a guided deployment and saving the parameters back to a samconfig.toml that already includes a resolve_s3=true option, the S3 bucket option is also added, making the next sam deploy without a guided flag fail.

Steps to reproduce:

  1. Initialize any hello world application using sam init.
  2. Run sam build
  3. Run sam deploy --guided and ensure to save to a samconfig.toml file
  4. Run sam deploy again without the --guided flag

Observed result:

Error message about conflicting arguments
Error: Cannot use both --resolve-s3 and --s3-bucket parameters in non-guided deployments. Please use only one or use the --guided option for a guided deployment.

Expected result:

Deploy should succeed.

The issue seems to be that when writing to the config file, the resolve_s3=true option isn't cleaned up even though AWS SAM CLI creates a managed bucket and uses that bucket for subsequent deployments.

The fix is adding a step here: https://github.com/aws/aws-sam-cli/blob/develop/samcli/commands/deploy/guided_config.py#L66 to remove these kinds of conflicting parameters before flushing the config.

@mildaniel mildaniel added stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. type/bug and removed stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Mar 9, 2023
@hawflau hawflau added the stage/waiting-for-release Fix has been merged to develop and is waiting for a release label Mar 20, 2023
@qingchm
Copy link
Contributor

qingchm commented Mar 24, 2023

This is fixed by the latest release 1.78.0 Please have a look! Feel free to re-open if there are other issues regarding this!

@qingchm qingchm closed this as completed Mar 24, 2023
@github-actions
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@mlowy
Copy link

mlowy commented Apr 20, 2023

@qingchm
I seem to face this issue in github actions using setup-sam@v2 :

sam package \
    --s3-bucket ${TESTING_ARTIFACTS_BUCKET} \
    --region ${TESTING_REGION} \
    --output-template-file packaged-testing.yaml
    --debug
  shell: /usr/bin/bash -e {0}
  env:
    TESTING_ARTIFACTS_BUCKET: aws-sam-cli-managed-dev-pipeline-artifactsbucket-xyz..
    TESTING_REGION: eu-central-1
......

Error: Cannot use both --resolve-s3 and --s3-bucket parameters. Please use only one.
Error: Process completed with exit code 1.
    

@ruminize
Copy link

SAM CLI, version 1.90.0

version: 0.2
phases:
install:
runtime-versions:
python: 3.8
commands:
- pip install --upgrade pip
- pip install --upgrade awscli aws-sam-cli
build:
commands:
- . ./assume-role.sh ${ENV_PIPELINE_EXECUTION_ROLE} deploy
- sam deploy --stack-name ${ENV_STACK_NAME}
--template ${ENV_TEMPLATE}
--capabilities CAPABILITY_IAM
--region ${ENV_REGION}
--s3-bucket ${ENV_BUCKET}
--no-fail-on-empty-changeset
--role-arn ${ENV_CLOUDFORMATION_EXECUTION_ROLE}

Running command sam package --s3-bucket ${TESTING_ARTIFACT_BUCKET} --region ${TESTING_REGION} --output-template-file packaged-test.yaml

Cannot use both --resolve-s3 and --s3-bucket parameters. Please use only one.

@hawflau
Copy link
Contributor

hawflau commented Jul 14, 2023

Reopening the issue for investigation

@hawflau hawflau reopened this Jul 14, 2023
@hawflau hawflau added stage/needs-investigation Requires a deeper investigation and removed stage/waiting-for-release Fix has been merged to develop and is waiting for a release labels Jul 14, 2023
@hawflau
Copy link
Contributor

hawflau commented Jul 14, 2023

Hi @ruminize @mlowy, can you please confirm resolve_s3 is not set in the samconfig.toml in your project? You should remove it if it exists. Please feel free to open a new issue if that doesn't resolve your issue.

Closing again since the new comments are about non-guided deploy.

@hawflau hawflau closed this as completed Jul 14, 2023
@hawflau hawflau added area/deploy sam deploy command and removed stage/needs-investigation Requires a deeper investigation labels Jul 14, 2023
@github-actions
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/deploy sam deploy command type/bug
Projects
None yet
Development

No branches or pull requests

5 participants