diff --git a/example/main.tf b/example/main.tf index 8ca31ba..c43cdf9 100644 --- a/example/main.tf +++ b/example/main.tf @@ -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 +} diff --git a/example/providers.tf b/example/providers.tf index e5cfc8d..04db4e1 100644 --- a/example/providers.tf +++ b/example/providers.tf @@ -9,7 +9,8 @@ terraform { } provider "stackit" { - default_region = var.region - service_account_token = var.service_account_token - enable_beta_resources = true -} \ No newline at end of file + 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 +} diff --git a/example/terraform.tfvars b/example/terraform.tfvars index 70d2beb..c5ac554 100644 --- a/example/terraform.tfvars +++ b/example/terraform.tfvars @@ -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 } } diff --git a/example/variables.tf b/example/variables.tf index 2752f35..4c9ea43 100644 --- a/example/variables.tf +++ b/example/variables.tf @@ -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)) diff --git a/network/output.tf b/network/output.tf deleted file mode 100644 index ddf472c..0000000 --- a/network/output.tf +++ /dev/null @@ -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) -} diff --git a/network/providers.tf b/network/providers.tf index dd742e3..8962cf6 100644 --- a/network/providers.tf +++ b/network/providers.tf @@ -1,3 +1,4 @@ + terraform { required_version = ">= 1.9.0" required_providers { @@ -6,4 +7,4 @@ terraform { version = "0.56.0" } } -} \ No newline at end of file +}