From 577cb1815bd89818f1d38c77e9847f244ad0594c Mon Sep 17 00:00:00 2001 From: Jihad Abu Dabat Date: Thu, 1 Aug 2024 11:08:41 +0000 Subject: [PATCH] added dhcp variable & updated the lan name --- modules/ionos-lan-and-firewall/main.tf | 5 ++--- modules/ionos-lan-and-firewall/variables.tf | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/ionos-lan-and-firewall/main.tf b/modules/ionos-lan-and-firewall/main.tf index 1b1c1e4..1874dcc 100644 --- a/modules/ionos-lan-and-firewall/main.tf +++ b/modules/ionos-lan-and-firewall/main.tf @@ -2,17 +2,16 @@ resource "ionoscloud_lan" "lan" { datacenter_id = var.datacenter_id public = var.is_public - name = format( "%s-%s",var.name,"intern-connection-lan") + name = format( "%s-%s-%x",var.name,var.is_public? "public":"private","-connection-lan") } # Create a NIC for the basic VM and connect it to the LAN resource "ionoscloud_nic" "nic" { datacenter_id = var.datacenter_id server_id = var.server_id - dhcp = true + dhcp = var.dhcp_enabled lan = ionoscloud_lan.lan.id firewall_active = true - } # Add The Ports The VM diff --git a/modules/ionos-lan-and-firewall/variables.tf b/modules/ionos-lan-and-firewall/variables.tf index 8b886ca..4795bf4 100644 --- a/modules/ionos-lan-and-firewall/variables.tf +++ b/modules/ionos-lan-and-firewall/variables.tf @@ -22,4 +22,10 @@ variable "is_public" { description = "The Type of lan is public (true) or private (false)" type = bool default = false +} + +variable "dhcp_enabled" { + description = "The DHCP is used (true) or not (false)" + type = bool + default = true } \ No newline at end of file