Skip to content

Commit fc3be31

Browse files
fix(ec2): naming collisions when using ec2.InitFile.fromAsset() on multiple instances in the same stack (#27468)
Closes #16891 If a user creates more than one EC2 instance in the same stack and defines an InitConfig for each instance using `ec2.InitFile.fromAsset()`, the user will get an error if they pass in the same `targetFilePath` or `targetDirectory`. This bug is due to [how the asset is uploaded to S3](https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-ec2/lib/cfn-init-elements.ts#L427). This PR fixes this issue by adding a hash to the `targetFileName` before being uploaded as an s3 asset. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 10b3221 commit fc3be31

17 files changed

+3255
-2
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init-multiple.js.snapshot/asset.04c44be8722f4360fe0830af22298ad0870480310d7bd6eedbbd2391aecf59a8

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init-multiple.js.snapshot/asset.1be0bac6581864b510bdbf0a114f1d3429244758da7657cc365f73d371fe70ed/__entrypoint__.js

+147
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init-multiple.js.snapshot/asset.1be0bac6581864b510bdbf0a114f1d3429244758da7657cc365f73d371fe70ed/index.js

+95
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init-multiple.js.snapshot/asset.b9ca21e9930115b91ab7e6877bec3bc97b410a6d41fd58816b56aba6db2643bd

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init-multiple.js.snapshot/cdk.out

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init-multiple.js.snapshot/instancetestDefaultTestDeployAssert5516EAF1.assets.json

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init-multiple.js.snapshot/instancetestDefaultTestDeployAssert5516EAF1.template.json

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.instance-init-multiple.js.snapshot/integ-ec2-multiple-instances-in-stack.assets.json

+58
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)