aboutsummaryrefslogtreecommitdiff
path: root/terraform/dns.tf
diff options
context:
space:
mode:
Diffstat (limited to 'terraform/dns.tf')
-rw-r--r--terraform/dns.tf43
1 files changed, 43 insertions, 0 deletions
diff --git a/terraform/dns.tf b/terraform/dns.tf
new file mode 100644
index 0000000..b0b10e0
--- /dev/null
+++ b/terraform/dns.tf
@@ -0,0 +1,43 @@
+provider "linode" {
+ version = "1.8.0"
+ token = var.linode_personal_access_token
+}
+
+variable "linode_personal_access_token" {
+ description = "Your Linode Personal Access Token. Get one from https://cloud.linode.com"
+}
+
+variable "linode_domain" {
+ description = "The domain to use, example: example.org"
+}
+
+variable "linode_domain_soa_email" {
+ description = "The domain's contact email, example: root@example.org"
+}
+
+# Import this resource with:
+# > terraform import linode_domain.k8s_domain domainID
+resource "linode_domain" "k8s_domain" {
+ type = "master"
+ domain = var.linode_domain
+ refresh_sec = 300
+ retry_sec = 300
+ soa_email = var.linode_domain_soa_email
+ ttl_sec = 300
+}
+
+resource "linode_domain_record" "k8s_master" {
+ domain_id = linode_domain.k8s_domain.id
+ name = "k8s-master"
+ record_type = "A"
+ target = scaleway_server.k8s_master.public_ip
+}
+
+resource "linode_domain_record" "k8s_node" {
+ domain_id = "${linode_domain.k8s_domain.id}"
+ name = "k8s-node${count.index}"
+ record_type = "A"
+ target = scaleway_server.k8s_node[count.index].public_ip
+
+ count = var.node_count
+}