Skip to content

Commit

Permalink
feat: resolve Fn::ImportValue
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwwright committed Sep 26, 2023
1 parent aac22fa commit 8cb7e2b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/aws-cdk/lib/api/evaluate-cloudformation-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export class EvaluateCloudFormationTemplate {
partition: this.partition,
urlSuffix: this.urlSuffix,
listStackResources: listNestedStackResources,
lookupExport: this.lookupExport,
});
}

Expand Down Expand Up @@ -249,6 +250,14 @@ export class EvaluateCloudFormationTemplate {
}
});
}

async 'Fn::ImportValue'(name: string): Promise<string> {
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) {
Expand Down

0 comments on commit 8cb7e2b

Please sign in to comment.