From 35018f8ddc0123d186f626a3d9e755a49968ccce Mon Sep 17 00:00:00 2001 From: Hugo Tiburtino <45924645+hugotiburtino@users.noreply.github.com> Date: Wed, 4 Sep 2024 00:40:31 +0200 Subject: [PATCH] refactor: reorganize and use public lan for server --- envs/ionos-test/basic_datacenter.tf | 46 +++++++++++++---------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/envs/ionos-test/basic_datacenter.tf b/envs/ionos-test/basic_datacenter.tf index b02f16b..3bff222 100644 --- a/envs/ionos-test/basic_datacenter.tf +++ b/envs/ionos-test/basic_datacenter.tf @@ -1,26 +1,30 @@ +resource "ionoscloud_ipblock" "serlo_ipblock" { + location = ionoscloud_datacenter.serlo_datacenter.location + size = 1 + name = "serlo_ipblock" +} + +resource "ionoscloud_nic" "public_nic" { + server_id = ionoscloud_server.lti_tool_server.id + datacenter_id = ionoscloud_datacenter.serlo_datacenter.id + lan = ionoscloud_lan.serlo_uplink.id + name = "nic_public" + dhcp = true + firewall_active = false + ips = [ionoscloud_ipblock.serlo_ipblock.ips[0]] +} + resource "ionoscloud_datacenter" "serlo_datacenter" { name = "serlo_datacenter" location = "de/txl" } -resource "ionoscloud_lan" "serlo_lan" { - datacenter_id = ionoscloud_datacenter.serlo_datacenter.id - public = false - name = "serlo_lan" -} - resource "ionoscloud_lan" "serlo_uplink" { datacenter_id = ionoscloud_datacenter.serlo_datacenter.id public = true name = "serlo_uplink" } -resource "ionoscloud_ipblock" "serlo_ipblock" { - location = ionoscloud_datacenter.serlo_datacenter.location - size = 1 - name = "serlo_ipblock" -} - data "ionoscloud_image" "lti_tool" { type = "HDD" cloud_init = "V1" @@ -42,27 +46,19 @@ resource "ionoscloud_server" "lti_tool_server" { disk_type = "SSD Standard" } nic { - lan = ionoscloud_lan.serlo_lan.id + lan = ionoscloud_lan.serlo_uplink.id name = "system" dhcp = true } } -resource "ionoscloud_nic" "public_nic" { - server_id = ionoscloud_server.lti_tool_server.id - datacenter_id = ionoscloud_datacenter.serlo_datacenter.id - lan = ionoscloud_lan.serlo_uplink.id - name = "nic_public" - dhcp = true - firewall_active = false - ips = [ionoscloud_ipblock.serlo_ipblock.ips[0]] +resource "ionoscloud_lan" "serlo_lan" { + datacenter_id = ionoscloud_datacenter.serlo_datacenter.id + public = false + name = "serlo_lan" } resource "ionoscloud_mongo_cluster" "serlo_mongo_cluster" { - maintenance_window { - day_of_the_week = "Sunday" - time = "09:00:00" - } mongodb_version = "5.0" instances = 1 display_name = "serlo_mongo_cluster"