Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ec2): set proper role for --role argument of cfn-init #16503

Merged
merged 2 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ec2/lib/cfn-init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class CloudFormationInit {
resourceLocator = `${resourceLocator} --url https://cloudformation.${Aws.REGION}.${Aws.URL_SUFFIX}`;
}
if (attachOptions.includeRole) {
resourceLocator = `${resourceLocator} --role ${attachOptions.instanceRole}`;
resourceLocator = `${resourceLocator} --role ${attachOptions.instanceRole.roleName}`;
}
const configSets = (attachOptions.configSets ?? ['default']).join(',');
const printLog = attachOptions.printLog ?? true;
Expand Down
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-ec2/test/cfn-init.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ describe('userdata', () => {
expectLine(lines, cmdArg('cfn-init', `--region ${Aws.REGION}`));
expectLine(lines, cmdArg('cfn-init', `--stack ${Aws.STACK_NAME}`));
expectLine(lines, cmdArg('cfn-init', `--resource ${resource.logicalId}`));
expectLine(lines, cmdArg('cfn-init', `--role ${instanceRole}`));
expectLine(lines, cmdArg('cfn-init', `--role ${instanceRole.roleName}`));
expectLine(lines, cmdArg('cfn-init', `--url https://cloudformation.${Aws.REGION}.${Aws.URL_SUFFIX}`));
expectLine(lines, cmdArg('cfn-init', '-c default'));
expectLine(lines, cmdArg('cfn-signal', `--region ${Aws.REGION}`));
expectLine(lines, cmdArg('cfn-signal', `--stack ${Aws.STACK_NAME}`));
expectLine(lines, cmdArg('cfn-signal', `--resource ${resource.logicalId}`));
expectLine(lines, cmdArg('cfn-init', `--role ${instanceRole}`));
expectLine(lines, cmdArg('cfn-init', `--role ${instanceRole.roleName}`));
expectLine(lines, cmdArg('cfn-init', `--url https://cloudformation.${Aws.REGION}.${Aws.URL_SUFFIX}`));
expectLine(lines, cmdArg('cfn-signal', '-e $?'));
expectLine(lines, cmdArg('cat', 'cfn-init.log'));
Expand Down