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 rules = each.value.rules
} }
# module "postgres" { module "postgres" {
# source = "../postgres" source = "../postgres"
# for_each = var.postgres_instances for_each = var.postgres_instances
# project_id = var.project_id project_id = var.project_id
# name = each.value.name name = each.value.name
# ver = each.value.version ver = each.value.version
# flavor = each.value.flavor flavor = each.value.flavor
# storage = each.value.storage storage = each.value.storage
# replicas = each.value.replicas replicas = each.value.replicas
# acl = each.value.acl acl = each.value.acl
# backup_schedule = each.value.backup_schedule backup_schedule = each.value.backup_schedule
# users = each.value.users users = each.value.users
# databases = each.value.databases databases = each.value.databases
# } }
# module "net" { module "net" {
# source = "../network" source = "../network"
# for_each = var.routed_networks for_each = var.networks
# project_id = var.project_id project_id = var.project_id
# name = each.value.name name = each.value.name
# ipv4_nameservers = each.value.ipv4_nameservers ipv4_nameservers = each.value.ipv4_nameservers
# labels = each.value.labels labels = each.value.labels
# static_ipv4 = each.value.static_ipv4 nic_ipv4 = each.value.nic_ipv4
# nic_name = each.value.nic_name nic_name = each.value.nic_name
# nic_allowed_addresses = each.value.nic_allowed_addresses nic_allowed_addresses = each.value.nic_allowed_addresses
# nic_labels = each.value.nic_labels nic_labels = each.value.nic_labels
# nic_security = each.value.nic_security nic_security = each.value.nic_security
# nic_security_group_ids = each.value.nic_security_group_ids nic_security_group_ids = each.value.nic_security_group_ids
# } }
# module "ske" { module "ske" {
# source = "../ske" source = "../ske"
# for_each = var.ske_clusters for_each = var.ske_clusters
# project_id = var.project_id project_id = var.project_id
# name = each.value.name name = each.value.name
# kubernetes_version_min = each.value.kubernetes_version_min kubernetes_version_min = each.value.kubernetes_version_min
# node_pools = each.value.node_pools node_pools = each.value.node_pools
# } }
# module "observability" { module "observability" {
# source = "../observability" source = "../observability"
# for_each = var.observability_instances for_each = var.observability_instances
# project_id = var.project_id project_id = var.project_id
# name = each.value.name name = each.value.name
# plan_name = each.value.plan_name plan_name = each.value.plan_name
# } }

View file

@ -10,6 +10,7 @@ terraform {
provider "stackit" { provider "stackit" {
default_region = var.region default_region = var.region
service_account_token = var.service_account_token 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 enable_beta_resources = true
} }

View file

@ -1,6 +1,7 @@
region = "eu01" region = "eu01"
service_account_token = "" 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 = { security_groups = {
ssh_ingress_group = { ssh_ingress_group = {
@ -52,7 +53,6 @@ security_groups = {
}, },
] ]
}, },
} }
postgres_instances = { postgres_instances = {
@ -89,7 +89,7 @@ postgres_instances = {
} }
} }
routed_networks = { networks = {
web = { web = {
name = "web-net" name = "web-net"
ipv4_nameservers = ["1.1.1.1", "8.8.8.8"] ipv4_nameservers = ["1.1.1.1", "8.8.8.8"]
@ -100,7 +100,7 @@ routed_networks = {
db = { db = {
name = "db-net" name = "db-net"
static_ipv4 = "10.0.2.120" nic_ipv4 = "10.0.2.120"
nic_security = false nic_security = false
} }
} }

View file

@ -15,6 +15,11 @@ variable "service_account_token" {
type = string type = string
} }
variable "service_account_key_path" {
type = string
default = ""
}
variable "security_groups" { variable "security_groups" {
type = map(object({ type = map(object({
name = optional(string) name = optional(string)
@ -61,14 +66,14 @@ variable "postgres_instances" {
})) }))
} }
variable "routed_networks" { variable "networks" {
type = map(object({ type = map(object({
name = string name = string
ipv4_nameservers = optional(list(string)) ipv4_nameservers = optional(list(string))
labels = optional(map(string)) labels = optional(map(string))
static_ipv4 = optional(string) nic_ipv4 = optional(string)
nic_name = optional(string) nic_name = optional(string)
nic_allowed_addresses = optional(list(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 { terraform {
required_version = ">= 1.9.0" required_version = ">= 1.9.0"
required_providers { required_providers {