Skip to content

Commit

Permalink
refactor(region-info): AppMesh ECR accounts for cn-north-1 and cn-nor…
Browse files Browse the repository at this point in the history
…thwest-1 (#16836)

----
AppMesh is launched in 'cn-noth-1' and 'cn-northwest-1' regions.
These regions have separate accounts for storing Envoy images in ECR. Added the ECR account information.
These regions belong to new partition 'aws-cn', removed the harcoded 'aws' partition and modified it to work for all partitions.
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
shsahu committed Oct 20, 2021
1 parent 13def19 commit 583813c
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitallowed
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ account: '856666278305'
account: '840364872350'
account: '422531588944'
account: '924023996002'
account: '919366029133' #cn-north-1
account: '919830735681' #cn-northwest-1

# The account IDs of password rotation applications of Serverless Application Repository
# https://docs.aws.amazon.com/secretsmanager/latest/userguide/enable-rotation-rds.html
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export class AppMeshExtension extends ServiceExtension {

public useTaskDefinition(taskDefinition: ecs.TaskDefinition) {
var region = cdk.Stack.of(this.scope).region;
var partition = cdk.Stack.of(this.scope).partition;
var appMeshRepo;

// This is currently necessary because App Mesh has different images in each region,
Expand All @@ -151,6 +152,8 @@ export class AppMeshExtension extends ServiceExtension {
'ap-southeast-1': this.accountIdForRegion('ap-southeast-1'),
'ap-southeast-2': this.accountIdForRegion('ap-southeast-1'),
'ca-central-1': this.accountIdForRegion('ca-central-1'),
'cn-north-1': this.accountIdForRegion('cn-north-1'),
'cn-northwest-1': this.accountIdForRegion('cn-northwest-1'),
'eu-central-1': this.accountIdForRegion('eu-central-1'),
'eu-north-1': this.accountIdForRegion('eu-north-1'),
'eu-south-1': this.accountIdForRegion('eu-south-1'),
Expand All @@ -177,7 +180,7 @@ export class AppMeshExtension extends ServiceExtension {
`${this.parentService.id}-envoy-repo`,
{
repositoryName: 'aws-appmesh-envoy',
repositoryArn: `arn:aws:ecr:${region}:${ownerAccount}:repository/aws-appmesh-envoy`,
repositoryArn: `arn:${partition}:ecr:${region}:${ownerAccount}:repository/aws-appmesh-envoy`,
},
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,11 @@
"Fn::Join": [
"",
[
"arn:aws:ecr:",
"arn:",
{
"Ref": "AWS::Partition"
},
":ecr:",
{
"Ref": "AWS::Region"
},
Expand Down Expand Up @@ -1818,7 +1822,11 @@
"Fn::Join": [
"",
[
"arn:aws:ecr:",
"arn:",
{
"Ref": "AWS::Partition"
},
":ecr:",
{
"Ref": "AWS::Region"
},
Expand Down Expand Up @@ -2806,7 +2814,11 @@
"Fn::Join": [
"",
[
"arn:aws:ecr:",
"arn:",
{
"Ref": "AWS::Partition"
},
":ecr:",
{
"Ref": "AWS::Region"
},
Expand Down Expand Up @@ -3316,6 +3328,12 @@
"ca-central-1": {
"ecrRepo": "840364872350"
},
"cn-north-1": {
"ecrRepo": "919366029133"
},
"cn-northwest-1": {
"ecrRepo": "919830735681"
},
"eu-central-1": {
"ecrRepo": "840364872350"
},
Expand Down Expand Up @@ -3378,6 +3396,12 @@
"ca-central-1": {
"ecrRepo": "840364872350"
},
"cn-north-1": {
"ecrRepo": "919366029133"
},
"cn-northwest-1": {
"ecrRepo": "919830735681"
},
"eu-central-1": {
"ecrRepo": "840364872350"
},
Expand Down Expand Up @@ -3440,6 +3464,12 @@
"ca-central-1": {
"ecrRepo": "840364872350"
},
"cn-north-1": {
"ecrRepo": "919366029133"
},
"cn-northwest-1": {
"ecrRepo": "919830735681"
},
"eu-central-1": {
"ecrRepo": "840364872350"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1304,7 +1304,11 @@
"Fn::Join": [
"",
[
"arn:aws:ecr:",
"arn:",
{
"Ref": "AWS::Partition"
},
":ecr:",
{
"Ref": "AWS::Region"
},
Expand Down Expand Up @@ -1828,7 +1832,11 @@
"Fn::Join": [
"",
[
"arn:aws:ecr:",
"arn:",
{
"Ref": "AWS::Partition"
},
":ecr:",
{
"Ref": "AWS::Region"
},
Expand Down Expand Up @@ -2135,6 +2143,12 @@
"ca-central-1": {
"ecrRepo": "840364872350"
},
"cn-north-1": {
"ecrRepo": "919366029133"
},
"cn-northwest-1": {
"ecrRepo": "919830735681"
},
"eu-central-1": {
"ecrRepo": "840364872350"
},
Expand Down Expand Up @@ -2197,6 +2211,12 @@
"ca-central-1": {
"ecrRepo": "840364872350"
},
"cn-north-1": {
"ecrRepo": "919366029133"
},
"cn-northwest-1": {
"ecrRepo": "919830735681"
},
"eu-central-1": {
"ecrRepo": "840364872350"
},
Expand Down

0 comments on commit 583813c

Please sign in to comment.