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(ecs): deployment alarm configurations are being added in isolated partitions #26458

Merged
merged 8 commits into from
Jul 21, 2023
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
Loading