hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.6k stars 4.65k forks source link

Snapshot_directory_visible - Setting is not updated #27991

Open JoseGuerreroYepez opened 5 days ago

JoseGuerreroYepez commented 5 days ago

Is there an existing issue for this?

Community Note

Terraform Version

1.9.8

AzureRM Provider Version

4.9.0

Affected Resource(s)/Data Source(s)

azurerm_netapp_volume

Terraform Configuration Files

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "4.9.0"
    }
  }
}

provider "azurerm" {
  subscription_id = "1ed607e8-8cda-4dfe-a047-884a93d51ecd"
  features {
  }
}

resource "azurerm_resource_group" "example" {
  name     = "example-rg"
  location = "East US"
}

# Define the Azure NetApp Files Account
resource "azurerm_netapp_account" "example" {
  name                = "example-netapp-account"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
}

# Define the Capacity Pool
resource "azurerm_netapp_pool" "example" {
  name                 = "example-capacity-pool"
  location             = azurerm_resource_group.example.location
  resource_group_name  = azurerm_resource_group.example.name
  account_name         = azurerm_netapp_account.example.name
  service_level        = "Standard"      # Options: "Premium", "Standard", "Ultra"
  size_in_tb           = 2              # Capacity pool size in TB (minimum 4)
}

# Define the NetApp Volume
resource "azurerm_netapp_volume" "example" {
  name                 = "example-volume"
  location             = azurerm_resource_group.example.location
  resource_group_name  = azurerm_resource_group.example.name
  account_name         = azurerm_netapp_account.example.name
  pool_name            = azurerm_netapp_pool.example.name
  volume_path          = "example-volume-path"
  storage_quota_in_gb = 100
  service_level =   "Standard"
  snapshot_directory_visible = true
    network_features = "Standard" 

  subnet_id            = azurerm_subnet.example.id
}

resource "azurerm_virtual_network" "example" {
  name                = "example-vnet"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  address_space       = ["10.0.0.0/16"]
}

resource "azurerm_subnet" "example" {
  name                 = "example-subnet"
  resource_group_name  = azurerm_resource_group.example.name
  virtual_network_name = azurerm_virtual_network.example.name
  address_prefixes     = ["10.0.1.0/24"]
  delegation {
    name = "netapp_delegation"
    service_delegation {
      name = "Microsoft.Netapp/volumes"
      actions = ["Microsoft.Network/virtualNetworks/subnets/join/action"]
    }
  }
}

Debug Output/Panic Output

Debug Log:
https://gist.github.com/JoseGuerreroYepez/0dcf6c34b7de0058e3c3623024aceb08

Expected Behaviour

Snapshot_directory_visible should update from true to false.

Actual Behaviour

Update is not being done and next apply is also marked as changes from true to flase

Steps to Reproduce

  1. Terraform apply
  2. change snapshot_directory_visible to false
  3. terraform apply

Important Factoids

No response

References

https://github.com/hashicorp/terraform-provider-azurerm/blob/e134819f4f0318c15b69c813ac826a04a33dc42e/internal/services/netapp/netapp_volume_resource.go#L605

We think here is a if block missing for snapshot_directory_visible

neil-yechenwei commented 2 days ago

Thanks for raising this issue. Seems this is a Service API regression issue since service team confirmed that it is able to be updated before. So I filed an issue on https://github.com/Azure/azure-rest-api-specs/issues/31560 for tracking.