Skip to content

Commit

Permalink
fix(ec2): exposed userDataCausesReplacement in BastionHostLinuxProps (#…
Browse files Browse the repository at this point in the history
…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*
  • Loading branch information
ashishdhingra authored Oct 15, 2024
1 parent 5830ee1 commit 029c298
Show file tree
Hide file tree
Showing 11 changed files with 2,454 additions and 1 deletion.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 029c298

Please sign in to comment.