-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): crossRegionReferences doesn't work when exporting to multi…
…ple regions (#25190) The cross region export writer was only being given permissions to the first region it would export to. Fixing this by adding each consuming region to the IAM policy. fixes #24464 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
22 changed files
with
2,387 additions
and
1,111 deletions.
There are no files selected for viewing
147 changes: 147 additions & 0 deletions
147
.../asset.27f8287125ebe89b1cb7f97768a61c84b3f3221450e0a22c152addc630ab2430/__entrypoint__.js
Large diffs are not rendered by default.
Oops, something went wrong.
152 changes: 152 additions & 0 deletions
152
....snapshot/asset.27f8287125ebe89b1cb7f97768a61c84b3f3221450e0a22c152addc630ab2430/index.js
Large diffs are not rendered by default.
Oops, something went wrong.
1,295 changes: 1,295 additions & 0 deletions
1,295
...ot/asset.ae370e1010629b78f494346f49ceef3ab2875718f20e6c808114e6aa770c7bf3.bundle/index.js
Large diffs are not rendered by default.
Oops, something went wrong.
768 changes: 0 additions & 768 deletions
768
...ot/asset.b54b99043c35bd080b9d9d1afce31e3541cf15b679799ba980ed40c837dcb03b.bundle/index.js
This file was deleted.
Oops, something went wrong.
144 changes: 0 additions & 144 deletions
144
.../asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/__entrypoint__.js
This file was deleted.
Oops, something went wrong.
148 changes: 0 additions & 148 deletions
148
....snapshot/asset.f86f86755c3b2013542fc4f9405bfe145a86c0bec508dd0b37baabe2055d33f3/index.js
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...integ/test/aws-cloudformation/test/integ.core-cross-region-references.js.snapshot/cdk.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"version":"21.0.0"} | ||
{"version":"31.0.0"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...on/test/integ.core-cross-region-references.js.snapshot/cross-region-consumer2.assets.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"version": "31.0.0", | ||
"files": { | ||
"4b6a500a9b63c31028b69751201d80225328cfb9df5c4a6abaac18e7d4c48a8c": { | ||
"source": { | ||
"path": "asset.4b6a500a9b63c31028b69751201d80225328cfb9df5c4a6abaac18e7d4c48a8c", | ||
"packaging": "zip" | ||
}, | ||
"destinations": { | ||
"current_account-us-west-2": { | ||
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-us-west-2", | ||
"objectKey": "4b6a500a9b63c31028b69751201d80225328cfb9df5c4a6abaac18e7d4c48a8c.zip", | ||
"region": "us-west-2", | ||
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-us-west-2" | ||
} | ||
} | ||
}, | ||
"84d9dca339aba67f809c2fc9e42e0446ec4e7ed0bce437a58a7e4edabf6bdd02": { | ||
"source": { | ||
"path": "crossregionconsumer2IntegNested80DBA5D8.nested.template.json", | ||
"packaging": "file" | ||
}, | ||
"destinations": { | ||
"current_account-us-west-2": { | ||
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-us-west-2", | ||
"objectKey": "84d9dca339aba67f809c2fc9e42e0446ec4e7ed0bce437a58a7e4edabf6bdd02.json", | ||
"region": "us-west-2", | ||
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-us-west-2" | ||
} | ||
} | ||
}, | ||
"7314b777fac2e8baea2214fe1ce9c17ad4b1ef6ce74c41da04349ea1c754d8f3": { | ||
"source": { | ||
"path": "cross-region-consumer2.template.json", | ||
"packaging": "file" | ||
}, | ||
"destinations": { | ||
"current_account-us-west-2": { | ||
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-us-west-2", | ||
"objectKey": "7314b777fac2e8baea2214fe1ce9c17ad4b1ef6ce74c41da04349ea1c754d8f3.json", | ||
"region": "us-west-2", | ||
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-us-west-2" | ||
} | ||
} | ||
} | ||
}, | ||
"dockerImages": {} | ||
} |
198 changes: 198 additions & 0 deletions
198
.../test/integ.core-cross-region-references.js.snapshot/cross-region-consumer2.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,198 @@ | ||
{ | ||
"Resources": { | ||
"IntegNestedNestedStackIntegNestedNestedStackResource168C5881": { | ||
"Type": "AWS::CloudFormation::Stack", | ||
"Properties": { | ||
"TemplateURL": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"https://s3.us-west-2.", | ||
{ | ||
"Ref": "AWS::URLSuffix" | ||
}, | ||
"/", | ||
{ | ||
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-us-west-2" | ||
}, | ||
"/84d9dca339aba67f809c2fc9e42e0446ec4e7ed0bce437a58a7e4edabf6bdd02.json" | ||
] | ||
] | ||
}, | ||
"Parameters": { | ||
"referencetocrossregionconsumer2ExportsReader29C6F905cdkexportscrossregionconsumer2crossregionproduceruseast1FnGetAttIntegQueue3A18718AQueueName8D8D3C9B": { | ||
"Fn::GetAtt": [ | ||
"ExportsReader8B249524", | ||
"/cdk/exports/cross-region-consumer2/crossregionproduceruseast1FnGetAttIntegQueue3A18718AQueueName8D8D3C9B" | ||
] | ||
}, | ||
"referencetocrossregionconsumer2ExportsReader29C6F905cdkexportscrossregionconsumer2crossregionproduceruseast1FnGetAttIntegNestedNestedStackIntegNestedNestedStackResource168C5881OutputscrossregionproducerIntegNestedNestedIntegQueueD686DB69QueueNameC1C9C99E": { | ||
"Fn::GetAtt": [ | ||
"ExportsReader8B249524", | ||
"/cdk/exports/cross-region-consumer2/crossregionproduceruseast1FnGetAttIntegNestedNestedStackIntegNestedNestedStackResource168C5881OutputscrossregionproducerIntegNestedNestedIntegQueueD686DB69QueueNameC1C9C99E" | ||
] | ||
} | ||
} | ||
}, | ||
"UpdateReplacePolicy": "Delete", | ||
"DeletionPolicy": "Delete" | ||
}, | ||
"IntegParameter02A1817A4": { | ||
"Type": "AWS::SSM::Parameter", | ||
"Properties": { | ||
"Type": "String", | ||
"Value": { | ||
"Fn::GetAtt": [ | ||
"ExportsReader8B249524", | ||
"/cdk/exports/cross-region-consumer2/crossregionproduceruseast1FnGetAttIntegQueue3A18718AQueueName8D8D3C9B" | ||
] | ||
}, | ||
"Name": "integ-parameter0" | ||
} | ||
}, | ||
"IntegParameter1EDBEF1C6": { | ||
"Type": "AWS::SSM::Parameter", | ||
"Properties": { | ||
"Type": "String", | ||
"Value": { | ||
"Fn::GetAtt": [ | ||
"ExportsReader8B249524", | ||
"/cdk/exports/cross-region-consumer2/crossregionproduceruseast1FnGetAttIntegNestedNestedStackIntegNestedNestedStackResource168C5881OutputscrossregionproducerIntegNestedNestedIntegQueueD686DB69QueueNameC1C9C99E" | ||
] | ||
}, | ||
"Name": "integ-parameter1" | ||
} | ||
}, | ||
"ExportsReader8B249524": { | ||
"Type": "Custom::CrossRegionExportReader", | ||
"Properties": { | ||
"ServiceToken": { | ||
"Fn::GetAtt": [ | ||
"CustomCrossRegionExportReaderCustomResourceProviderHandler46647B68", | ||
"Arn" | ||
] | ||
}, | ||
"ReaderProps": { | ||
"region": "us-west-2", | ||
"prefix": "cross-region-consumer2", | ||
"imports": { | ||
"/cdk/exports/cross-region-consumer2/crossregionproduceruseast1FnGetAttIntegQueue3A18718AQueueName8D8D3C9B": "{{resolve:ssm:/cdk/exports/cross-region-consumer2/crossregionproduceruseast1FnGetAttIntegQueue3A18718AQueueName8D8D3C9B}}", | ||
"/cdk/exports/cross-region-consumer2/crossregionproduceruseast1FnGetAttIntegNestedNestedStackIntegNestedNestedStackResource168C5881OutputscrossregionproducerIntegNestedNestedIntegQueueD686DB69QueueNameC1C9C99E": "{{resolve:ssm:/cdk/exports/cross-region-consumer2/crossregionproduceruseast1FnGetAttIntegNestedNestedStackIntegNestedNestedStackResource168C5881OutputscrossregionproducerIntegNestedNestedIntegQueueD686DB69QueueNameC1C9C99E}}" | ||
} | ||
} | ||
}, | ||
"UpdateReplacePolicy": "Delete", | ||
"DeletionPolicy": "Delete" | ||
}, | ||
"CustomCrossRegionExportReaderCustomResourceProviderRole10531BBD": { | ||
"Type": "AWS::IAM::Role", | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Action": "sts:AssumeRole", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "lambda.amazonaws.com" | ||
} | ||
} | ||
] | ||
}, | ||
"ManagedPolicyArns": [ | ||
{ | ||
"Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" | ||
} | ||
], | ||
"Policies": [ | ||
{ | ||
"PolicyName": "Inline", | ||
"PolicyDocument": { | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Resource": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"arn:aws:ssm:us-west-2:", | ||
{ | ||
"Ref": "AWS::AccountId" | ||
}, | ||
":parameter/cdk/exports/cross-region-consumer2/*" | ||
] | ||
] | ||
}, | ||
"Action": [ | ||
"ssm:AddTagsToResource", | ||
"ssm:RemoveTagsFromResource", | ||
"ssm:GetParameters" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
"CustomCrossRegionExportReaderCustomResourceProviderHandler46647B68": { | ||
"Type": "AWS::Lambda::Function", | ||
"Properties": { | ||
"Code": { | ||
"S3Bucket": { | ||
"Fn::Sub": "cdk-hnb659fds-assets-${AWS::AccountId}-us-west-2" | ||
}, | ||
"S3Key": "4b6a500a9b63c31028b69751201d80225328cfb9df5c4a6abaac18e7d4c48a8c.zip" | ||
}, | ||
"Timeout": 900, | ||
"MemorySize": 128, | ||
"Handler": "__entrypoint__.handler", | ||
"Role": { | ||
"Fn::GetAtt": [ | ||
"CustomCrossRegionExportReaderCustomResourceProviderRole10531BBD", | ||
"Arn" | ||
] | ||
}, | ||
"Runtime": "nodejs14.x" | ||
}, | ||
"DependsOn": [ | ||
"CustomCrossRegionExportReaderCustomResourceProviderRole10531BBD" | ||
] | ||
} | ||
}, | ||
"Parameters": { | ||
"BootstrapVersion": { | ||
"Type": "AWS::SSM::Parameter::Value<String>", | ||
"Default": "/cdk-bootstrap/hnb659fds/version", | ||
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" | ||
} | ||
}, | ||
"Rules": { | ||
"CheckBootstrapVersion": { | ||
"Assertions": [ | ||
{ | ||
"Assert": { | ||
"Fn::Not": [ | ||
{ | ||
"Fn::Contains": [ | ||
[ | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5" | ||
], | ||
{ | ||
"Ref": "BootstrapVersion" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.