aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.5k stars 3.84k forks source link

@aws-cdk/aws-batch-alpha: Compute Environment with service role `role/AWSServiceRoleForBatch` is created and cannot be deleted #20727

Open ikeyan opened 2 years ago

ikeyan commented 2 years ago

Describe the bug

I created a AWS Batch Compute Environment with service role Role.fromRoleName(this, 'BatchServiceRole', 'AWSServiceRoleForBatch'), and deployed it. The deploy and its rollback failed, and The compute environment cannot be deleted.

Expected Behavior

CloudFormation should:

Current Behavior

Reproduction Steps

        const vpc = new Vpc(this, 'Vpc', {
            cidr: '10.0.0.0/16',
            subnetConfiguration: [
                {
                    cidrMask: 24,
                    name: 'public',
                    subnetType: SubnetType.PUBLIC,
                },
                {
                    cidrMask: 24,
                    name: 'private',
                    subnetType: SubnetType.PRIVATE_ISOLATED,
                },
            ],
        });
        const serviceRole = Role.fromRoleName(this, 'BatchServiceRole', 'AWSServiceRoleForBatch');
        new ComputeEnvironment(this, 'ComputeEnvironment', {
            computeEnvironmentName: 'test-batch',
            computeResources: {
                type: ComputeResourceType.ON_DEMAND,
                allocationStrategy: AllocationStrategy.BEST_FIT_PROGRESSIVE,
                vpc,
                vpcSubnets: vpc.selectSubnets({ subnetType: SubnetType.PUBLIC }),
                securityGroups: [],
                instanceTypes: [new InstanceType(InstanceClass.M6I)],
            },
            serviceRole,
        });

deploy the above as a stack.

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.27.0 (build 8e89048)

Framework Version

2.27.0-alpha.0

Node.js Version

v16.13.1

OS

Windows 10 21H2

Language

Typescript

Language Version

TypeScript (4.7.3)

Other information

No response

mrgrain commented 2 years ago

Alpha module -> p2

Can confirm that the above code does reproduce the issue. However rollback also worked and deleted all Resources.

mrgrain commented 2 years ago

@ikeyan to remove the un-removable ComputeEnvironment please open a ticket with the support team.

rjuengling-hf commented 1 year ago

Where may I track progress on this issue?

comcalvi commented 1 year ago

I've reproduced this, but the CE fails to delete for me. This is a CFN issue