Skip to content

Commit eea223b

Browse files
authored
fix(ecs): deployment alarm configurations are being added in isolated 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*
1 parent 1b36124 commit eea223b

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

packages/aws-cdk-lib/aws-ecs/lib/base/base-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,7 @@ export abstract class BaseService extends Resource
13671367
}
13681368

13691369
private deploymentAlarmsAvailableInRegion(): boolean {
1370-
const unsupportedPartitions = ['aws-cn', 'aws-us-gov', 'aws-us-iso', 'aws-us-iso-b'];
1370+
const unsupportedPartitions = ['aws-cn', 'aws-us-gov', 'aws-iso', 'aws-iso-b'];
13711371
const currentRegion = RegionInfo.get(this.stack.resolve(this.stack.region));
13721372
if (currentRegion.partition) {
13731373
return !unsupportedPartitions.includes(currentRegion.partition);

packages/aws-cdk-lib/aws-ecs/test/ec2/ec2-service.test.ts

+26
Original file line numberDiff line numberDiff line change
@@ -2365,6 +2365,32 @@ describe('ec2 service', () => {
23652365
});
23662366
});
23672367

2368+
test('no deployment alarms in isolated partitions', () => {
2369+
const app = new cdk.App();
2370+
const govCloudStack = new cdk.Stack(app, 'IsoStack', {
2371+
env: { region: 'us-isob-east-1' },
2372+
});
2373+
const vpc = new ec2.Vpc(govCloudStack, 'MyVpc', {});
2374+
const gcCluster = new ecs.Cluster(govCloudStack, 'EcsCluster', { vpc });
2375+
addDefaultCapacityProvider(gcCluster, govCloudStack, vpc);
2376+
const gcTaskDefinition = new ecs.Ec2TaskDefinition(govCloudStack, 'Ec2TaskDef');
2377+
2378+
gcTaskDefinition.addContainer('web', {
2379+
image: ecs.ContainerImage.fromRegistry('amazon/amazon-ecs-sample'),
2380+
memoryLimitMiB: 512,
2381+
});
2382+
new ecs.Ec2Service(govCloudStack, 'Ec2Service', {
2383+
cluster: gcCluster,
2384+
taskDefinition: gcTaskDefinition,
2385+
});
2386+
2387+
Template.fromStack(govCloudStack).hasResourceProperties('AWS::ECS::Service', {
2388+
DeploymentConfiguration: {
2389+
Alarms: Match.absent(),
2390+
},
2391+
});
2392+
});
2393+
23682394
/**
23692395
* This section of tests test all combinations of the following possible
23702396
* alarm names and metrics. Most combinations work just fine, some

0 commit comments

Comments
 (0)