From f3e7c542cd87a91ee07c703e5bea23887d6c5569 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Sat, 27 Jul 2019 19:51:40 +0200 Subject: dns --- terraform/dns.tf | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 terraform/dns.tf (limited to 'terraform/dns.tf') 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 +} -- cgit v1.2.3