Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@ import { Bootstrapper } from '../../../lib/api/bootstrap';
import type { IIoHost } from '../../../lib/api/io';
import { asIoHelper } from '../../../lib/api/io/private';

describe('ExternalId Protection Integration Test', () => {
let ioHost: IIoHost;
let ioHelper: any;
let ioHost: IIoHost;
let ioHelper: any;
let template: any;

beforeEach(() => {
ioHost = {
notify: jest.fn(),
requestResponse: jest.fn(),
};
ioHelper = asIoHelper(ioHost, 'bootstrap');
});

test('bootstrap template denies AssumeRole with ExternalId by default', async () => {
// GIVEN
const bootstrapper = new Bootstrapper({ source: 'default' }, ioHelper);
beforeEach(async () => {
ioHost = {
notify: jest.fn(),
requestResponse: jest.fn(),
};
ioHelper = asIoHelper(ioHost, 'bootstrap');

// WHEN
const template = await (bootstrapper as any).loadTemplate();
// GIVEN
const bootstrapper = new Bootstrapper({ source: 'default' }, ioHelper);
// WHEN
template = await (bootstrapper as any).loadTemplate();
});

describe('bootstrap template', () => {
test('denies AssumeRole with ExternalId by default', async () => {
// THEN
// Verify the parameter exists
expect(template.Parameters.DenyExternalId).toMatchObject({
Expand Down Expand Up @@ -70,4 +70,8 @@ describe('ExternalId Protection Integration Test', () => {
expect(stmt.Condition).toBeUndefined();
}
});

test('has the same values for BootstrapVersion Parameter and Output', async () => {
expect(template.Outputs.BootstrapVersion.Value).toEqual(template.Resources.CdkBootstrapVersion.Properties.Value);
});
});
8 changes: 6 additions & 2 deletions packages/aws-cdk/lib/api/bootstrap/bootstrap-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,7 @@ Resources:
Type: String
Name:
Fn::Sub: '/cdk-bootstrap/${Qualifier}/version'
# Also update this value below (see comment there)
Value: '29'
Outputs:
BucketName:
Expand Down Expand Up @@ -844,5 +845,8 @@ Outputs:
BootstrapVersion:
Description: The version of the bootstrap resources that are currently mastered
in this stack
Value:
Fn::GetAtt: [CdkBootstrapVersion, Value]
# This value is purposely duplicated here from the AWS::SSM::Parameter value we define above.
# {Fn::GetAtt} on an SSM Parameter is eventually consistent, and can fail with "parameter
# doesn't exist" even after just having been created. To reduce our deploy failure rate, we
# duplicate the value here and use a build-time test to ensure the two values are the same.
Value: '29'
Loading