Skip to content

Commit

Permalink
refactor: reorganize and use public lan for server
Browse files Browse the repository at this point in the history
  • Loading branch information
hugotiburtino committed Sep 3, 2024
1 parent 8ae2d58 commit 35018f8
Showing 1 changed file with 21 additions and 25 deletions.
46 changes: 21 additions & 25 deletions envs/ionos-test/basic_datacenter.tf
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit 35018f8

Please sign in to comment.