-
Notifications
You must be signed in to change notification settings - Fork 0
/
route53.tf
51 lines (41 loc) Β· 1.46 KB
/
route53.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
resource "aws_route53_zone" "repick_zone" {
name = var.route53_zone_domain
tags = {
Name = "repick-zone"
}
}
resource "aws_acm_certificate" "repick_certificate" {
domain_name = "*.${var.route53_zone_domain}"
validation_method = "DNS"
lifecycle {
create_before_destroy = true
}
tags = {
Name = "repick-certificate"
}
}
resource "aws_route53_record" "repick_certificate_dns" {
name = tolist(aws_acm_certificate.repick_certificate.domain_validation_options)[0].resource_record_name
type = tolist(aws_acm_certificate.repick_certificate.domain_validation_options)[0].resource_record_type
zone_id = aws_route53_zone.repick_zone.zone_id
records = [tolist(aws_acm_certificate.repick_certificate.domain_validation_options)[0].resource_record_value]
ttl = 60
}
resource "aws_acm_certificate_validation" "repick_certificate_validation" {
certificate_arn = aws_acm_certificate.repick_certificate.arn
validation_record_fqdns = [aws_route53_record.repick_certificate_dns.fqdn]
}
resource "aws_route53_record" "www" {
name = "www.${aws_route53_zone.repick_zone.name}"
type = "A"
zone_id = aws_route53_zone.repick_zone.zone_id
alias {
name = aws_lb.repick.dns_name
zone_id = aws_lb.repick.zone_id
evaluate_target_health = false
}
}
output "name_servers" {
description = "The name servers of the hosted zone"
value = aws_route53_zone.repick_zone.name_servers
}