diff --git a/modules/landing-zone/3-network.tf b/modules/landing-zone/3-network.tf index 6ace280..d0aec6e 100644 --- a/modules/landing-zone/3-network.tf +++ b/modules/landing-zone/3-network.tf @@ -1,12 +1,48 @@ ############# -## NETWORK ## +## ROUTING ## ############# +resource "stackit_routing_table" "this" { + count = var.network_area_id != null ? 1 : 0 + organization_id = var.organization_id + network_area_id = var.network_area_id + name = var.naming_pattern + system_routes = false + + labels = local.labels +} + +resource "stackit_routing_table_route" "this" { + count = var.network_area_id != null ? 1 : 0 + routing_table_id = stackit_routing_table.this[0].routing_table_id + + organization_id = var.organization_id + network_area_id = var.network_area_id + + destination = { + type = "cidrv4" + value = "0.0.0.0/0" + } + + next_hop = { + type = "ipv4" + value = var.firewall_next_hop_ip + } + labels = local.labels +} + +############# +## NETWORK ## +############# resource "stackit_network" "this" { - count = var.network_area_id != null ? 1 : 0 + count = var.network_area_id != null ? 1 : 0 + project_id = stackit_resourcemanager_project.this.project_id - project_id = stackit_resourcemanager_project.this.project_id name = "${var.naming_pattern}-routed" ipv4_prefix_length = var.network_prefix_length routed = true -} \ No newline at end of file + ipv4_nameservers = var.ipv4_nameservers + routing_table_id = stackit_routing_table.this[0].routing_table_id + + labels = local.labels +} diff --git a/modules/landing-zone/variables.tf b/modules/landing-zone/variables.tf index 1f52b6b..30d04df 100644 --- a/modules/landing-zone/variables.tf +++ b/modules/landing-zone/variables.tf @@ -1,3 +1,8 @@ +variable "organization_id" { + type = string + description = "Container ID of the root organization." +} + variable "custom_roles" { type = list(object({ name = string @@ -53,4 +58,16 @@ variable "role_assignments" { })) description = "List of role assignments for the project. Subject can be a user email or service account email." default = [] +} + +variable "firewall_next_hop_ip" { + type = string + description = "IP address of the firewall next hop." + default = null +} + +variable "ipv4_nameservers" { + type = list(string) + description = "List of IPv4 nameservers for the network." + default = null } \ No newline at end of file