aws-ec2: Expose userDataCausesReplacement in BastionHostLinuxProps #31348
Labels
@aws-cdk/aws-ec2
Related to Amazon Elastic Compute Cloud
bug
This issue is a bug.
effort/small
Small work item – less than a day of effort
p2
Describe the bug
When creating a bastion host, I use the 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.Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
Changing userData would (optionally) cause the bastion host instance to be replaced.
Current Behavior
Changing userData has no effect on the bastion host instance.
Reproduction Steps
sshKeys
collection.ssh/authorized_keys
and see that the authorized keys have not been updatedPossible Solution
Exposing the userDataCausesReplacement property in BastionHostLinuxProps and passing that to the Instance would fix this.
e.g.
Additional Information/Context
As a workaround, I have been adding the
init
andinitOptions
properties to BastionHostLinuxProps since their existence will force the instance to be replaced whenuserData
changes.CDK CLI Version
2.149.0 (build c8e5924)
Framework Version
No response
Node.js Version
v18.20.2
OS
Ubuntu 20.04
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: