Skip to content

Commit 86aa9ee

Browse files
committed
fix(aws): preserve live API network identities
1 parent b13a2f4 commit 86aa9ee

4 files changed

Lines changed: 24 additions & 8 deletions

File tree

infra/aws/environments/production.tfvars.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ availability_zones = ["us-east-1a", "us-east-1b"]
66
vpc_cidr = "10.42.0.0/16"
77

88
api_route53_zone_id = "replace-me-with-bootstrap-api-zone-id"
9+
playback_route53_zone_id = "replace-me-with-bootstrap-playback-zone-id"
910
api_domain_name = "api.rend.so"
1011
playback_domain_name = "video.rend.so"
1112
internal_domain_name = "origin.api.rend.so"

infra/aws/platform/delivery.tf

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
resource "aws_acm_certificate" "public" {
22
provider = aws.us_east_1
33

4-
domain_name = var.api_domain_name
5-
validation_method = "DNS"
4+
domain_name = var.api_domain_name
5+
subject_alternative_names = [var.playback_domain_name]
6+
validation_method = "DNS"
67

78
lifecycle {
89
create_before_destroy = true
@@ -18,7 +19,11 @@ resource "aws_route53_record" "certificate_validation" {
1819
}
1920
}
2021

21-
zone_id = var.api_route53_zone_id
22+
zone_id = (
23+
each.key == var.playback_domain_name
24+
? var.playback_route53_zone_id
25+
: var.api_route53_zone_id
26+
)
2227
name = each.value.name
2328
type = each.value.type
2429
records = [each.value.record]
@@ -67,10 +72,15 @@ resource "aws_acm_certificate_validation" "internal" {
6772

6873

6974
resource "aws_route53_record" "public_ipv4" {
70-
count = var.services_enabled ? 1 : 0
75+
for_each = var.services_enabled ? {
76+
api = {
77+
name = var.api_domain_name
78+
zone_id = var.api_route53_zone_id
79+
}
80+
} : {}
7181

72-
zone_id = var.api_route53_zone_id
73-
name = var.api_domain_name
82+
zone_id = each.value.zone_id
83+
name = each.value.name
7484
type = "A"
7585

7686
alias {

infra/aws/platform/network.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ resource "aws_vpc_endpoint" "planetscale" {
141141

142142
resource "aws_security_group" "origin_alb" {
143143
name = "${local.resource_prefix}-origin-alb"
144-
description = "Internal Rend API and ClickHouse ALB"
144+
description = "CloudFront VPC Origin to the internal Rend ALB"
145145
vpc_id = aws_vpc.this.id
146146

147147
egress {
@@ -185,7 +185,7 @@ resource "aws_vpc_security_group_ingress_rule" "public_api_ipv6" {
185185

186186
resource "aws_security_group" "ecs" {
187187
name = "${local.resource_prefix}-ecs"
188-
description = "Rend API traffic from the public and internal ALBs"
188+
description = "Rend API and edge traffic from the internal ALB"
189189
vpc_id = aws_vpc.this.id
190190

191191
egress {

infra/aws/platform/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ variable "api_route53_zone_id" {
4848
type = string
4949
}
5050

51+
variable "playback_route53_zone_id" {
52+
description = "Delegated playback zone retained for the existing certificate validation record; Tigris serves playback through the authoritative CNAME."
53+
type = string
54+
}
55+
5156
variable "api_domain_name" {
5257
description = "Public API hostname routed directly to the public ALB."
5358
type = string

0 commit comments

Comments
 (0)