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(iam): incorrect input for AccountPrincipal is building successfully #31323

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-neptune-alpha/test/cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ describe('DatabaseCluster', () => {
});

function testStack() {
const stack = new cdk.Stack(undefined, undefined, { env: { account: '12345', region: 'us-test-1' } });
const stack = new cdk.Stack(undefined, undefined, { env: { account: '123456789012', region: 'us-test-1' } });
stack.node.setContext('availability-zones:12345:us-test-1', ['us-test-1a', 'us-test-1b']);
return stack;
}
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-neptune-alpha/test/instance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class TestStack extends cdk.Stack {
constructor(scope?: constructs.Construct, id?: string, props: cdk.StackProps = {}) {
super(scope, id, props);

this.node.setContext('availability-zones:12345:us-test-1', ['us-test-1a', 'us-test-1b']);
this.node.setContext('availability-zones:123456789012:us-test-1', ['us-test-1a', 'us-test-1b']);

this.vpc = new ec2.Vpc(this, 'VPC');
this.cluster = new DatabaseCluster(this, 'Database', {
Expand All @@ -219,5 +219,5 @@ class TestStack extends cdk.Stack {
}

function testStack() {
return new TestStack(undefined, undefined, { env: { account: '12345', region: 'us-test-1' } });
return new TestStack(undefined, undefined, { env: { account: '123456789012', region: 'us-test-1' } });
}
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-redshift-alpha/test/cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ describe('IAM role', () => {
});

function testStack() {
const newTestStack = new cdk.Stack(undefined, undefined, { env: { account: '12345', region: 'us-test-1' } });
newTestStack.node.setContext('availability-zones:12345:us-test-1', ['us-test-1a', 'us-test-1b']);
const newTestStack = new cdk.Stack(undefined, undefined, { env: { account: '123456789012', region: 'us-test-1' } });
newTestStack.node.setContext('availability-zones:123456789012:us-test-1', ['us-test-1a', 'us-test-1b']);
return newTestStack;
}
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ describe('auto scaling group', () => {
});

test('can set minCapacity, maxCapacity, desiredCapacity to 0', () => {
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '1234' } });
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '123456789012' } });
const vpc = mockVpc(stack);

new autoscaling.AutoScalingGroup(stack, 'MyFleet', {
Expand All @@ -374,7 +374,7 @@ describe('auto scaling group', () => {
});

test('validation is not performed when using Tokens', () => {
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '1234' } });
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '123456789012' } });
const vpc = mockVpc(stack);

new autoscaling.AutoScalingGroup(stack, 'MyFleet', {
Expand All @@ -395,7 +395,7 @@ describe('auto scaling group', () => {
});

test('maxCapacity defaults to minCapacity when using Token', () => {
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '1234' } });
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '123456789012' } });
const vpc = mockVpc(stack);

new autoscaling.AutoScalingGroup(stack, 'MyFleet', {
Expand Down Expand Up @@ -538,7 +538,7 @@ describe('auto scaling group', () => {
});

test('addToRolePolicy can be used to add statements to the role policy', () => {
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '1234' } });
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '123456789012' } });
const vpc = mockVpc(stack);

const fleet = new autoscaling.AutoScalingGroup(stack, 'MyFleet', {
Expand Down Expand Up @@ -569,7 +569,7 @@ describe('auto scaling group', () => {

testDeprecated('can configure replacing update', () => {
// GIVEN
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '1234' } });
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '123456789012' } });
const vpc = mockVpc(stack);

// WHEN
Expand Down Expand Up @@ -598,7 +598,7 @@ describe('auto scaling group', () => {

testDeprecated('can configure rolling update', () => {
// GIVEN
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '1234' } });
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '123456789012' } });
const vpc = mockVpc(stack);

// WHEN
Expand Down Expand Up @@ -628,7 +628,7 @@ describe('auto scaling group', () => {

testDeprecated('can configure resource signals', () => {
// GIVEN
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '1234' } });
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '123456789012' } });
const vpc = mockVpc(stack);

// WHEN
Expand All @@ -653,7 +653,7 @@ describe('auto scaling group', () => {

test('can configure EC2 health check', () => {
// GIVEN
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '1234' } });
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '123456789012' } });
const vpc = mockVpc(stack);

// WHEN
Expand All @@ -672,7 +672,7 @@ describe('auto scaling group', () => {

test('can configure EBS health check', () => {
// GIVEN
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '1234' } });
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '123456789012' } });
const vpc = mockVpc(stack);

// WHEN
Expand All @@ -692,7 +692,7 @@ describe('auto scaling group', () => {

test('can add Security Group to Fleet', () => {
// GIVEN
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '1234' } });
const stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '123456789012' } });
const vpc = mockVpc(stack);

// WHEN
Expand Down Expand Up @@ -2314,7 +2314,7 @@ describe('auto scaling group', () => {
let listener: ApplicationListener;

beforeEach(() => {
stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '1234' } });
stack = new cdk.Stack(undefined, 'MyStack', { env: { region: 'us-east-1', account: '123456789012' } });
vpc = mockVpc(stack);
alb = new ApplicationLoadBalancer(stack, 'alb', {
vpc,
Expand Down Expand Up @@ -2954,5 +2954,5 @@ function mockSecurityGroup(stack: cdk.Stack) {
}

function getTestStack(): cdk.Stack {
return new cdk.Stack(undefined, 'TestStack', { env: { account: '1234', region: 'us-east-1' } });
return new cdk.Stack(undefined, 'TestStack', { env: { account: '123456789012', region: 'us-east-1' } });
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ let stack: Stack;
beforeEach(() => {
app = new App();
new Stack(app, 'Stack', {
env: { account: '1234', region: 'testregion' },
env: { account: '123456789012', region: 'testregion' },
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let stack: Stack;
beforeEach(() => {
app = new App();
stack = new Stack(app, 'Stack', {
env: { account: '1234', region: 'testregion' },
env: { account: '123456789012', region: 'testregion' },
});
});

Expand Down
32 changes: 16 additions & 16 deletions packages/aws-cdk-lib/aws-cloudfront/test/distribution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let stack: Stack;
beforeEach(() => {
app = new App();
stack = new Stack(app, 'Stack', {
env: { account: '1234', region: 'testregion' },
env: { account: '123456789012', region: 'testregion' },
});
});

Expand Down Expand Up @@ -62,7 +62,7 @@ test('minimal example renders correctly', () => {

test('exhaustive example of props renders correctly and SSL method sni-only', () => {
const origin = defaultOrigin();
const certificate = acm.Certificate.fromCertificateArn(stack, 'Cert', 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012');
const certificate = acm.Certificate.fromCertificateArn(stack, 'Cert', 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-123456789012-123456789012-123456789012-123456789012');

new Distribution(stack, 'MyDist', {
defaultBehavior: { origin },
Expand Down Expand Up @@ -117,7 +117,7 @@ test('exhaustive example of props renders correctly and SSL method sni-only', ()
},
},
ViewerCertificate: {
AcmCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012',
AcmCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-123456789012-123456789012-123456789012-123456789012',
SslSupportMethod: 'sni-only',
MinimumProtocolVersion: 'TLSv1.2_2019',
},
Expand All @@ -128,7 +128,7 @@ test('exhaustive example of props renders correctly and SSL method sni-only', ()

test('exhaustive example of props renders correctly and SSL method vip', () => {
const origin = defaultOrigin();
const certificate = acm.Certificate.fromCertificateArn(stack, 'Cert', 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012');
const certificate = acm.Certificate.fromCertificateArn(stack, 'Cert', 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-123456789012-123456789012-123456789012-123456789012');

new Distribution(stack, 'MyDist', {
defaultBehavior: { origin },
Expand Down Expand Up @@ -183,7 +183,7 @@ test('exhaustive example of props renders correctly and SSL method vip', () => {
},
},
ViewerCertificate: {
AcmCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012',
AcmCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-123456789012-123456789012-123456789012-123456789012',
SslSupportMethod: 'vip',
MinimumProtocolVersion: 'TLSv1.2_2019',
},
Expand All @@ -194,7 +194,7 @@ test('exhaustive example of props renders correctly and SSL method vip', () => {

test('exhaustive example of props renders correctly and SSL method default', () => {
const origin = defaultOrigin();
const certificate = acm.Certificate.fromCertificateArn(stack, 'Cert', 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012');
const certificate = acm.Certificate.fromCertificateArn(stack, 'Cert', 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-123456789012-123456789012-123456789012-123456789012');

new Distribution(stack, 'MyDist', {
defaultBehavior: { origin },
Expand Down Expand Up @@ -248,7 +248,7 @@ test('exhaustive example of props renders correctly and SSL method default', ()
},
},
ViewerCertificate: {
AcmCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012',
AcmCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-123456789012-123456789012-123456789012-123456789012',
SslSupportMethod: 'sni-only',
MinimumProtocolVersion: 'TLSv1.2_2019',
},
Expand Down Expand Up @@ -447,7 +447,7 @@ describe('multiple behaviors', () => {
describe('certificates', () => {
test('should fail if using an imported certificate from outside of us-east-1', () => {
const origin = defaultOrigin();
const certificate = acm.Certificate.fromCertificateArn(stack, 'Cert', 'arn:aws:acm:eu-west-1:123456789012:certificate/12345678-1234-1234-1234-123456789012');
const certificate = acm.Certificate.fromCertificateArn(stack, 'Cert', 'arn:aws:acm:eu-west-1:123456789012:certificate/12345678-123456789012-123456789012-123456789012-123456789012');

expect(() => {
new Distribution(stack, 'Dist', {
Expand All @@ -458,7 +458,7 @@ describe('certificates', () => {
});

test('adding a certificate without a domain name', () => {
const certificate = acm.Certificate.fromCertificateArn(stack, 'Cert', 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012');
const certificate = acm.Certificate.fromCertificateArn(stack, 'Cert', 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-123456789012-123456789012-123456789012-123456789012');

new Distribution(stack, 'Dist1', {
defaultBehavior: { origin: defaultOrigin() },
Expand All @@ -469,14 +469,14 @@ describe('certificates', () => {
DistributionConfig: {
Aliases: Match.absent(),
ViewerCertificate: {
AcmCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012',
AcmCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-123456789012-123456789012-123456789012-123456789012',
},
},
});
});

test('use the TLSv1.2_2021 security policy by default', () => {
const certificate = acm.Certificate.fromCertificateArn(stack, 'Cert', 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012');
const certificate = acm.Certificate.fromCertificateArn(stack, 'Cert', 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-123456789012-123456789012-123456789012-123456789012');

new Distribution(stack, 'Dist', {
defaultBehavior: { origin: defaultOrigin() },
Expand All @@ -488,7 +488,7 @@ describe('certificates', () => {
DistributionConfig: {
Aliases: ['example.com', 'www.example.com'],
ViewerCertificate: {
AcmCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012',
AcmCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-123456789012-123456789012-123456789012-123456789012',
SslSupportMethod: 'sni-only',
MinimumProtocolVersion: 'TLSv1.2_2021',
},
Expand All @@ -497,7 +497,7 @@ describe('certificates', () => {
});

test('adding a certificate with non default security policy protocol', () => {
const certificate = acm.Certificate.fromCertificateArn(stack, 'Cert', 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012');
const certificate = acm.Certificate.fromCertificateArn(stack, 'Cert', 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-123456789012-123456789012-123456789012-123456789012');
new Distribution(stack, 'Dist', {
defaultBehavior: { origin: defaultOrigin() },
domainNames: ['www.example.com'],
Expand All @@ -509,7 +509,7 @@ describe('certificates', () => {
Template.fromStack(stack).hasResourceProperties('AWS::CloudFront::Distribution', {
DistributionConfig: {
ViewerCertificate: {
AcmCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012',
AcmCertificateArn: 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-123456789012-123456789012-123456789012-123456789012',
SslSupportMethod: 'sni-only',
MinimumProtocolVersion: 'TLSv1_2016',
},
Expand Down Expand Up @@ -1111,7 +1111,7 @@ test('grants custom actions', () => {
Resource: {
'Fn::Join': [
'', [
'arn:', { Ref: 'AWS::Partition' }, ':cloudfront::1234:distribution/',
'arn:', { Ref: 'AWS::Partition' }, ':cloudfront::123456789012:distribution/',
{ Ref: 'Distribution830FAC52' },
],
],
Expand Down Expand Up @@ -1139,7 +1139,7 @@ test('grants createInvalidation', () => {
Resource: {
'Fn::Join': [
'', [
'arn:', { Ref: 'AWS::Partition' }, ':cloudfront::1234:distribution/',
'arn:', { Ref: 'AWS::Partition' }, ':cloudfront::123456789012:distribution/',
{ Ref: 'Distribution830FAC52' },
],
],
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-cloudfront/test/endpoint.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('Endpoint', () => {
beforeEach(() => {
app = new App();
stack = new Stack(app, 'Stack', {
env: { account: '1234', region: 'testregion' },
env: { account: '123456789012', region: 'testregion' },
});
stream = new kinesis.Stream(stack, 'stream');
role = new iam.Role(stack, 'my-role', {
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-cloudfront/test/origin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let stack: Stack;
beforeEach(() => {
app = new App();
stack = new Stack(app, 'Stack', {
env: { account: '1234', region: 'testregion' },
env: { account: '123456789012', region: 'testregion' },
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ NQIDAQAB
beforeEach(() => {
app = new App();
stack = new Stack(app, 'Stack', {
env: { account: '1234', region: 'testregion' },
env: { account: '123456789012', region: 'testregion' },
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('RealtimeLogConfig', () => {
beforeEach(() => {
app = new App();
stack = new Stack(app, 'Stack', {
env: { account: '1234', region: 'testregion' },
env: { account: '123456789012', region: 'testregion' },
});
stream = new kinesis.Stream(stack, 'stream');
role = new iam.Role(stack, 'my-role', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let stack3: Stack;
let stack4: Stack;
describe('cross environment', () => {
beforeEach(() => {
stack1 = new Stack(undefined, undefined, { env: { region: 'pluto', account: '1234' } });
stack1 = new Stack(undefined, undefined, { env: { region: 'pluto', account: '123456789012' } });
stack2 = new Stack(undefined, undefined, { env: { region: 'mars', account: '5678' } });
stack3 = new Stack(undefined, undefined, { env: { region: 'pluto', account: '0000' } });
stack4 = new Stack(undefined, undefined);
Expand Down Expand Up @@ -42,7 +42,7 @@ describe('cross environment', () => {

// THEN
graphMetricsAre(stack2, graph, [
['Test', 'ACount', { region: 'pluto', accountId: '1234' }],
['Test', 'ACount', { region: 'pluto', accountId: '123456789012' }],
]);

});
Expand All @@ -51,13 +51,13 @@ describe('cross environment', () => {
// GIVEN
const graph = new GraphWidget({
left: [
a.with({ account: '1234', region: 'us-north-5' }),
a.with({ account: '123456789012', region: 'us-north-5' }),
],
});

// THEN
graphMetricsAre(new Stack(), graph, [
['Test', 'ACount', { accountId: '1234', region: 'us-north-5' }],
['Test', 'ACount', { accountId: '123456789012', region: 'us-north-5' }],
]);

});
Expand Down Expand Up @@ -300,7 +300,7 @@ describe('cross environment', () => {
const b = new Metric({
namespace: 'Test',
metricName: 'ACount',
account: '1234',
account: '123456789012',
});

const c = new MathExpression({
Expand Down Expand Up @@ -357,7 +357,7 @@ describe('cross environment', () => {
const b = new Metric({
namespace: 'Test',
metricName: 'ACount',
account: '1234',
account: '123456789012',
});

const c = new MathExpression({
Expand All @@ -382,7 +382,7 @@ describe('cross environment', () => {
const b = new Metric({
namespace: 'Test',
metricName: 'ACount',
account: '1234',
account: '123456789012',
});

const c = new MathExpression({
Expand Down
Loading
Loading