From 8cb7e2baf227ee1fc453a2fec1d5e7cf3365a52d Mon Sep 17 00:00:00 2001 From: Tom Wright Date: Tue, 26 Sep 2023 17:16:53 +1000 Subject: [PATCH] feat: resolve Fn::ImportValue --- .../aws-cdk/lib/api/evaluate-cloudformation-template.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/aws-cdk/lib/api/evaluate-cloudformation-template.ts b/packages/aws-cdk/lib/api/evaluate-cloudformation-template.ts index 0a4446621e11c..8d56646852d10 100644 --- a/packages/aws-cdk/lib/api/evaluate-cloudformation-template.ts +++ b/packages/aws-cdk/lib/api/evaluate-cloudformation-template.ts @@ -144,6 +144,7 @@ export class EvaluateCloudFormationTemplate { partition: this.partition, urlSuffix: this.urlSuffix, listStackResources: listNestedStackResources, + lookupExport: this.lookupExport, }); } @@ -249,6 +250,14 @@ export class EvaluateCloudFormationTemplate { } }); } + + async 'Fn::ImportValue'(name: string): Promise { + const exported = await self.lookupExport.lookupExport(name); + if (!exported.Value) { + throw new CfnEvaluationException(`Export '${name}' exists without a value`); + } + return exported.Value; + } } if (cfnExpression == null) {