Skip to content

Commit

Permalink
feat: additional user data
Browse files Browse the repository at this point in the history
  • Loading branch information
badmintoncryer committed Aug 11, 2024
1 parent e2f8adc commit 7f9abb3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ export interface CodeServerProps {
* @default 30
*/
readonly volumeSize?: number;

/**
* User data to run when launching the instance
*
* @default - No additional user data
*/
readonly userData?: string[];
}

/**
Expand Down Expand Up @@ -107,6 +114,10 @@ export class CodeServer extends Construct {
'sudo loginctl enable-linger ec2-user',
);

if (props.userData != null && props.userData.length > 0) {
instance.addUserData(...props.userData);
}

instance.addToRolePolicy(
props.policy ?? new iam.PolicyStatement({
actions: ['*'],
Expand Down

0 comments on commit 7f9abb3

Please sign in to comment.