tflint, cleanup, description of vars

This commit is contained in:
Maximilian_Schlenz 2025-07-17 11:33:42 +02:00
parent b4e80ed22e
commit df457fe625
8 changed files with 276 additions and 264 deletions

View file

@ -1,15 +1,9 @@
variable "region" {
description = "Region for the STACKIT Cloud"
description = "Provider region for STACKIT Cloud"
type = string
default = "eu01"
}
variable "project_id" {
description = "STACKIT Cloud project ID"
type = string
default = null
}
variable "service_account_token" {
description = "Service account token for authentication"
sensitive = true
@ -17,40 +11,44 @@ variable "service_account_token" {
default = null
}
# SNA & Projects variables
# -----------------------------------------------------------------------------#
# SNA & Projects
# -----------------------------------------------------------------------------#
variable "organization_id" {
description = "Die Container-ID deiner STACKIT Organisation."
description = "STACKIT organization container ID"
type = string
}
variable "service_account_key_path" {
description = "Path to service account JSON key"
type = string
default = "/home/hahnjan/.stackit/sa.json"
default = "/Users/schlenz/.stackit/sa.json"
}
variable "default_region" {
type = string
default = "eu01"
description = "Default region fallback for created resources"
type = string
default = "eu01"
}
variable "SNA_name" {
description = "Name der zu erstellenden Service Network Area."
description = "Name of the Service Network Area to create"
type = string
}
variable "SNA_network_ranges" {
description = "Liste der Netzwerk-CIDRs für die SNA."
description = "CIDR list for the Service Network Area"
type = list(object({ prefix = string }))
}
variable "SNA_transfer_network" {
description = "Das Transfer-Netzwerk für die SNA (z.B. 172.16.9.0/24)."
description = "Transfer network CIDR for the SNA"
type = string
}
variable "Projects_map" {
description = "Eine Map von Projekten, die erstellt werden sollen."
description = "Map of STACKIT projects to create"
type = map(object({
name = string
owner_email = string
@ -58,11 +56,17 @@ variable "Projects_map" {
}
variable "labels" {
type = map(string)
default = {}
description = "Default labels to apply where supported"
type = map(string)
default = {}
}
# -----------------------------------------------------------------------------#
# Security Groups
# -----------------------------------------------------------------------------#
variable "security_groups" {
description = "Map of security group definitions"
type = map(object({
name = optional(string)
project_key = string
@ -89,15 +93,20 @@ variable "security_groups" {
}))
}
# -----------------------------------------------------------------------------#
# PostgreSQL
# -----------------------------------------------------------------------------#
variable "postgres_instances" {
description = "Map of PostgreSQL instances to create"
type = map(object({
name = string
name = string
project_key = string
version = number
flavor = object({ cpu = number, ram = number })
storage = object({ class = string, size = number })
replicas = number
acl = list(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
@ -110,18 +119,23 @@ variable "postgres_instances" {
}))
}
# Network definition map
# -----------------------------------------------------------------------------#
# Networks
# -----------------------------------------------------------------------------#
variable "networks" {
description = "Map of network definitions per project"
type = map(object({
name = string
name = string
project_key = string
# IPv4 settings
# IPv4
ipv4_gateway = optional(string)
ipv4_nameservers = optional(list(string))
ipv4_prefix = optional(string)
ipv4_prefix_length = optional(number)
# IPv6 settings
# IPv6
ipv6_gateway = optional(string)
ipv6_nameservers = optional(list(string))
ipv6_prefix = optional(string)
@ -133,7 +147,7 @@ variable "networks" {
no_ipv6_gateway = optional(bool)
routed = optional(bool)
# NIC-specific options
# NICs
nics = optional(map(object({
nic_ipv4 = optional(string)
nic_name = string
@ -144,16 +158,18 @@ variable "networks" {
nic_security_group_names = optional(list(string))
})))
}))
default = {}
}
variable "ske_clusters" {
description = "Eine Map von SKE-Clustern"
type = map(object({
# -----------------------------------------------------------------------------#
# SKE Clusters
# -----------------------------------------------------------------------------#
name = string
project_key = string
variable "ske_clusters" {
description = "Map of SKE cluster definitions"
type = map(object({
name = string
project_key = string
kubernetes_version_min = optional(string)
hibernations = optional(list(object({
start = string
@ -161,10 +177,10 @@ variable "ske_clusters" {
timezone = optional(string)
})))
maintenance = optional(object({
enable_kubernetes_version_updates = bool
enable_kubernetes_version_updates = bool
enable_machine_image_version_updates = bool
start = string
end = string
start = string
end = string
}))
extensions = optional(object({
acl = optional(object({
@ -178,7 +194,6 @@ variable "ske_clusters" {
}))
node_pools = list(object({
name = string
machine_type = string
availability_zones = list(string)
@ -204,15 +219,18 @@ variable "ske_clusters" {
default = {}
}
# -----------------------------------------------------------------------------#
# Observability
# -----------------------------------------------------------------------------#
variable "observability_instances" {
description = "Map of Observability instances to create"
type = map(object({
# Required
name = string
name = string
project_key = string
plan_name = string
plan_name = string
# Optional instance settings
# Instance settings
acl = optional(list(string))
metrics_retention_days = optional(number)
metrics_retention_days_5m_downsampling = optional(number)
@ -220,11 +238,11 @@ variable "observability_instances" {
alert_config = optional(any)
parameters = optional(map(string))
# Control credential creation
# Credentials
create_credentials = optional(bool, true)
credentials_count = optional(number, 1)
# alert-groups
# Alert-groups
alertgroups = optional(map(object({
name = string
interval = optional(string)
@ -237,7 +255,7 @@ variable "observability_instances" {
}))
})), {})
# log-alert-groups
# Log-alert-groups
logalertgroups = optional(map(object({
name = string
interval = optional(string)
@ -250,7 +268,7 @@ variable "observability_instances" {
}))
})), {})
# scrape-configs
# Scrape-configs
scrapeconfigs = optional(map(object({
name = string
metrics_path = string
@ -272,6 +290,7 @@ variable "observability_instances" {
})), {})
}))
default = {}
validation {
condition = alltrue([
for k, v in var.observability_instances :
@ -292,7 +311,7 @@ variable "observability_instances" {
])
error_message = <<-EOM
One or more observability_instances specify an invalid plan_name.
See the provider error output for the list of supported plans. Allowed values:
See the provider error output for supported plans. Allowed:
Observability-Medium-EU01
Observability-Monitoring-XL-EU01
Observability-Large-EU01