diff --git a/src/account-provider/is-complete-handler.lambda.ts b/src/account-provider/is-complete-handler.lambda.ts index a6ec3fd1..a1f94456 100644 --- a/src/account-provider/is-complete-handler.lambda.ts +++ b/src/account-provider/is-complete-handler.lambda.ts @@ -6,6 +6,7 @@ import * as AWS from "aws-sdk"; import { Organizations } from "aws-sdk"; let organizationsClient: AWS.Organizations; +const organizationsRegion = process.env.ORGANIZATIONS_ENDPOINT_REGION ?? "us-east-1"; /** * The isComplete handler is repeatedly invoked checking CreateAccountStatus until SUCCEEDED or FAILED. @@ -15,7 +16,7 @@ export async function handler(event: IsCompleteRequest): Promise { console.log(`Request of type ${event.RequestType} received`); if (!organizationsClient) { - organizationsClient = new Organizations({ region: "us-east-1" }); + organizationsClient = new Organizations({ region: organizationsRegion }); } console.log("Payload: %j", event); diff --git a/src/organization-provider/on-event-handler.lambda.ts b/src/organization-provider/on-event-handler.lambda.ts index 9b82d468..d3c67d4d 100644 --- a/src/organization-provider/on-event-handler.lambda.ts +++ b/src/organization-provider/on-event-handler.lambda.ts @@ -2,6 +2,7 @@ import { CdkCustomResourceEvent as OnEventRequest, CdkCustomResourceResponse as import { AWSError, Organizations } from "aws-sdk"; let organizationsClient: Organizations; +const organizationsRegion = process.env.ORGANIZATIONS_ENDPOINT_REGION ?? "us-east-1"; /** * The onEvent handler is invoked whenever a resource lifecycle event for an organization occurs @@ -12,7 +13,7 @@ export async function handler(event: OnEventRequest): Promise { console.log(`Request of type ${event.RequestType} received`); if (!organizationsClient) { - organizationsClient = new Organizations({ region: "us-east-1" }); + organizationsClient = new Organizations({ region: organizationsRegion }); } console.log("Payload: %j", event); diff --git a/src/organizational-unit-provider/on-event-handler.lambda.ts b/src/organizational-unit-provider/on-event-handler.lambda.ts index d58ed137..46398fd1 100644 --- a/src/organizational-unit-provider/on-event-handler.lambda.ts +++ b/src/organizational-unit-provider/on-event-handler.lambda.ts @@ -2,6 +2,7 @@ import { CdkCustomResourceEvent as OnEventRequest, CdkCustomResourceResponse as import { AWSError, Organizations } from "aws-sdk"; let organizationsClient: Organizations; +const organizationsRegion = process.env.ORGANIZATIONS_ENDPOINT_REGION ?? "us-east-1"; /** * The onEvent handler is invoked whenever a resource lifecycle event for an organizational unit occurs @@ -12,7 +13,7 @@ export const handler = async (event: OnEventRequest): Promise = console.log(`Request of type ${event.RequestType} received`); if (!organizationsClient) { - organizationsClient = new Organizations({ region: "us-east-1" }); + organizationsClient = new Organizations({ region: organizationsRegion }); } console.log("Payload: %j", event); diff --git a/src/tag-resource-provider/on-event-handler.lambda.ts b/src/tag-resource-provider/on-event-handler.lambda.ts index 49a48b4a..727bf91d 100644 --- a/src/tag-resource-provider/on-event-handler.lambda.ts +++ b/src/tag-resource-provider/on-event-handler.lambda.ts @@ -2,6 +2,7 @@ import { CdkCustomResourceEvent as OnEventRequest, CdkCustomResourceResponse as import { Organizations } from "aws-sdk"; let organizationsClient: Organizations; +const organizationsRegion = process.env.ORGANIZATIONS_ENDPOINT_REGION ?? "us-east-1"; /** * The onEvent handler is invoked whenever a resource lifecycle event for a TagResource occurs @@ -12,7 +13,7 @@ export async function handler(event: OnEventRequest): Promise { console.log(`Request of type ${event.RequestType} received`); if (!organizationsClient) { - organizationsClient = new Organizations({ region: "us-east-1" }); + organizationsClient = new Organizations({ region: organizationsRegion }); } console.log("Payload: %j", event); diff --git a/test/__snapshots__/account.test.ts.snap b/test/__snapshots__/account.test.ts.snap index 1d425b9b..e417678e 100644 --- a/test/__snapshots__/account.test.ts.snap +++ b/test/__snapshots__/account.test.ts.snap @@ -203,7 +203,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/0414e993a8284a9c16b9356010ed65eb3d31e649edca57eca96e5246806466fe.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/0cc90bb0fc3b992e0224b6b81177a8826e7a465c95ce9681f403296f5b49e507.json", ], ], }, @@ -222,7 +222,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/14c7d41da181ad055e65f5e49dd615bca9e6070b5161de8bc8bc12358782688d.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/081779f83ae90f16185e8186b37859f4be0b92d2906da5bd684c925f95793777.json", ], ], }, @@ -241,7 +241,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/f346d8c676d92a107f908b9aec4db5be56505a96a53c27a324b2f037d893e037.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/07259dc16b8630a4a30fea02c8e09f9f8c2af2a17ba3e9fe0e44879a45085209.json", ], ], }, diff --git a/test/__snapshots__/delegated-administrator.test.ts.snap b/test/__snapshots__/delegated-administrator.test.ts.snap index 09337f16..7a029ee4 100644 --- a/test/__snapshots__/delegated-administrator.test.ts.snap +++ b/test/__snapshots__/delegated-administrator.test.ts.snap @@ -194,7 +194,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/0414e993a8284a9c16b9356010ed65eb3d31e649edca57eca96e5246806466fe.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/0cc90bb0fc3b992e0224b6b81177a8826e7a465c95ce9681f403296f5b49e507.json", ], ], }, @@ -213,7 +213,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/f346d8c676d92a107f908b9aec4db5be56505a96a53c27a324b2f037d893e037.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/07259dc16b8630a4a30fea02c8e09f9f8c2af2a17ba3e9fe0e44879a45085209.json", ], ], }, diff --git a/test/__snapshots__/dependency-chain.test.ts.snap b/test/__snapshots__/dependency-chain.test.ts.snap index 7aa0ecc1..3d792b0a 100644 --- a/test/__snapshots__/dependency-chain.test.ts.snap +++ b/test/__snapshots__/dependency-chain.test.ts.snap @@ -391,7 +391,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/0414e993a8284a9c16b9356010ed65eb3d31e649edca57eca96e5246806466fe.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/0cc90bb0fc3b992e0224b6b81177a8826e7a465c95ce9681f403296f5b49e507.json", ], ], }, @@ -410,7 +410,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/14c7d41da181ad055e65f5e49dd615bca9e6070b5161de8bc8bc12358782688d.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/081779f83ae90f16185e8186b37859f4be0b92d2906da5bd684c925f95793777.json", ], ], }, @@ -429,7 +429,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/f346d8c676d92a107f908b9aec4db5be56505a96a53c27a324b2f037d893e037.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/07259dc16b8630a4a30fea02c8e09f9f8c2af2a17ba3e9fe0e44879a45085209.json", ], ], }, @@ -1075,7 +1075,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/0414e993a8284a9c16b9356010ed65eb3d31e649edca57eca96e5246806466fe.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/0cc90bb0fc3b992e0224b6b81177a8826e7a465c95ce9681f403296f5b49e507.json", ], ], }, @@ -1094,7 +1094,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/14c7d41da181ad055e65f5e49dd615bca9e6070b5161de8bc8bc12358782688d.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/081779f83ae90f16185e8186b37859f4be0b92d2906da5bd684c925f95793777.json", ], ], }, @@ -1113,7 +1113,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/f346d8c676d92a107f908b9aec4db5be56505a96a53c27a324b2f037d893e037.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/07259dc16b8630a4a30fea02c8e09f9f8c2af2a17ba3e9fe0e44879a45085209.json", ], ], }, diff --git a/test/__snapshots__/enable-policy-type.test.ts.snap b/test/__snapshots__/enable-policy-type.test.ts.snap index 886167dd..a5c5f982 100644 --- a/test/__snapshots__/enable-policy-type.test.ts.snap +++ b/test/__snapshots__/enable-policy-type.test.ts.snap @@ -236,7 +236,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/14c7d41da181ad055e65f5e49dd615bca9e6070b5161de8bc8bc12358782688d.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/081779f83ae90f16185e8186b37859f4be0b92d2906da5bd684c925f95793777.json", ], ], }, @@ -255,7 +255,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/f346d8c676d92a107f908b9aec4db5be56505a96a53c27a324b2f037d893e037.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/07259dc16b8630a4a30fea02c8e09f9f8c2af2a17ba3e9fe0e44879a45085209.json", ], ], }, diff --git a/test/__snapshots__/integ.default.test.ts.snap b/test/__snapshots__/integ.default.test.ts.snap index 9ec0062c..2ce29a5a 100644 --- a/test/__snapshots__/integ.default.test.ts.snap +++ b/test/__snapshots__/integ.default.test.ts.snap @@ -1754,7 +1754,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/41a988d44fdb71cc66ce306b31227b2858c4b64025b808655d56292330c53eb2.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/8bc1457fb00913e10d3e9b99fbab9fd076cb0ec99e36d5853b541f5e07a34e33.json", ], ], }, @@ -1779,7 +1779,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/51cb175091e01ce3aa40d0b1c8580449cc170e7037e13def430c3c8c2c859009.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/514e759489978d90644a95333547f267889c62b513683adf5f32d59f37b7b759.json", ], ], }, @@ -1804,7 +1804,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/e1763ce8f01d452663034c697c50011f2c7d11cd50932c9f7a49024ba461ed14.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/baaaef717dc878cce9ed14ea8c28ad090f31281da9a95a43cfdb8ffb164dea17.json", ], ], }, @@ -1829,7 +1829,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/8b9a51d34aab09fce70e8429d28fc23096f5c1f682ddb092fbda2dc1c0f9ee26.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/7631703402eef0cbf8c0672fc8c5bfd2ae024e25eebf1f63d2b9835e985abb3b.json", ], ], }, diff --git a/test/__snapshots__/organization.test.ts.snap b/test/__snapshots__/organization.test.ts.snap index 10026908..bd0fb97a 100644 --- a/test/__snapshots__/organization.test.ts.snap +++ b/test/__snapshots__/organization.test.ts.snap @@ -156,7 +156,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/14c7d41da181ad055e65f5e49dd615bca9e6070b5161de8bc8bc12358782688d.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/081779f83ae90f16185e8186b37859f4be0b92d2906da5bd684c925f95793777.json", ], ], }, @@ -175,7 +175,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/f346d8c676d92a107f908b9aec4db5be56505a96a53c27a324b2f037d893e037.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/07259dc16b8630a4a30fea02c8e09f9f8c2af2a17ba3e9fe0e44879a45085209.json", ], ], }, diff --git a/test/__snapshots__/organizational-unit.test.ts.snap b/test/__snapshots__/organizational-unit.test.ts.snap index 03a9d601..c1c9c02a 100644 --- a/test/__snapshots__/organizational-unit.test.ts.snap +++ b/test/__snapshots__/organizational-unit.test.ts.snap @@ -208,7 +208,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/14c7d41da181ad055e65f5e49dd615bca9e6070b5161de8bc8bc12358782688d.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/081779f83ae90f16185e8186b37859f4be0b92d2906da5bd684c925f95793777.json", ], ], }, @@ -227,7 +227,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/964ca73ed46c8e216f43687a094cee170fa8f3c4e03c7874c22d5ec4bb75a56c.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/a114195d324c9ce92388c0e4a0f038ef2cddf84ed2e8830cdd39d98146064028.json", ], ], }, @@ -246,7 +246,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/f346d8c676d92a107f908b9aec4db5be56505a96a53c27a324b2f037d893e037.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/07259dc16b8630a4a30fea02c8e09f9f8c2af2a17ba3e9fe0e44879a45085209.json", ], ], }, diff --git a/test/__snapshots__/policy-attachment.test.ts.snap b/test/__snapshots__/policy-attachment.test.ts.snap index eddeabf1..f25d4693 100644 --- a/test/__snapshots__/policy-attachment.test.ts.snap +++ b/test/__snapshots__/policy-attachment.test.ts.snap @@ -315,7 +315,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/0414e993a8284a9c16b9356010ed65eb3d31e649edca57eca96e5246806466fe.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/0cc90bb0fc3b992e0224b6b81177a8826e7a465c95ce9681f403296f5b49e507.json", ], ], }, @@ -334,7 +334,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/f346d8c676d92a107f908b9aec4db5be56505a96a53c27a324b2f037d893e037.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/07259dc16b8630a4a30fea02c8e09f9f8c2af2a17ba3e9fe0e44879a45085209.json", ], ], }, diff --git a/test/__snapshots__/policy.test.ts.snap b/test/__snapshots__/policy.test.ts.snap index af135519..f2fb2abb 100644 --- a/test/__snapshots__/policy.test.ts.snap +++ b/test/__snapshots__/policy.test.ts.snap @@ -147,7 +147,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/f346d8c676d92a107f908b9aec4db5be56505a96a53c27a324b2f037d893e037.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/07259dc16b8630a4a30fea02c8e09f9f8c2af2a17ba3e9fe0e44879a45085209.json", ], ], }, diff --git a/test/__snapshots__/tag-resource.test.ts.snap b/test/__snapshots__/tag-resource.test.ts.snap index 8e2d71d9..eac721cd 100644 --- a/test/__snapshots__/tag-resource.test.ts.snap +++ b/test/__snapshots__/tag-resource.test.ts.snap @@ -41,7 +41,7 @@ Object { Object { "Ref": "AWS::URLSuffix", }, - "/cdk-hnb659fds-assets-123456789012-us-east-1/0dfe3680370839896a7f9dbb17b1cc0d2fe26c18baa67c0e1b888f1531a93197.json", + "/cdk-hnb659fds-assets-123456789012-us-east-1/7515ae825cc5fad6a9404191acbaf9bbfe843169d7aee832992218ee63f3822e.json", ], ], },