@@ -4,7 +4,7 @@ import ec2 = require('@aws-cdk/aws-ec2');
4
4
import elbv2 = require( '@aws-cdk/aws-elasticloadbalancingv2' ) ;
5
5
import iam = require( '@aws-cdk/aws-iam' ) ;
6
6
import cloudmap = require( '@aws-cdk/aws-servicediscovery' ) ;
7
- import { Construct , Duration , Fn , IResolvable , IResource , Lazy , Resource , Stack } from '@aws-cdk/core' ;
7
+ import { Construct , Duration , IResolvable , IResource , Lazy , Resource , Stack } from '@aws-cdk/core' ;
8
8
import { NetworkMode , TaskDefinition } from '../base/task-definition' ;
9
9
import { ICluster } from '../cluster' ;
10
10
import { CfnService } from '../ecs.generated' ;
@@ -73,21 +73,6 @@ export interface BaseServiceProps {
73
73
* @default - AWS Cloud Map service discovery is not enabled.
74
74
*/
75
75
readonly cloudMapOptions ?: CloudMapOptions ;
76
-
77
- /**
78
- * Whether the new long ARN format has been enabled on ECS services.
79
- * NOTE: This assumes customer has opted into the new format for the IAM role used for the service, and is a
80
- * workaround for a current bug in Cloudformation in which the service name is not correctly returned when long ARN is
81
- * enabled.
82
- *
83
- * Old ARN format: arn:aws:ecs:region:aws_account_id:service/service-name
84
- * New ARN format: arn:aws:ecs:region:aws_account_id:service/cluster-name/service-name
85
- *
86
- * See: https://docs.aws.amazon.com/AmazonECS/latest/userguide/ecs-resource-ids.html
87
- *
88
- * @default false
89
- */
90
- readonly longArnEnabled ?: boolean ;
91
76
}
92
77
93
78
/**
@@ -157,19 +142,12 @@ export abstract class BaseService extends Resource
157
142
...additionalProps
158
143
} ) ;
159
144
160
- // This is a workaround for CFN bug that returns the cluster name instead of the service name when long ARN formats
161
- // are enabled for the principal in a given region.
162
- const longArnEnabled = props . longArnEnabled !== undefined ? props . longArnEnabled : false ;
163
- const serviceName = longArnEnabled
164
- ? Fn . select ( 2 , Fn . split ( '/' , this . resource . ref ) )
165
- : this . resource . attrName ;
166
-
167
145
this . serviceArn = this . getResourceArnAttribute ( this . resource . ref , {
168
146
service : 'ecs' ,
169
147
resource : 'service' ,
170
148
resourceName : `${ props . cluster . clusterName } /${ this . physicalName } ` ,
171
149
} ) ;
172
- this . serviceName = this . getResourceNameAttribute ( serviceName ) ;
150
+ this . serviceName = this . getResourceNameAttribute ( this . resource . attrName ) ;
173
151
174
152
this . cluster = props . cluster ;
175
153
0 commit comments