aws-amplify / amplify-cli

The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Apache License 2.0
2.81k stars 819 forks source link

Changes in cloudformation template get reverted when trying to push to the cloud #13861

Closed DrBallHard closed 1 month ago

DrBallHard commented 2 months ago

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

v20.10.0

Amplify CLI Version

12.12.0

What operating system are you using?

Windows

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No manual changes made

Describe the bug

I made some changes specifically to the guest access for the getObject action for amplify storage. After updating this in cloudformation-template.json, I attempted to do an 'amplify push' but instead of pushing these changes it only pulls and reverts back to what it was before. It seems like it doesn't recognize these changes I made here:

          {
              "Action": "s3:GetObject",
              "Effect": "Allow",
              "Resource": [
                {
                  "Fn::Join": [
                    "",
                    [
                      "arn:aws:s3:::",
                      {
                        "Ref": "S3Bucket"
                      },
                      "/public/*"
                    ]
                  ]
                },
                {
                  "Fn::Join": [
                    "",
                    [
                      "arn:aws:s3:::",
                      {
                        "Ref": "S3Bucket"
                      },
                      "/protected/*"
                    ]
                  ]
                }
              ]
            },

Expected behavior

I expect this change to be recognized and then pushed to the cloud

Reproduction steps

  1. make a change in the getObject policy in cloudformation-template for storage
  2. attempt to 'amplify push' these changes

Project Identifier

No response

Log output

``` # Put your logs below this line ```

Additional information

No response

Before submitting, please confirm:

ykethan commented 2 months ago

Hey, thank you for reaching out. If you are looking to modify the storage config i would suggest using the Amplify overrides to make the changes. https://docs.amplify.aws/gen1/nextjs/build-a-backend/storage/modify-amplify-generated-resources/ Amplify CLI runs a pull before the push ensuring the local copy is in sync with the current-cloud-backend, the override provides the capability to modify the CloudFormation template on resources such as auth and storage using cdk.

ykethan commented 1 month ago

Closing the issue due to inactivity. Do reach out to us if you are still experiencing this issue

github-actions[bot] commented 1 month ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.