diff --git a/example/main.tf b/example/main.tf index 2d2fc0b..8ca31ba 100644 --- a/example/main.tf +++ b/example/main.tf @@ -7,4 +7,60 @@ module "security_groups" { name = each.value.name description = each.value.description rules = each.value.rules -} \ No newline at end of file +} + +# module "postgres" { +# source = "../postgres" + +# 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 +# } + +# module "net" { +# source = "../network" + +# for_each = var.routed_networks + +# project_id = var.project_id +# name = each.value.name + +# 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 +# } + +# module "ske" { +# source = "../ske" + +# 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 +# } + +# module "observability" { +# source = "../observability" + +# for_each = var.observability_instances +# project_id = var.project_id +# name = each.value.name +# plan_name = each.value.plan_name +# } diff --git a/example/terraform.tfvars b/example/terraform.tfvars index 584af52..70d2beb 100644 --- a/example/terraform.tfvars +++ b/example/terraform.tfvars @@ -7,8 +7,7 @@ security_groups = { name = "ssh-ingress-group" description = "ALLOW SSH ingress" rules = [ - { - description = "SSH RULE 1" + { description = "SSH RULE 1" direction = "ingress" ether_type = "IPv4" ip_range = "0.0.0.0/0" @@ -27,8 +26,7 @@ security_groups = { name = "web-traffic-group" description = "ALLOW WEB TRAFFIC ingress" rules = [ - { - description = "ALLOW ALL 80" + { description = "ALLOW ALL 80" direction = "ingress" ether_type = "IPv4" ip_range = "0.0.0.0/0" @@ -40,8 +38,7 @@ security_groups = { max = 80 } }, - { - description = "ALLOW ALL 443" + { description = "ALLOW ALL 443" direction = "ingress" ether_type = "IPv4" ip_range = "0.0.0.0/0" @@ -56,4 +53,96 @@ security_groups = { ] }, -} \ No newline at end of file +} + +postgres_instances = { + dev = { + name = "pg-test-instance" + version = 17 + flavor = { + cpu = 2, + ram = 4 + } + storage = { + class = "premium-perf6-stackit", + size = 20 + } + replicas = 1 + acl = ["0.0.0.0/0"] + backup_schedule = "00 00 * * *" + + users = [ + { username = "admin", + roles = ["login", "createdb"] + }, + { username = "testusr", + roles = ["login"] + } + ] + + databases = [ + { + name = "test_db", + owner = "admin" + } + ] + } +} + +routed_networks = { + web = { + name = "web-net" + ipv4_nameservers = ["1.1.1.1", "8.8.8.8"] + labels = { + env = "prod" + } + } + + db = { + name = "db-net" + static_ipv4 = "10.0.2.120" + nic_security = false + } +} + +ske_clusters = { + dev = { + name = "dev-cluster" + kubernetes_version_min = "1.31" + node_pools = [ + { name = "default" + machine_type = "c2.1" + availability_zones = ["eu01-1", "eu01-2"] + volume_size = 40 + minimum = 1 + maximum = 3 + } + ] + } + + staging = { + name = "staging-cluster" + kubernetes_version_min = "1.31" + node_pools = [ + { name = "general" + machine_type = "c2.2" + availability_zones = ["eu03-1", "eu03-2"] + volume_size = 80 + minimum = 2 + maximum = 4 + } + ] + } +} + +observability_instances = { + starter = { + name = "Observability-1" + plan_name = "Observability-Starter-EU01" + } + + prod = { + name = "Observability-2" + plan_name = "Observability-Large-EU01" + } +} diff --git a/example/variables.tf b/example/variables.tf index 918e44e..2752f35 100644 --- a/example/variables.tf +++ b/example/variables.tf @@ -15,7 +15,6 @@ variable "service_account_token" { type = string } - variable "security_groups" { type = map(object({ name = optional(string) @@ -41,3 +40,62 @@ variable "security_groups" { })) })) } + +variable "postgres_instances" { + type = map(object({ + name = string + version = number + flavor = object({ cpu = number, ram = number }) + storage = object({ class = string, size = number }) + replicas = number + acl = list(string) + backup_schedule = string + users = list(object({ + username = string + roles = set(string) + })) + databases = list(object({ + name = string + owner = string + })) + })) +} + +variable "routed_networks" { + type = map(object({ + name = string + + ipv4_nameservers = optional(list(string)) + labels = optional(map(string)) + + static_ipv4 = optional(string) + nic_name = optional(string) + + nic_allowed_addresses = optional(list(string)) + nic_labels = optional(map(string)) + nic_security = optional(bool) + nic_security_group_ids = optional(list(string)) + })) +} + +variable "ske_clusters" { + type = map(object({ + name = string + kubernetes_version_min = string + node_pools = list(object({ + name = string + machine_type = string + availability_zones = list(string) + volume_size = number + minimum = number + maximum = number + })) + })) +} + +variable "observability_instances" { + type = map(object({ + name = string + plan_name = string + })) +}