Skip to content

Commit

Permalink
fix: tell CloudFront to use our certificate
Browse files Browse the repository at this point in the history
  • Loading branch information
wolverian committed Sep 16, 2024
1 parent 8be15d8 commit ac4927c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion infra/bin/infra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,18 @@ const dnsStack = new DnsStack(app, "DnsStack", {
terminationProtection: true,
})

new CertificateStack(app, "CertificateStack", {
const certificateStack = new CertificateStack(app, "CertificateStack", {
crossRegionReferences: true,
env: { ...env, region: "us-east-1" },
hostedZone: dnsStack.hostedZone,
domainName: env.domainName,
})

new InfraStack(app, "InfraStack", {
crossRegionReferences: true,
env,
cidrBlock: env.network.cidr,
maxAzs: env.network.maxAzs,
domainName: env.domainName,
certificate: certificateStack.certificate,
})
12 changes: 7 additions & 5 deletions infra/lib/infra-stack.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import * as cdk from "aws-cdk-lib"
import { Construct } from "constructs"
import * as ec2 from "aws-cdk-lib/aws-ec2"
import * as ecsPatterns from "aws-cdk-lib/aws-ecs-patterns"
import * as ecs from "aws-cdk-lib/aws-ecs"
import { GithubActionsStack } from "./github-actions-stack"
import {
aws_certificatemanager,
aws_cloudfront,
aws_cloudfront_origins,
} from "aws-cdk-lib"
import { Construct } from "constructs"
import * as ec2 from "aws-cdk-lib/aws-ec2"
import * as ecsPatterns from "aws-cdk-lib/aws-ecs-patterns"
import * as ecs from "aws-cdk-lib/aws-ecs"
import { GithubActionsStack } from "./github-actions-stack"
import { Platform } from "aws-cdk-lib/aws-ecr-assets"

export interface InfraStackProps extends cdk.StackProps {
certificate: aws_certificatemanager.ICertificate
domainName: string
cidrBlock: string
maxAzs: number
Expand Down Expand Up @@ -64,6 +65,7 @@ export class InfraStack extends cdk.Stack {
),
},
domainNames: [props.domainName],
certificate: props.certificate,
})
}
}

0 comments on commit ac4927c

Please sign in to comment.