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.59k stars 4.63k forks source link

azurerm_resource_management_private_link refresh can not unmarshal ResourceManagementPrivateLinkEndpointConnections.properties.privateEndpointConnections #26670

Open atombravo opened 3 months ago

atombravo commented 3 months ago

Is there an existing issue for this?

Community Note

Terraform Version

0.13.7

AzureRM Provider Version

3.112.0

Affected Resource(s)/Data Source(s)

azurerm_resource_management_private_link

Terraform Configuration Files

resource "azurerm_resource_group" "management_privatelink" {
  name     = "management_privatelink"
  location = var.location
}

resource "azurerm_resource_management_private_link" "management_privatelink" {
  name                = "management_privatelink"
  resource_group_name = azurerm_resource_group.management_privatelink.name
  location            = azurerm_resource_group.management_privatelink.location
}

resource "random_uuid" "management_privatelink" {
}

resource "azurerm_resource_management_private_link_association" "management_privatelink" {
  name                                = random_uuid.management_privatelink.result
  management_group_id                 = data.azurerm_management_group.management_group.id
  resource_management_private_link_id = azurerm_resource_management_private_link.management_privatelink.id
  public_network_access_enabled       = true # Presumably we will eventually want to change this to false
}

resource "azurerm_private_endpoint" "management_privatelink" {
  name                = "management_privatelink"
  location            = azurerm_resource_group.management_privatelink.location
  resource_group_name = azurerm_resource_group.management_privatelink.name
  subnet_id           = data.azurerm_subnet.spur.id
  private_dns_zone_group {
    name = "default"
    private_dns_zone_ids = ["/subscriptions/${var.core_subscription_id}/resourceGroups/prod-private-dns-zones/providers/Microsoft.Network/privateDnsZones/privatelink.azure.com",
    ]
  }
  private_service_connection {
    name                           = "management_privatelink"
    private_connection_resource_id = azurerm_resource_management_private_link.management_privatelink.id
    is_manual_connection           = false
    subresource_names = [
      "ResourceManagement",
    ]
  }
}

Debug Output/Panic Output

https://gist.github.com/atombravo/9a9196b932a82808b0be6e178cb2bd1c

Error: retrieving Resource Management Private Link (Subscription: "mysubscriptionguid"
Resource Group Name: "management_privatelink"
Resource Management Private Link Name: "management_privatelink"): unmarshaling response body: json: cannot unmarshal object into Go struct field ResourceManagementPrivateLinkEndpointConnections.properties.privateEndpointConnections of type string

retrieving Resource Management Private Link (Subscription:
"mysubscriptionguid"
Resource Group Name: "management_privatelink"
Resource Management Private Link Name: "management_privatelink"): unmarshaling
response body: json: cannot unmarshal object into Go struct field
ResourceManagementPrivateLinkEndpointConnections.properties.privateEndpointConnections
of type string

Expected Behaviour

A terraform plan should have succeeded.

Actual Behaviour

Plan error when refreshing current state of existing azurerm_resource_management_private_link.

Steps to Reproduce

terraform plan

Important Factoids

This azurerm_resource_management etc. were created using v3.87.0 a few months ago without issue.

References

No response

teowa commented 3 months ago

Hi @atombravo , thanks for reporting this! I have opened a REST API issue https://github.com/Azure/azure-rest-api-specs/issues/29885 to track the API issue. Please workaround this by using the AzureCLI or Azapi provider for now.