From 76085c698b8a4068c89fbcfcee121184ea0c23fb Mon Sep 17 00:00:00 2001 From: Colin Ihrig Date: Mon, 21 Jun 2021 18:30:11 -0400 Subject: [PATCH] fix: support AWS::URLSuffix CFN pseudo-param in mock (#7416) --- .../src/CFNParser/appsync-resource-processor.ts | 1 + packages/amplify-util-mock/src/CFNParser/stack/index.ts | 1 + .../src/__tests__/utils/lambda/populate-cfn-params.test.ts | 2 ++ .../amplify-util-mock/src/utils/lambda/populate-cfn-params.ts | 1 + 4 files changed, 5 insertions(+) diff --git a/packages/amplify-util-mock/src/CFNParser/appsync-resource-processor.ts b/packages/amplify-util-mock/src/CFNParser/appsync-resource-processor.ts index 6dbcd04b1f4..52c29d663c7 100644 --- a/packages/amplify-util-mock/src/CFNParser/appsync-resource-processor.ts +++ b/packages/amplify-util-mock/src/CFNParser/appsync-resource-processor.ts @@ -9,6 +9,7 @@ const CFN_DEFAULT_PARAMS = { 'AWS::AccountId': '12345678910', 'AWS::StackId': 'fake-stackId', 'AWS::StackName': 'local-testing', + 'AWS::URLSuffix': 'amazonaws.com', }; const RESOLVER_TEMPLATE_LOCATION_PREFIX = 's3://${S3DeploymentBucket}/${S3DeploymentRootKey}/'; diff --git a/packages/amplify-util-mock/src/CFNParser/stack/index.ts b/packages/amplify-util-mock/src/CFNParser/stack/index.ts index 413f99dbd58..c2c9fd4e32c 100644 --- a/packages/amplify-util-mock/src/CFNParser/stack/index.ts +++ b/packages/amplify-util-mock/src/CFNParser/stack/index.ts @@ -19,6 +19,7 @@ export const CFN_PSEUDO_PARAMS = { 'AWS::AccountId': '12345678910', 'AWS::StackId': 'fake-stackId', 'AWS::StackName': 'local-testing', + 'AWS::URLSuffix': 'amazonaws.com', }; export function nestedStackHandler( diff --git a/packages/amplify-util-mock/src/__tests__/utils/lambda/populate-cfn-params.test.ts b/packages/amplify-util-mock/src/__tests__/utils/lambda/populate-cfn-params.test.ts index cb294200b6a..e6da9a7a9d3 100644 --- a/packages/amplify-util-mock/src/__tests__/utils/lambda/populate-cfn-params.test.ts +++ b/packages/amplify-util-mock/src/__tests__/utils/lambda/populate-cfn-params.test.ts @@ -77,6 +77,7 @@ describe('populate cfn params', () => { 'AWS::AccountId': '1234', 'AWS::StackId': 'arn:aws:cloudformation:us-test-1:1234:stack/my-test-stack', 'AWS::StackName': 'test-stack-name', + 'AWS::URLSuffix': 'amazonaws.com', }); }); @@ -93,6 +94,7 @@ describe('populate cfn params', () => { 'AWS::AccountId': '12345678910', 'AWS::StackId': 'fake-stack-id', 'AWS::StackName': 'local-testing', + 'AWS::URLSuffix': 'amazonaws.com', }); }); diff --git a/packages/amplify-util-mock/src/utils/lambda/populate-cfn-params.ts b/packages/amplify-util-mock/src/utils/lambda/populate-cfn-params.ts index b878993eb51..45eb9264081 100644 --- a/packages/amplify-util-mock/src/utils/lambda/populate-cfn-params.ts +++ b/packages/amplify-util-mock/src/utils/lambda/populate-cfn-params.ts @@ -32,6 +32,7 @@ const getCfnPseudoParams = (): Record => { 'AWS::AccountId': accountId, 'AWS::StackId': stackId, 'AWS::StackName': stackName, + 'AWS::URLSuffix': 'amazonaws.com', }; };