aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--terraform/.gitignore5
-rw-r--r--terraform/dns.tf43
-rw-r--r--terraform/main.tf2
-rw-r--r--terraform/variables.tf6
4 files changed, 55 insertions, 1 deletions
diff --git a/terraform/.gitignore b/terraform/.gitignore
new file mode 100644
index 0000000..de15fde
--- /dev/null
+++ b/terraform/.gitignore
@@ -0,0 +1,5 @@
+.terraform
+plan
+*.auto.tfvars
+terraform.tfstate
+terraform.tfstate.backup
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
+}
diff --git a/terraform/main.tf b/terraform/main.tf
index 9ad90ff..281f49d 100644
--- a/terraform/main.tf
+++ b/terraform/main.tf
@@ -1,6 +1,8 @@
provider "scaleway" {
region = "${var.region}"
version = "1.10"
+ organization = var.scaleway_organization
+ token = var.scaleway_token
}
provider "external" {
diff --git a/terraform/variables.tf b/terraform/variables.tf
index 93b2743..efb1ca7 100644
--- a/terraform/variables.tf
+++ b/terraform/variables.tf
@@ -9,7 +9,7 @@ variable "arch" {
}
variable "debian_version" {
- default = "Debian Stretch"
+ default = "Debian Stretch"
}
variable "k8s_master_server_type" {
@@ -18,3 +18,7 @@ variable "k8s_master_server_type" {
variable "node_count" {
default = "3"
}
+
+variable "scaleway_organization" {}
+
+variable "scaleway_token" {}