Skip to content

chore: forward merge 'master' into 'v2-main' - #17658

Merged
mergify[bot] merged 6 commits into
v2-mainfrom
v2/forward-merge-20211123
Nov 23, 2021
Merged

mergify[bot] merged 6 commits into
v2-mainfrom
v2/forward-merge-20211123

Conversation

@aws-cdk-automation

@aws-cdk-automation aws-cdk-automation commented Nov 23, 2021 •

Copy link
Copy Markdown
Collaborator

Automated action from aws/cdk-ops

Niranjan Jayakar and others added 5 commits November 23, 2021 11:13
----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
The `Cluster.addCapacity` method was deprecated in #14386 as part of the
introduction of `Cluster.addAsgCapacityProvider`. However, the corresponding
`ClusterProps.capacity` property and `AddCapacityOptions` interface were not
deprecated, leading to a confusing mismash of deprecated and undeprecated usage.
The README for ECS still heavily references `Cluster.addCapacity`, further
leading to potential confusion for users just following the module's guidance.

As part of cleaning up deprecated usage as part of the lead-up to the V2 launch,
opting to un-deprecate the `addCapacity` method rather than deprecating the
other two elements and rewriting the README.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
…te failure (#17530)

This fixes the issue where updating the memoryLimit or vpc of the
BucketDeployment resource would result in a stack update failure. In
order to fix this the ID of the BucketDeployment CustomResource includes
info on the memoryLimit and vpc in the same way that the Lambda function
does. This means that when either of these values are updated, the
BucketDeployment CustomResource will be recreated along with the Lambda
function.

If anyone is setting `retainOnDelete=false` (default is `true`) then
this change would result in the data in the bucket being deleted. In
order to avoid this scenario, this PR introduces a bucket tag that
controls whether or not a BucketDeployment resource can delete data from
the bucket.

The BucketDeployment resource will now add a tag to the deployment
bucket with a format like `aws-cdk:cr-owned:{keyPrefix}:{uniqueHash}`.
For example:

```
{
  Key: 'aws-cdk:cr-owned:deploy/here/:240D17B3',
  Value: 'true',
}
```

Each bucket+keyPrefix can be "owned" by 1 or more BucketDeployment
resources. Since there are some scenarios where multiple BucketDeployment
resources can deploy to the same bucket and key prefix
(e.g. using include/exclude) we also append part of the id to
make the key unique.

As long as a bucket+keyPrefix is "owned" by a BucketDeployment
resource, another CR cannot delete data. There are a couple of
scenarios where this comes into play.

1. If the LogicalResourceId of the CustomResource changes
(e.g. memoryLimit is updated) CloudFormation will first issue a 'Create'
to create the new CustomResource and will update the Tag on the bucket.
CloudFormation will then issue a 'Delete' on the old CustomResource
and since the new CR "owns" the Bucket+keyPrefix (indicated by the
presence of the tag), the old CR will not delete the contents of the bucket

2. If the BucketDeployment resource is deleted _and_ it is the only CR
for that bucket+keyPrefix then CloudFormation will first remove the tag
from the bucket and then issue a "Delete" to the CR. Since there are no
tags indicating that this bucket+keyPrefix is "owned" then it will delete
the contents.

3. If the BucketDeployment resource is deleted _and_ it is *not* the only
CR for that bucket:keyPrefix then CloudFormation will first remove the tag
from the bucket and then issue a "Delete" to the CR.
Since there are other CRs that also "own" that bucket+keyPrefix
(indicated by the presence of tags), there will
still be a tag on the bucket and the contents will not be removed. The
contents will only be removed after _all_ BucketDeployment resource that
"own" the bucket+keyPrefix have been removed.

4. If the BucketDeployment resource _and_ the S3 Bucket are both removed,
then CloudFormation will first issue a "Delete" to the CR and since there
is a tag on the bucket the contents will not be removed. If you want the
contents of the bucket to be removed on bucket deletion, then
`autoDeleteObjects` property should be set to true on the Bucket.

Scenario 3 & 4 are changes to the existing functionality in that they
now do *not* delete data in some scenarios when they did previously.

fixes #7128


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
This is done with the express purpose of improving its discoverability on Construct Hub.

----
Changed the description and added keywords
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@aws-cdk-automation aws-cdk-automation added pr/auto-approve Notifies the GH action to auto-approve this PR pr/forward-merge PR label to indicate forward merges of master to v2-main pr/no-squash This PR should be merged instead of squash-merging it labels Nov 23, 2021
@gitpod-io

gitpod-io Bot commented Nov 23, 2021

Copy link
Copy Markdown

@aws-cdk-automation

Copy link
Copy Markdown
Collaborator Author

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 31516ef
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify
mergify Bot merged commit 31eef1f into v2-main Nov 23, 2021
@mergify
mergify Bot deleted the v2/forward-merge-20211123 branch November 23, 2021 17:18
@mergify

mergify Bot commented Nov 23, 2021

Copy link
Copy Markdown
Contributor

Thank you for contributing! Your pull request will be automatically updated and merged without squashing (do not update manually, and be sure to allow changes to be pushed to your fork).

ali-n4i pushed a commit to ali-n4i/aws-cdk that referenced this pull request Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr/auto-approve Notifies the GH action to auto-approve this PR pr/forward-merge PR label to indicate forward merges of master to v2-main pr/no-squash This PR should be merged instead of squash-merging it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants