Skip to content

Commit 14b0aea

Browse files
author
Radek Smogura
committed
fix(aws-batch): computeResourcesTags use tag map
Use key-value map of tags for `ComputeResources.computeResourcesTags`. Previously used type `Tag` disallowed adding multiple tags. **Fixes aws#7350** BREAKING CHANGE: Changed type of `ComputeResources.computeResourcesTags` from `Tag` to map (details in fixed issue).
1 parent a1b5bf6 commit 14b0aea

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

packages/@aws-cdk/aws-batch/lib/compute-environment.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as ec2 from '@aws-cdk/aws-ec2';
22
import * as iam from '@aws-cdk/aws-iam';
3-
import { Construct, IResource, Resource, Stack, Tag } from '@aws-cdk/core';
3+
import { Construct, IResource, Resource, Stack } from '@aws-cdk/core';
44
import { CfnComputeEnvironment } from './batch.generated';
55

66
/**
@@ -210,7 +210,9 @@ export interface ComputeResources {
210210
*
211211
* @default - no tags will be assigned on compute resources.
212212
*/
213-
readonly computeResourcesTags?: Tag;
213+
readonly computeResourcesTags?: {
214+
[key: string]: string
215+
};
214216
}
215217

216218
/**

packages/@aws-cdk/aws-batch/test/compute-environment.test.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ describe('Batch Compute Evironment', () => {
161161
computeResources: {
162162
allocationStrategy: batch.AllocationStrategy.BEST_FIT,
163163
vpc,
164-
computeResourcesTags: new cdk.Tag('foo', 'bar'),
164+
computeResourcesTags: {
165+
'Name': 'AWS Batch Instance - C4OnDemand',
166+
'Tag Other': 'Has other value',
167+
},
165168
desiredvCpus: 1,
166169
ec2KeyPair: 'my-key-pair',
167170
image: new ecs.EcsOptimizedAmi({
@@ -244,10 +247,8 @@ describe('Batch Compute Evironment', () => {
244247
},
245248
],
246249
Tags: {
247-
key: 'foo',
248-
props: {},
249-
defaultPriority: 100,
250-
value: 'bar',
250+
'Name': 'AWS Batch Instance - C4OnDemand',
251+
'Tag Other': 'Has other value',
251252
},
252253
Type: 'EC2',
253254
},

packages/@aws-cdk/aws-batch/test/integ.batch.expected.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -859,6 +859,9 @@
859859
"Ref": "vpcPrivateSubnet3Subnet985AC459"
860860
}
861861
],
862+
"Tags": {
863+
"compute-env-tag": "123XYZ"
864+
},
862865
"Type": "EC2"
863866
},
864867
"State": "ENABLED"
@@ -1351,4 +1354,4 @@
13511354
}
13521355
}
13531356
}
1354-
}
1357+
}

packages/@aws-cdk/aws-batch/test/integ.batch.ts

+3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ new batch.JobQueue(stack, 'batch-job-queue', {
4343
launchTemplate: {
4444
launchTemplateName: launchTemplate.launchTemplateName as string,
4545
},
46+
computeResourcesTags: {
47+
'compute-env-tag': '123XYZ',
48+
},
4649
},
4750
}),
4851
order: 2,

0 commit comments

Comments
 (0)