Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 3e9bfe6

Browse files
committed
Add digitalocean terraform
Signed-off-by: Christian Simon <[email protected]>
1 parent 9440811 commit 3e9bfe6

File tree

8 files changed

+77
-0
lines changed

8 files changed

+77
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/config-map-aws-auth_*
2+
/kubeconfig_*
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
data "external" "cert_manager" {
2+
program = ["jq", ".cert_manager", "../../manifests/google-config.json"]
3+
query = {}
4+
}
5+
6+
data "external" "externaldns" {
7+
program = ["jq", ".externaldns", "../../manifests/google-config.json"]
8+
query = {}
9+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
locals {
2+
config = {
3+
cert_manager = "${data.external.cert_manager.result}"
4+
externaldns = "${data.external.externaldns.result}"
5+
gangway = "${module.gangway.config}"
6+
}
7+
}
8+
9+
output "config" {
10+
value = "${jsonencode(local.config)}"
11+
}
12+
13+
output "kubeconfig_command" {
14+
value = "cd infrastructure/digitalocean/ && terraform output kubeconfig > $$KUBECONFIG"
15+
}
16+
17+
output "kubeconfig" {
18+
description = "kubectl config as generated by the module."
19+
value = "${module.cluster.kubeconfig}"
20+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
provider "digitalocean" {}
2+
3+
variable "digitalocean_region" {
4+
default = "fra1"
5+
}
6+
7+
variable "cluster_version" {
8+
default = "1.12.8-do.1"
9+
}
10+
11+
module "cluster" {
12+
source = "../modules/digitalocean-cluster"
13+
suffix = "${random_id.suffix.hex}"
14+
15+
cluster_version = "${var.cluster_version}"
16+
region = "${var.digitalocean_region}"
17+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module "gangway" {
2+
source = "../modules/gangway"
3+
length = 24
4+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
resource "random_id" "suffix" {
2+
byte_length = 4
3+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
variable "region" {}
2+
variable "suffix" {}
3+
variable "cluster_version" {}
4+
5+
locals {
6+
cluster_name = "cluster-${var.suffix}"
7+
}
8+
9+
resource "digitalocean_kubernetes_cluster" "cluster" {
10+
name = "${local.cluster_name}"
11+
version = "${var.cluster_version}"
12+
region = "${var.region}"
13+
14+
node_pool {
15+
name = "default-pool"
16+
size = "s-2vcpu-2gb"
17+
node_count = 3
18+
}
19+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
output "kubeconfig" {
2+
value = "${digitalocean_kubernetes_cluster.cluster.kube_config.0.raw_config}"
3+
}

0 commit comments

Comments
 (0)