-
Notifications
You must be signed in to change notification settings - Fork 25
/
aws.tf
88 lines (73 loc) · 2.17 KB
/
aws.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
data "aws_route53_zone" "main" {
name = var.hosted-zone
}
# AWS SUBZONE
resource "aws_route53_zone" "aws_sub_zone" {
count = var.create_aws_dns_zone ? 1 : 0
name = "${var.namespace}.aws.${var.hosted-zone}"
comment = "Managed by Terraform, Delegated Sub Zone for AWS for ${var.namespace}"
tags = {
name = var.namespace
owner = var.owner
created-by = var.created-by
ttl = "-1"
}
}
resource "aws_route53_record" "aws_sub_zone_ns" {
count = var.create_aws_dns_zone ? 1 : 0
zone_id = data.aws_route53_zone.main.zone_id
name = "${var.namespace}.aws.${var.hosted-zone}"
type = "NS"
ttl = "30"
records = [
for awsns in aws_route53_zone.aws_sub_zone.0.name_servers :
awsns
]
}
# Azure SUBZONE
resource "aws_route53_zone" "azure_sub_zone" {
count = var.create_azure_dns_zone ? 1 : 0
name = "${var.namespace}.azure.${var.hosted-zone}"
comment = "Managed by Terraform, Delegated Sub Zone for Azure for ${var.namespace}"
tags = {
name = var.namespace
owner = var.owner
created-by = var.created-by
ttl = "-1"
}
}
resource "aws_route53_record" "azure_sub_zone_ns" {
count = var.create_azure_dns_zone ? 1 : 0
zone_id = data.aws_route53_zone.main.zone_id
name = "${var.namespace}.azure.${var.hosted-zone}"
type = "NS"
ttl = "30"
records = [
for azurens in azurerm_dns_zone.azure_sub_zone.0.name_servers :
azurens
]
}
# GCP SubZone
resource "aws_route53_zone" "gcp_sub_zone" {
count = var.create_gcp_dns_zone ? 1 : 0
name = "${var.namespace}.gcp.${var.hosted-zone}"
comment = "Managed by Terraform, Delegated Sub Zone for GCP for ${var.namespace}"
force_destroy = false
tags = {
name = var.namespace
owner = var.owner
created-by = var.created-by
ttl = "-1"
}
}
resource "aws_route53_record" "gcp_sub_zone" {
count = var.create_gcp_dns_zone ? 1 : 0
zone_id = data.aws_route53_zone.main.zone_id
name = "${var.namespace}.gcp.${var.hosted-zone}"
type = "NS"
ttl = "30"
records = [
for gcpns in google_dns_managed_zone.gcp_sub_zone.0.name_servers :
gcpns
]
}