mirror of
https://github.com/2martens/terraform.git
synced 2026-10-18 01:16:52 +02:00
Set argocd environment
This commit is contained in:
+1
-1
@@ -46,7 +46,7 @@ module "test_cluster" {
|
||||
network_id = hcloud_network.kubernetes-network.id
|
||||
private_node_ips = ["10.0.0.4", "10.0.0.5", "10.0.0.6"]
|
||||
server_subnet_id = hcloud_network_subnet.k8s-network-subnet.id
|
||||
cluster_role = "test"
|
||||
cluster_name = "test"
|
||||
number_nodes = 1
|
||||
server_type = "cax21"
|
||||
image_name = "ubuntu-22.04"
|
||||
|
||||
@@ -47,7 +47,7 @@ resource "null_resource" "install_argocd_single" {
|
||||
inline = [
|
||||
"helm repo add 2martens https://repo.2martens.de/charts/",
|
||||
"helm install setup 2martens/cluster_setup",
|
||||
"helm install argocd 2martens/argocd",
|
||||
"helm install argocd 2martens/argocd --set environment=${var.argocd_environment}",
|
||||
]
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ resource "null_resource" "install_argocd_ha" {
|
||||
inline = [
|
||||
"helm repo add 2martens https://repo.2martens.de/charts/",
|
||||
"helm install setup 2martens/cluster_setup",
|
||||
"helm install argocd 2martens/argocd --values /home/terraform/argocd-values-ha.yaml",
|
||||
"helm install argocd 2martens/argocd --set environment=${var.argocd_environment} --values /home/terraform/argocd-values-ha.yaml",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
@@ -3,14 +3,14 @@ data "hcloud_placement_group" "default" {
|
||||
}
|
||||
|
||||
locals {
|
||||
kube_api_server_domain = format("%s.%s.%s", "k8s", var.cluster_role, var.domain)
|
||||
kube_api_server_domain = format("%s.%s.%s", "k8s", var.cluster_name, var.domain)
|
||||
}
|
||||
|
||||
resource "hcloud_load_balancer" "kubernetes" {
|
||||
count = var.create_loadbalancer ? 1 : 0
|
||||
|
||||
load_balancer_type = var.loadbalancer_type
|
||||
name = format("%s_%s", "k8s", var.cluster_role)
|
||||
name = format("%s_%s", "k8s", var.cluster_name)
|
||||
location = var.locations[count.index].name
|
||||
network_zone = var.locations[count.index].network_zone
|
||||
algorithm {
|
||||
|
||||
@@ -11,7 +11,7 @@ resource "inwx_nameserver_record" "manager_aaaa" {
|
||||
resource "hcloud_primary_ip" "ipv4_manager_address" {
|
||||
count = var.create_loadbalancer ? 0 : var.number_nodes
|
||||
|
||||
name = format("%s_%s_%s_%d", "k8s", var.cluster_role, "ipv4", count.index)
|
||||
name = format("%s_%s_%s_%d", "k8s", var.cluster_name, "ipv4", count.index)
|
||||
datacenter = element(var.locations.*.datacenter_name, count.index)
|
||||
type = "ipv4"
|
||||
assignee_type = "server"
|
||||
@@ -21,7 +21,7 @@ resource "hcloud_primary_ip" "ipv4_manager_address" {
|
||||
resource "hcloud_primary_ip" "ipv6_manager_address" {
|
||||
count = var.number_nodes
|
||||
|
||||
name = format("%s_%s_%s_%d", "k8s", var.cluster_role, "ipv6", count.index)
|
||||
name = format("%s_%s_%s_%d", "k8s", var.cluster_name, "ipv6", count.index)
|
||||
datacenter = element(var.locations.*.datacenter_name, count.index)
|
||||
type = "ipv6"
|
||||
assignee_type = "server"
|
||||
@@ -39,7 +39,7 @@ resource "hcloud_server_network" "manager_private" {
|
||||
resource "hcloud_server" "manager" {
|
||||
count = var.number_nodes
|
||||
|
||||
name = format("%s_%s_%s_%d", "k8s", var.cluster_role, "node", count.index)
|
||||
name = format("%s_%s_%s_%d", "k8s", var.cluster_name, "node", count.index)
|
||||
image = var.image_name
|
||||
allow_deprecated_images = false
|
||||
server_type = var.server_type
|
||||
|
||||
@@ -69,8 +69,14 @@ variable "k8s_firewall_id" {
|
||||
type = number
|
||||
}
|
||||
|
||||
variable "cluster_role" {
|
||||
description = "The role the cluster serves. For example test, qs, prod. Will be used for names and subdomains and must be unique within the Hetzner project."
|
||||
variable "cluster_name" {
|
||||
description = "The name of the cluster. For example test, qs, prod. Will be used for names and subdomains and must be unique within the Hetzner project (identified by API token)."
|
||||
type = string
|
||||
default = "test"
|
||||
}
|
||||
|
||||
variable "argocd_environment" {
|
||||
description = "The Argo CD environment to use. Argo CD will install the applications of that environment to the cluster."
|
||||
type = string
|
||||
default = "test"
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ resource "inwx_nameserver_record" "worker_aaaa" {
|
||||
resource "hcloud_primary_ip" "ipv6_worker_address" {
|
||||
count = var.number_worker_nodes
|
||||
|
||||
name = format("%s_%s_%s_%d", "k8s", var.cluster_role, "ipv6", count.index)
|
||||
name = format("%s_%s_%s_%d", "k8s", var.cluster_name, "ipv6", count.index)
|
||||
datacenter = element(var.locations.*.datacenter_name, count.index)
|
||||
type = "ipv6"
|
||||
assignee_type = "server"
|
||||
@@ -29,7 +29,7 @@ resource "hcloud_server_network" "worker_private" {
|
||||
resource "hcloud_server" "worker" {
|
||||
count = var.number_worker_nodes
|
||||
|
||||
name = format("%s_%s_%s_%d", "k8s", var.cluster_role, "node", count.index)
|
||||
name = format("%s_%s_%s_%d", "k8s", var.cluster_name, "node", count.index)
|
||||
image = var.image_name
|
||||
allow_deprecated_images = false
|
||||
server_type = var.server_type
|
||||
|
||||
Reference in New Issue
Block a user