Skip to content

Commit 029c298

Browse files
fix(ec2): exposed userDataCausesReplacement in BastionHostLinuxProps (#31416)
### Issue # (if applicable) Closes #31348. ### Reason for this change When creating a Bastion host, customer is using instance's userData to write approved public keys to `.ssh/authorized_keys`. However, when changing the list of authorized keys, it does not trigger the instance to be replaced, so the modification has no effect. ### Description of changes Exposed `userDataCausesReplacement` in `BastionHostLinuxProps`. The value is passed down to downstream `AWS::EC2::Instance` resource. ### Description of how you validated changes Added unit and integration tests. **NOTE:** Re-invoking `Template.fromStack(stack)` doesn't change the resource Id, so unit test uses 2 stacks. May be invoking `Template.fromStack(stack)` caches the results and doesn't refresh it. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 5830ee1 commit 029c298

11 files changed

+2454
-1
lines changed

packages/@aws-cdk-testing/framework-integ/test/aws-ec2/test/integ.bastion-host-userdatacausesreplacement.js.snapshot/bastionhostuserdatacausesreplacementtestDefaultTestDeployAssert7991717B.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.bastion-host-userdatacausesreplacement.js.snapshot/bastionhostuserdatacausesreplacementtestDefaultTestDeployAssert7991717B.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.bastion-host-userdatacausesreplacement.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.bastion-host-userdatacausesreplacement.js.snapshot/integ-bastionhost-userdatacausesreplacement.assets.json

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

0 commit comments

Comments
 (0)