From cdc4416515786e9bea72f209950a402260d9b4c3 Mon Sep 17 00:00:00 2001 From: Joost van der Borg Date: Fri, 5 May 2023 18:06:09 +0200 Subject: [PATCH] Use correct region in us-east stack --- src/ApiStage.ts | 2 +- src/UsEastCertificateStack.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/ApiStage.ts b/src/ApiStage.ts index 6d4d4406..a171617b 100644 --- a/src/ApiStage.ts +++ b/src/ApiStage.ts @@ -26,7 +26,7 @@ export class ApiStage extends Stage { const dnsStack = new DNSStack(this, 'dns-stack'); dnsStack.addDependency(paramStack); - const usEastCertificateStack = new UsEastCertificateStack(this, 'us-cert-stack', { branch: props.branch, env: { region: 'us-east-1' } }); + const usEastCertificateStack = new UsEastCertificateStack(this, 'us-cert-stack', { branch: props.branch, env: { region: 'us-east-1' }, appRegion: props.env?.region ?? 'eu-central-1' }); usEastCertificateStack.addDependency(dnsStack); const apiStack = new ApiStack(this, 'api-stack', { diff --git a/src/UsEastCertificateStack.ts b/src/UsEastCertificateStack.ts index 78d4f2f1..ca64977b 100644 --- a/src/UsEastCertificateStack.ts +++ b/src/UsEastCertificateStack.ts @@ -6,13 +6,14 @@ import { Statics } from './statics'; export interface UsEastCertificateStackProps extends StackProps { branch: string; + appRegion: string; } export class UsEastCertificateStack extends Stack { constructor(scope: Construct, id: string, props: UsEastCertificateStackProps) { super(scope, id, props); - this.createCertificate(); + this.createCertificate(props.appRegion); } getZoneAttributes(parameters: RemoteParameters, id: string, name: string): { hostedZoneId: string; zoneName: string} { @@ -24,10 +25,10 @@ export class UsEastCertificateStack extends Stack { }; } - createCertificate() { + createCertificate(region: string) { const parameters = new RemoteParameters(this, 'params', { path: `${Statics.ssmZonePath}/`, - region: Stack.of(this).region, + region, }); const zoneParams = this.getZoneAttributes(parameters, Statics.ssmZoneId, Statics.ssmZoneName); const zone = HostedZone.fromHostedZoneAttributes(this, 'zone', zoneParams);