-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdns.tf
47 lines (39 loc) · 1.44 KB
/
dns.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
resource "aws_api_gateway_domain_name" "emojibot" {
domain_name = local.current.dns_name
regional_certificate_arn = aws_acm_certificate_validation.emojiBot.certificate_arn
endpoint_configuration {
types = ["REGIONAL"]
}
}
// DNS record for emojiBot
resource "aws_route53_record" "emojibot" {
name = aws_api_gateway_domain_name.emojibot.domain_name
type = "A"
zone_id = data.aws_route53_zone.ctrlokDev.id
alias {
evaluate_target_health = true
name = aws_api_gateway_domain_name.emojibot.regional_domain_name
zone_id = aws_api_gateway_domain_name.emojibot.regional_zone_id
}
}
resource "aws_acm_certificate" "emojiBot" {
domain_name = local.current.dns_name
validation_method = "DNS"
}
data "aws_route53_zone" "ctrlokDev" {
name = "aws.ctrlok.dev."
private_zone = false
}
resource "aws_route53_record" "emojiBot_cert_validation" {
name = aws_acm_certificate.emojiBot.domain_validation_options[0].resource_record_name
type = aws_acm_certificate.emojiBot.domain_validation_options[0].resource_record_type
zone_id = data.aws_route53_zone.ctrlokDev.id
records = [
aws_acm_certificate.emojiBot.domain_validation_options[0].resource_record_value]
ttl = 60
}
resource "aws_acm_certificate_validation" "emojiBot" {
certificate_arn = aws_acm_certificate.emojiBot.arn
validation_record_fqdns = [
aws_route53_record.emojiBot_cert_validation.fqdn]
}