aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.68k stars 3.93k forks source link

fix(ec2): exposed userDataCausesReplacement in BastionHostLinuxProps #31416

Closed ashishdhingra closed 1 month ago

ashishdhingra commented 2 months ago

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


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

mergify[bot] commented 1 month ago

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

aws-cdk-automation commented 1 month ago

AWS CodeBuild CI Report

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

mergify[bot] commented 1 month ago

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

github-actions[bot] commented 1 month ago

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.