-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdns.tf
executable file
·31 lines (27 loc) · 998 Bytes
/
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
# You must change this value to a unique subdomain that will not conflict with
# others. Pick your favorite color, favorite vegetable, and a random number
# between 1 and 100. For example, "red-carrot-93".
variable "dnsimple_subdomain" {
description = "The subdomain for the DNS record on terraform.rocks."
}
# Ask your instructor for the correct values.
variable "dnsimple_email" {}
variable "dnsimple_token" {}
# This sets up the credentials for interacting with DNSimple.
provider "dnsimple" {
email = "${var.dnsimple_email}"
token = "${var.dnsimple_token}"
}
# This resource will create a new DNS record for the subdomain of your
# choosing from the variable above.
resource "dnsimple_record" "web" {
domain = "terraform.rocks"
name = "${var.dnsimple_subdomain}"
value = "${aws_instance.haproxy.public_ip}"
type = "A"
ttl = 30
}
# Output the DNS address so you can easily copy-paste into the browser.
output "address" {
value = "${dnsimple_record.web.hostname}"
}