Skip to content

Commit

Permalink
fix(ecs): imported services don't have account & region set correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkRobbo committed Oct 15, 2021
1 parent fbb49fe commit 1ac3146
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
Expand Up @@ -54,5 +54,7 @@ export function fromServiceAtrributes(scope: Construct, id: string, attrs: Servi
public readonly serviceName = name;
public readonly cluster = attrs.cluster;
}
return new Import(scope, id);
return new Import(scope, id, {
environmentFromArn: arn,
});
}
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-ecs/test/ec2/ec2-service.test.ts
Expand Up @@ -3292,6 +3292,8 @@ describe('ec2 service', () => {
expect(service.serviceArn).toEqual('arn:aws:ecs:us-west-2:123456789012:service/my-http-service');
expect(service.serviceName).toEqual('my-http-service');

expect(service.env.account).toEqual('123456789012');
expect(service.env.region).toEqual('us-west-2');

});

Expand Down
Expand Up @@ -2124,6 +2124,8 @@ describe('fargate service', () => {
expect(service.serviceArn).toEqual('arn:aws:ecs:us-west-2:123456789012:service/my-http-service');
expect(service.serviceName).toEqual('my-http-service');

expect(service.env.account).toEqual('123456789012');
expect(service.env.region).toEqual('us-west-2');

});

Expand Down

0 comments on commit 1ac3146

Please sign in to comment.