Skip to content

Commit bb70bc2

Browse files
First version
1 parent 3caf200 commit bb70bc2

File tree

5 files changed

+136
-4
lines changed

5 files changed

+136
-4
lines changed

.editorconfig

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
[*]
5+
trim_trailing_whitespace = true
6+
insert_final_newline = false
7+
end_of_line = lf
8+
charset = utf-8
9+
tab_width = 4
10+
max_line_length = 80
11+
indent_size = 2
12+
indent_style = space
13+
trim_trailing_whitespace = true
14+
15+
[Makefile]
16+
indent_style = tab
17+
indent_size = 2
18+
trim_trailing_whitespace = true
19+
20+
[*.sh]
21+
indent_style = space
22+
indent_size = 2
23+
24+
[{*.{awk,bat,c,cpp,d,h,l,mk,re,skl,w32,y},Makefile*}]
25+
indent_size = 2
26+
indent_style = tab
27+
28+
[*.{tf,tfvars}]
29+
indent_size = 2
30+
indent_style = space
31+
32+
[*.{yml, yaml}]
33+
indent_style = space
34+
indent_size = 2
35+
36+
[*.{json,tpl}]
37+
indent_style = space
38+
indent_size = 2
39+
40+
[*.{xml,config,props,targets,nuspec,resx,ruleset,vsixmanifest,vsct}]
41+
indent_size = 2
42+
43+
[{*.hcl,*.conf}]
44+
indent_size = 2
45+
max_line_length = 100
46+
47+
[COMMIT_EDITMSG]
48+
indent_size = 4
49+
indent_style = space
50+
max_line_length = 80
51+
52+
[Vagrantfile]
53+
indent_size = 2
54+
indent_style = space
55+

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,26 @@ module dns {
1010
}
1111
```
1212

13-
1413
## Module Variables
1514

1615
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
1716
## Inputs
1817

1918
| Name | Description | Type | Default | Required |
2019
|------|-------------|:----:|:-----:|:-----:|
21-
| apps | Multiple applications to deploy | map | n/a | yes |
22-
| namespace | Namespace to where deploy CI/CD | string | n/a | yes |
23-
| repository | Collection of Helm repositories | string | n/a | yes |
20+
| parent\_dns\_zone\_id | The ID of the hosted zone to contain this record. | string | n/a | yes |
21+
| parent\_dns\_zone\_name | The name of the hosted zone | string | n/a | yes |
22+
| subdomain | Subdomain zone | string | n/a | yes |
23+
| tags | A mapping of tags to assign to the zone. | map(string) | `{}` | no |
24+
| ttl | The TTL of the recod | string | `"30"` | no |
25+
| type | The record type. Valid values are A, AAAA, CAA, CNAME, MX, NAPTR, NS, PTR, SOA, SPF, SRV and TXT. | string | `"NS"` | no |
26+
27+
## Outputs
28+
29+
| Name | Description |
30+
|------|-------------|
31+
| zone\_id | Zone ID for a dns distribution |
32+
| zone\_name | The name of the zone record. |
2433

2534
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2635

main.tf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
terraform {
2+
# The modules used in this example have been updated with 0.12 syntax, which means the example is no longer
3+
# compatible with any versions below 0.12.
4+
required_version = ">= 0.12"
5+
}
6+
7+
# ========= #
8+
# RESOURCES #
9+
# ========= #
10+
11+
resource aws_route53_zone this {
12+
name = fomat("%s.%s", var.subdomain, var.parent_dns_zone_name)
13+
comment = "${var.subdomain} DNS hosted zone"
14+
tags = var.tags
15+
}
16+
17+
resource aws_route53_record this {
18+
zone_id = var.parent_dns_zone_id
19+
name = format("%s.%s", var.subdomain, var.parent_dns_zone_name)
20+
type = var.type
21+
ttl = var.ttl
22+
23+
records = [
24+
format("%s.", aws_route53_zone.this.name_servers[0]),
25+
format("%s.", aws_route53_zone.this.name_servers[1]),
26+
format("%s.", aws_route53_zone.this.name_servers[2]),
27+
format("%s.", aws_route53_zone.this.name_servers[3]),
28+
]
29+
}

outputs.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# ========= #
2+
# OUTPUTS #
3+
# ========= #
4+
output "zone_id" {
5+
value = aws_route53_zone.this.zone_id
6+
description = "Zone ID for a dns distribution"
7+
}
8+
9+
output "zone_name" {
10+
value = aws_route53_zone.this.name
11+
description = "The name of the zone record."
12+
}

variables.tf

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# ========= #
2+
# VARIABLES #
3+
# ========= #
4+
variable "subdomain" {
5+
description = "Subdomain zone"
6+
}
7+
variable "parent_dns_zone_name" {
8+
description = "The name of the hosted zone"
9+
}
10+
variable "parent_dns_zone_id" {
11+
description = "The ID of the hosted zone to contain this record."
12+
}
13+
variable "type" {
14+
default = "NS"
15+
description = "The record type. Valid values are A, AAAA, CAA, CNAME, MX, NAPTR, NS, PTR, SOA, SPF, SRV and TXT."
16+
}
17+
18+
variable "ttl" {
19+
default = "30"
20+
description = "The TTL of the recod"
21+
}
22+
23+
variable "tags" {
24+
type = map(string)
25+
description = "A mapping of tags to assign to the zone."
26+
default = {}
27+
}

0 commit comments

Comments
 (0)