Skip to content

Commit

Permalink
fix(ecs): deployment alarm configurations are being added in isolated…
Browse files Browse the repository at this point in the history
… partitions (#26458)

Fixes #26456. 

Renames the isolated partitions to their correct names. 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
bvtujo committed Jul 21, 2023
1 parent 1b36124 commit eea223b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-ecs/lib/base/base-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1367,7 +1367,7 @@ export abstract class BaseService extends Resource
}

private deploymentAlarmsAvailableInRegion(): boolean {
const unsupportedPartitions = ['aws-cn', 'aws-us-gov', 'aws-us-iso', 'aws-us-iso-b'];
const unsupportedPartitions = ['aws-cn', 'aws-us-gov', 'aws-iso', 'aws-iso-b'];
const currentRegion = RegionInfo.get(this.stack.resolve(this.stack.region));
if (currentRegion.partition) {
return !unsupportedPartitions.includes(currentRegion.partition);
Expand Down
26 changes: 26 additions & 0 deletions packages/aws-cdk-lib/aws-ecs/test/ec2/ec2-service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2365,6 +2365,32 @@ describe('ec2 service', () => {
});
});

test('no deployment alarms in isolated partitions', () => {
const app = new cdk.App();
const govCloudStack = new cdk.Stack(app, 'IsoStack', {
env: { region: 'us-isob-east-1' },
});
const vpc = new ec2.Vpc(govCloudStack, 'MyVpc', {});
const gcCluster = new ecs.Cluster(govCloudStack, 'EcsCluster', { vpc });
addDefaultCapacityProvider(gcCluster, govCloudStack, vpc);
const gcTaskDefinition = new ecs.Ec2TaskDefinition(govCloudStack, 'Ec2TaskDef');

gcTaskDefinition.addContainer('web', {
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
memoryLimitMiB: 512,
});
new ecs.Ec2Service(govCloudStack, 'Ec2Service', {
cluster: gcCluster,
taskDefinition: gcTaskDefinition,
});

Template.fromStack(govCloudStack).hasResourceProperties('AWS::ECS::Service', {
DeploymentConfiguration: {
Alarms: Match.absent(),
},
});
});

/**
* This section of tests test all combinations of the following possible
* alarm names and metrics. Most combinations work just fine, some
Expand Down

0 comments on commit eea223b

Please sign in to comment.