Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to remove public IP from existing instance #286

Open
1 task done
ppawlowski opened this issue Dec 3, 2023 · 0 comments
Open
1 task done

Unable to remove public IP from existing instance #286

ppawlowski opened this issue Dec 3, 2023 · 0 comments
Labels

Comments

@ppawlowski
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Greenfield/Brownfield provisioning

brownfield

Terraform Version

1.3.10

Module Version

5.2.0

AzureRM Provider Version

v3.83.0

Affected Resource(s)/Data Source(s)

azurerm_network_interface

Terraform Configuration Files

data "azurerm_resource_group" "myrg" {
  name = "my-rg"
}

module "myvnet" {
  source  = "Azure/vnet/azurerm"
  version = "2.5.0"

  vnet_name           = "my-vnet"
  resource_group_name = data.azurerm_resource_group.myrg.name
  address_space       = [
    "172.23.0.0/28",
    "192.168.104.104/29",
    "192.168.105.8/29"]
  subnet_prefixes     = [
    "172.23.0.0/28",
    "192.168.104.104/29",
    "192.168.105.8/29"]
  subnet_names        = [
    "GatewaySubnet",
    "subnet1",
    "subnet2"]

  depends_on = [data.azurerm_resource_group.myrg]
}

module "myvm" {
  source  = "Azure/compute/azurerm"
  version = "5.2.0"

  resource_group_name           = data.azurerm_resource_group.myrg.name
  location                      = data.azurerm_resource_group.myrg.location
  vnet_subnet_id                = module.myvnet.vnet_subnets[1]
  nb_instances                  = 1
  nb_public_ip                  = 0
  vm_os_simple                  = "UbuntuServer"
  vm_hostname                   = "myVmHostname"
  admin_username                = "adminusername"
  enable_ssh_key                = true
  ssh_key                       = ""
  ssh_key_values                = [###EDITED###]
  remote_port                   = "22"
  storage_account_type          = "Standard_LRS"
  vm_size                       = "Standard_B1ms"
  delete_os_disk_on_termination = true
  identity_type                 = "SystemAssigned"

  depends_on = [
    data.azurerm_resource_group.myrg,
    module.myvnet
  ]
}

tfvars variables values

not used

Debug Output/Panic Output

│ Error: parsing "" as an PublicIpAddress ID: parsing Azure ID: parse "": empty url
│
│   with module.myvm.azurerm_network_interface.vm[0],
│   on .terraform/modules/myvm/main.tf line 446, in resource "azurerm_network_interface" "vm":
│  446:     public_ip_address_id = length(azurerm_public_ip.vm[*].id) > 0 ? element(concat(azurerm_public_ip.vm[*].id, tolist([
│  447:       ""
│  448:     ])), count.index) : ""

Expected Behaviour

Public IP address should be removed from existing VM

Actual Behaviour

Terraform fails with above described error. There is no possibility to have a VM instance without public IP address.

Steps to Reproduce

  1. terraform plan
  2. terraform apply

Important Factoids

No response

References

No response

@ppawlowski ppawlowski added the bug label Dec 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

No branches or pull requests

1 participant