@@ -13,11 +13,6 @@ export interface IEcsService {
1313 readonly serviceName : string ;
1414}
1515
16- export enum PropagateTags {
17- SERVICE = 'SERVICE' ,
18- TASK_DEFINITION = 'TASK_DEFINITION' ,
19- }
20-
2116export interface EcsServiceProps {
2217 readonly securityGroups ?: SecurityGroup [ ] ;
2318 readonly cluster : ICluster ;
@@ -79,8 +74,6 @@ export class EcsService extends Construct implements IConnectable, IEcsService,
7974 constructor ( scope : Construct , id : string , props : EcsServiceProps ) {
8075 super ( scope , id ) ;
8176
82- this . tags = new TagManager ( TagType . KEY_VALUE , 'TagManager' ) ;
83-
8477 const {
8578 cluster,
8679 serviceName,
@@ -93,6 +86,8 @@ export class EcsService extends Construct implements IConnectable, IEcsService,
9386 healthCheckGracePeriod = Duration . seconds ( 60 ) ,
9487 } = props ;
9588
89+ this . tags = new TagManager ( TagType . KEY_VALUE , 'TagManager' ) ;
90+
9691 const containerPort = props . containerPort ?? taskDefinition . containerPort ;
9792
9893 const { vpc } = cluster ;
@@ -153,6 +148,7 @@ export class EcsService extends Construct implements IConnectable, IEcsService,
153148 ContainerPort : containerPort ,
154149 SchedulingStrategy : SchedulingStrategy . REPLICA ,
155150 HealthCheckGracePeriodSeconds : healthCheckGracePeriod . toSeconds ( ) ,
151+ PropagateTags : props . propagateTags ,
156152 DeploymentConfiguration : {
157153 maximumPercent : props . maxHealthyPercent ?? 200 ,
158154 minimumHealthyPercent : props . minHealthyPercent ?? 50 ,
@@ -163,7 +159,6 @@ export class EcsService extends Construct implements IConnectable, IEcsService,
163159 }
164160 : undefined ,
165161 } ,
166- PropagateTags : props . propagateTags ,
167162 Tags : Lazy . any ( { produce : ( ) => this . tags . renderTags ( ) } ) ,
168163 } ,
169164 } ) ;
@@ -184,3 +179,8 @@ export enum SchedulingStrategy {
184179 REPLICA = 'REPLICA' ,
185180 DAEMON = 'DAEMON' ,
186181}
182+
183+ export enum PropagateTags {
184+ TASK_DEFINITION = 'TASK_DEFINITION' ,
185+ SERVICE = 'SERVICE' ,
186+ }
0 commit comments