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

Preview diff on deploy/package #4259

Closed
dannyrandall opened this issue Dec 9, 2022 · 1 comment
Closed

Preview diff on deploy/package #4259

dannyrandall opened this issue Dec 9, 2022 · 1 comment
Labels
type/design Issues that are design proposals.

Comments

@dannyrandall
Copy link
Contributor

This issue is a design proposal for adding a flag to copilot [noun] deploy and copilot [noun] package that previews changes that will be made to the existing cloudformation stack. This will show what changes Copilot will make to existing and new resources, which will become especially useful when testing/deploying extensions via #4208 or #4209.

Proposal

A new flag, --diff, will be added to deploy and package commands that calculates and prints the diff between the deployed stack (including the addons stack!) and the stack that will be deployed or generated.

After displaying the diff, copilot [noun] deploy --diff will prompt with a confirmation like:

Continue with deployment? [y/N]:

before deploying the proposed changes.

copilot [noun] package --diff will print the diff and exit. The exit code will be as follows:
0 = no diffs found
1 = diffs found
2 = error producing diff

This should allow for a script to skip deploying a stack if no changes will occur.

UX Examples

Some examples of how a diff will look in different scenarios:

Adding a lambda function

~ Resources:
  + EnvControllerFunction:
    + Type: AWS::Lambda::Function
    + Properties:
      + Code:
        + S3Bucket: "s3://location"
        + S3Key: "s3://location"
      + Timeout: 900
      + MemorySize: 512

Adding a statement to an IAM Role AssumeRolePolicyDocument:

~ Resources:
  ~ TaskRole:
    ~ Properties:
      ~ AssumeRolePolicyDocument:
        ~ Statement:
          # (1 unchanged list entry)
          + - Action: "*"
              Effect: "Allow"
              Principal:
                Service: "ecs-tasks.amazonaws.com"
          # (2 unchanged list entries)

Updating an attribute of an IAM Role AssumeRolePolicyDocument:

~ Resources:
  ~ TaskRole:
    ~ Properties:
      ~ AssumeRolePolicyDocument:
        ~ Statement:
          # (1 unchanged list entry)
          ~ - Effect: "Allow" -> "Deny"
          # (2 unchanged list entries)

Changing the ContainerPort parameter

~ Parameters:
  ~ ContainerPort:
    ~ Value: 80 -> 443
@efekarakus
Copy link
Contributor

Hi folks!!

I'm really excited to say that AWS Copilot v1.27 is out and preview with --diff is now supported! 🚀

I'll close the issue now! If you have any questions, feedback, or suggestions please feel free to open new GitHub issues 🥳

@efekarakus efekarakus unpinned this issue Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/design Issues that are design proposals.
Projects
None yet
Development

No branches or pull requests

2 participants