Skip to content

Commit 2451ad8

Browse files
authored
chore: Use talos terraform-module in devenv (#65)
1 parent 69c4be7 commit 2451ad8

File tree

12 files changed

+127
-303
lines changed

12 files changed

+127
-303
lines changed

ephemeral/backend.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ provider "vault" {
3030

3131
provider "helm" {
3232
kubernetes {
33-
config_path = local_sensitive_file.kubeconfig.filename
33+
config_path = module.talos.kubeconfig.path
3434
}
3535
}

ephemeral/config_patch.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
machine:
2+
registries:
3+
config:
4+
docker.fluence.dev:
5+
auth:
6+
username: ${docker_username}
7+
password: ${docker_password}

ephemeral/controlplane.tf

Lines changed: 0 additions & 151 deletions
This file was deleted.

ephemeral/instance.tf

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
data "digitalocean_vpc" "spectrum" {
2+
name = "rnd-spectrum-vpc"
3+
}
4+
5+
resource "tls_private_key" "spectrum" {
6+
algorithm = "ED25519"
7+
}
8+
9+
resource "digitalocean_ssh_key" "spectrum" {
10+
name = "${local.prefix}-ssh-key"
11+
public_key = tls_private_key.spectrum.public_key_openssh
12+
}
13+
14+
data "digitalocean_image" "talos" {
15+
name = "talos-v1.8.4"
16+
}
17+
18+
resource "digitalocean_droplet" "talos" {
19+
name = "rnd-${local.prefix}-spectrum-cp"
20+
size = "s-8vcpu-16gb"
21+
image = data.digitalocean_image.talos.id
22+
region = "fra1"
23+
vpc_uuid = data.digitalocean_vpc.spectrum.id
24+
25+
ssh_keys = [
26+
digitalocean_ssh_key.spectrum.id
27+
]
28+
29+
tags = [
30+
local.prefix,
31+
]
32+
}
33+
34+
resource "digitalocean_reserved_ip" "l2" {
35+
droplet_id = digitalocean_droplet.talos.id
36+
region = digitalocean_droplet.talos.region
37+
}

ephemeral/main.tf

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,5 @@
11
locals {
2-
prefix = terraform.workspace
3-
loadbalancer_dns = "kube.${local.prefix}.fluence.dev"
4-
}
5-
6-
resource "tls_private_key" "spectrum" {
7-
algorithm = "ED25519"
8-
}
9-
10-
resource "digitalocean_ssh_key" "spectrum" {
11-
name = "${local.prefix}-ssh-key"
12-
public_key = tls_private_key.spectrum.public_key_openssh
13-
}
14-
15-
data "digitalocean_image" "talos" {
16-
name = "talos-v1.8.4"
2+
prefix = terraform.workspace
173
}
184

195
data "vault_generic_secret" "spectrum" {
@@ -24,10 +10,19 @@ data "vault_generic_secret" "docker" {
2410
path = "kv/docker-registry/basicauth/ci"
2511
}
2612

13+
module "talos" {
14+
source = "../terraform-modules/talos"
15+
cluster_name = local.prefix
16+
server_ip = digitalocean_droplet.talos.ipv4_address
17+
18+
config_patches = [
19+
file("${path.root}/config_patch.yml"),
20+
]
21+
}
22+
2723
module "spectrum" {
2824
depends_on = [
29-
data.http.talos_health,
30-
local_sensitive_file.kubeconfig,
25+
module.talos
3126
]
3227
source = "../terraform-modules/spectrum"
3328
network = var.github_branch
@@ -41,7 +36,7 @@ module "spectrum" {
4136
DOTOKEN = base64encode(data.vault_generic_secret.spectrum.data.token)
4237
DOMAIN = "${local.prefix}.fluence.dev"
4338
PREFIX = local.prefix
44-
LOADBALANCER_IP = digitalocean_loadbalancer.cp.ip
39+
LOADBALANCER_IP = digitalocean_droplet.talos.ipv4_address
4540
L2_IP = digitalocean_reserved_ip.l2.ip_address
4641
}
4742
}

ephemeral/network.tf

Lines changed: 0 additions & 57 deletions
This file was deleted.

ephemeral/outputs.tf

Lines changed: 0 additions & 21 deletions
This file was deleted.

ephemeral/templates/controlplane_patch.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)