(ecs): Base Service tokenized Service Arn doesn't contain region or account. #18246
Labels
@aws-cdk/aws-ecs
Related to Amazon Elastic Container
bug
This issue is a bug.
effort/small
Small work item – less than a day of effort
p1
What is the problem?
The tokenized ARN](
aws-cdk/packages/@aws-cdk/aws-ecs/lib/base/base-service.ts
Lines 429 to 433 in ef8ab72
Ec2Service.fromEc2ServiceAttributes
orFargateService.fromFargateServiceAttributes
to determine the region and account when deploying across regions.Reproduction Steps
This generates the token for the serviceArn.
service.serviceArn
generates a token, if this is a different account or region the in the cause of using a code pipeline which is deploying across multiple accounts or regions leveragingEc2Service.fromEc2ServiceAttributes
with the service ARN would be used in the pipeline to get the service, as you directly pass the service across boundaries.This means to get the serviceArn after the service definition you need to do something like below to get the serviceArn to not be a full token. Also this is related to issue #16634.
What did you expect to happen?
I would expect the serviceArn look like this
arn:${Token[AWS.Partition.5]}:ecs:${Token[AWS.Region.6]}:${Token[AWS.AccountId.2]}:service/${Token[TOKEN.425]}/${Token[TOKEN.481]}
Which will allow the region, account as well as the clusterName and serviceName to be populated correctly when deploying the token in.
What actually happened?
The current serviceArn looks likes
${Token[TOKEN.489]}
which means using theserviceArn
forEc2Service.fromEc2ServiceAttributes
doesn't set the region or account correctly.CDK CLI Version
N/A
Framework Version
No response
Node.js Version
v16.13.1
OS
Mac
Language
Typescript
Language Version
No response
Other information
This issue is seen in CDK tests so not related to specific CDK version.
The text was updated successfully, but these errors were encountered: