This commit is contained in:
Maximilian_Schlenz 2025-07-15 10:16:40 +02:00
parent e412c04881
commit a495f53751
6 changed files with 61 additions and 72 deletions

View file

@ -9,58 +9,58 @@ module "security_groups" {
rules = each.value.rules
}
# module "postgres" {
# source = "../postgres"
module "postgres" {
source = "../postgres"
# for_each = var.postgres_instances
for_each = var.postgres_instances
# project_id = var.project_id
# name = each.value.name
# ver = each.value.version
# flavor = each.value.flavor
# storage = each.value.storage
# replicas = each.value.replicas
# acl = each.value.acl
# backup_schedule = each.value.backup_schedule
# users = each.value.users
# databases = each.value.databases
# }
project_id = var.project_id
name = each.value.name
ver = each.value.version
flavor = each.value.flavor
storage = each.value.storage
replicas = each.value.replicas
acl = each.value.acl
backup_schedule = each.value.backup_schedule
users = each.value.users
databases = each.value.databases
}
# module "net" {
# source = "../network"
module "net" {
source = "../network"
# for_each = var.routed_networks
for_each = var.networks
# project_id = var.project_id
# name = each.value.name
project_id = var.project_id
name = each.value.name
# ipv4_nameservers = each.value.ipv4_nameservers
# labels = each.value.labels
ipv4_nameservers = each.value.ipv4_nameservers
labels = each.value.labels
# static_ipv4 = each.value.static_ipv4
# nic_name = each.value.nic_name
# nic_allowed_addresses = each.value.nic_allowed_addresses
# nic_labels = each.value.nic_labels
# nic_security = each.value.nic_security
# nic_security_group_ids = each.value.nic_security_group_ids
# }
nic_ipv4 = each.value.nic_ipv4
nic_name = each.value.nic_name
nic_allowed_addresses = each.value.nic_allowed_addresses
nic_labels = each.value.nic_labels
nic_security = each.value.nic_security
nic_security_group_ids = each.value.nic_security_group_ids
}
# module "ske" {
# source = "../ske"
module "ske" {
source = "../ske"
# for_each = var.ske_clusters
for_each = var.ske_clusters
# project_id = var.project_id
# name = each.value.name
# kubernetes_version_min = each.value.kubernetes_version_min
# node_pools = each.value.node_pools
# }
project_id = var.project_id
name = each.value.name
kubernetes_version_min = each.value.kubernetes_version_min
node_pools = each.value.node_pools
}
# module "observability" {
# source = "../observability"
module "observability" {
source = "../observability"
# for_each = var.observability_instances
# project_id = var.project_id
# name = each.value.name
# plan_name = each.value.plan_name
# }
for_each = var.observability_instances
project_id = var.project_id
name = each.value.name
plan_name = each.value.plan_name
}

View file

@ -9,7 +9,8 @@ terraform {
}
provider "stackit" {
default_region = var.region
service_account_token = var.service_account_token
enable_beta_resources = true
}
default_region = var.region
service_account_token = var.service_account_token != "" ? var.service_account_token : null
service_account_key_path = var.service_account_key_path != "" ? var.service_account_key_path : null
enable_beta_resources = true
}

View file

@ -1,6 +1,7 @@
region = "eu01"
service_account_token = ""
project_id = ""
# project_id = "b25685da-5954-4382-b654-62abd9f0ef77"
service_account_key_path = "/Users/schlenz/sa-key-dd5fa2c9-1651-4da7-8404-9ac4fe9bc3d5.json"
security_groups = {
ssh_ingress_group = {
@ -52,7 +53,6 @@ security_groups = {
},
]
},
}
postgres_instances = {
@ -89,7 +89,7 @@ postgres_instances = {
}
}
routed_networks = {
networks = {
web = {
name = "web-net"
ipv4_nameservers = ["1.1.1.1", "8.8.8.8"]
@ -100,7 +100,7 @@ routed_networks = {
db = {
name = "db-net"
static_ipv4 = "10.0.2.120"
nic_ipv4 = "10.0.2.120"
nic_security = false
}
}

View file

@ -15,6 +15,11 @@ variable "service_account_token" {
type = string
}
variable "service_account_key_path" {
type = string
default = ""
}
variable "security_groups" {
type = map(object({
name = optional(string)
@ -61,14 +66,14 @@ variable "postgres_instances" {
}))
}
variable "routed_networks" {
variable "networks" {
type = map(object({
name = string
ipv4_nameservers = optional(list(string))
labels = optional(map(string))
static_ipv4 = optional(string)
nic_ipv4 = optional(string)
nic_name = optional(string)
nic_allowed_addresses = optional(list(string))

View file

@ -1,18 +0,0 @@
output "network_id" {
description = "Network ID"
value = stackit_network.this.network_id
}
output "network_name" {
description = "Network name"
value = stackit_network.this.name
}
output "network_interface_id" {
description = "NIC ID"
value = try(stackit_network_interface.static[0].network_interface_id, null)
}
output "nic_ipv4_list" {
value = try(stackit_network_interface.static[*].ipv4, null)
}

View file

@ -1,3 +1,4 @@
terraform {
required_version = ">= 1.9.0"
required_providers {
@ -6,4 +7,4 @@ terraform {
version = "0.56.0"
}
}
}
}