Skip to content

Commit f9af5bb

Browse files
authored
Merge pull request #42 from YAPP-Github/chore/PRODUCT-116
[Chore] Route53과 Vercel 도메인 연동 작업
2 parents 98ca06f + b584c18 commit f9af5bb

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

terraform/common/locals.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ locals {
100100
api = local.alb_alias
101101
api-dev = local.alb_alias
102102
}
103+
104+
frontend_domains = {
105+
"eatda.net" = { type = "A", value = "76.76.21.21" }
106+
"www" = { type = "CNAME", value = "cname.vercel-dns.com" }
107+
"dev" = { type = "CNAME", value = "cname.vercel-dns.com" }
108+
}
103109
}
104110

105111
locals {

terraform/common/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ module "route53" {
3737
validation_method = local.validation_method
3838
record_type = local.record_type
3939
subdomains = local.subdomains
40+
frontend_domains = local.frontend_domains
4041
}
4142

4243
module "alb" {

terraform/common/route53/main.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,14 @@ resource "aws_route53_record" "subdomains" {
5050
evaluate_target_health = true
5151
}
5252
}
53+
54+
resource "aws_route53_record" "frontend_subdomains" {
55+
for_each = var.frontend_domains
56+
57+
zone_id = data.aws_route53_zone.common.zone_id
58+
name = each.key == var.domain_name ? var.domain_name : "${each.key}.${var.domain_name}"
59+
type = each.value.type
60+
61+
ttl = 300
62+
records = [each.value.value]
63+
}

terraform/common/route53/variables.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ variable "subdomains" {
1111
}))
1212
}
1313

14+
variable "frontend_domains" {
15+
description = "frontend domains (A record or CNAME)"
16+
type = map(object({
17+
type = string
18+
value = string
19+
}))
20+
}
21+
1422
variable "validation_method" {
1523
type = string
1624
}

0 commit comments

Comments
 (0)