Azure / terraform-azurerm-virtual-machine

Terraform Azure RM Virtual Machine Module
MIT License
35 stars 36 forks source link

`enable_accelerated_networking` will be deprecated in AzureRM 4.X #73

Open iambaim opened 1 month ago

iambaim commented 1 month ago

Is there an existing issue for this?

Greenfield/Brownfield provisioning

greenfield

Terraform Version

1.8.5

Module Version

1.1.0

AzureRM Provider Version

3.108.0

Affected Resource(s)/Data Source(s)

azurerm_network_interface

Terraform Configuration Files

resource "random_id" "id" {
  byte_length = 2
}

resource "azurerm_resource_group" "rg" {
  count = var.create_resource_group ? 1 : 0

  location = var.location
  name     = coalesce(var.resource_group_name, "tf-vmmod-basic-${random_id.id.hex}")
}

locals {
  resource_group = {
    name     = try(azurerm_resource_group.rg[0].name, var.resource_group_name)
    location = var.location
  }
}

module "vnet" {
  source  = "Azure/vnet/azurerm"
  version = "4.0.0"

  resource_group_name = local.resource_group.name
  use_for_each        = true
  vnet_location       = local.resource_group.location
  address_space       = ["192.168.0.0/24"]
  vnet_name           = "vnet-vm-${random_id.id.hex}"
  subnet_names        = ["subnet-virtual-machine"]
  subnet_prefixes     = ["192.168.0.0/28"]
}

resource "tls_private_key" "ssh" {
  algorithm = "RSA"
  rsa_bits  = "4096"
}

resource "azurerm_public_ip" "pip" {
  count = var.create_public_ip ? 2 : 0

  allocation_method   = "Dynamic"
  location            = local.resource_group.location
  name                = "pip-${random_id.id.hex}-${count.index}"
  resource_group_name = local.resource_group.name
}

module "linux" {
  source = "../.."

  location                   = local.resource_group.location
  image_os                   = "linux"
  resource_group_name        = local.resource_group.name
  allow_extension_operations = false
  data_disks = [
    for i in range(2) : {
      name                 = "linuxdisk${random_id.id.hex}${i}"
      storage_account_type = "Standard_LRS"
      create_option        = "Empty"
      disk_size_gb         = 1
      attach_setting = {
        lun     = i
        caching = "ReadWrite"
      }
    }
  ]
  new_network_interface = {
    ip_forwarding_enabled = false
    ip_configurations = [
      {
        primary = true
      }
    ]
    accelerated_networking_enabled = true
  }
  admin_username = "azureuser"
  admin_ssh_keys = [
    {
      public_key = tls_private_key.ssh.public_key_openssh
    }
  ]
  name = "ubuntu-${random_id.id.hex}"
  os_disk = {
    caching              = "ReadWrite"
    storage_account_type = "Standard_LRS"
  }
  os_simple = "UbuntuServer"
  size      = var.size
  subnet_id = module.vnet.vnet_subnets[0]
}

tfvars variables values

variable "create_public_ip" {
  type     = bool
  default  = false
  nullable = false
}

variable "create_resource_group" {
  type     = bool
  default  = true
  nullable = false
}

variable "location" {
  type     = string
  default  = "eastus"
  nullable = false
}

variable "managed_identity_principal_id" {
  type    = string
  default = null
}

variable "my_public_ip" {
  type    = string
  default = null
}

variable "resource_group_name" {
  type    = string
  default = null
}

variable "size" {
  type     = string
  default  = "Standard_F2"
  nullable = false
}

Debug Output/Panic Output

│ Warning: Argument is deprecated
│ 
│   with module.ftm_infra_vm.azurerm_network_interface.vm[0],
│   on .terraform/modules/ftm_infra_vm/main.tf line 552, in resource "azurerm_network_interface" "vm":
│  552:   enable_accelerated_networking = var.new_network_interface.accelerated_networking_enabled
│ 
│ The property `enable_accelerated_networking` has been superseded by
│ `accelerated_networking_enabled` and will be removed in v4.0 of the AzureRM
│ Provider.
│ 
│ (and 3 more similar warnings elsewhere)
╵

Expected Behaviour

No response

Actual Behaviour

No response

Steps to Reproduce

No response

Important Factoids

No response

References

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/network_interface

cuntoulishifu commented 4 weeks ago

run into the same issue, any updates?