Skip to content

Commit

Permalink
Use correct region in us-east stack
Browse files Browse the repository at this point in the history
  • Loading branch information
joostvanderborg committed May 5, 2023
1 parent 5040b02 commit cdc4416
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/ApiStage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down
7 changes: 4 additions & 3 deletions src/UsEastCertificateStack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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} {
Expand All @@ -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);
Expand Down

0 comments on commit cdc4416

Please sign in to comment.