Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.67k stars 5.1k forks source link

[BUG]`Microsoft.Authorization/resourceManagementPrivateLinks` - `properties.privateEndpointConnections` field returns object array instead of string array #29885

Open teowa opened 3 months ago

teowa commented 3 months ago

API Spec link

https://github.com/Azure/azure-rest-api-specs/blob/dc4f9f316f20e45231df187971a4dad2e5dd8964/specification/resources/resource-manager/Microsoft.Authorization/stable/2020-05-01/privateLinks.json#L575-L580

API Spec version

2020-05-01

Describe the bug

In swagger, the privateEndpointConnections field should return array of strings, but array of objects are returned

Expected behavior

In swagger, the privateEndpointConnections field should return array of strings

Actual behavior

array of objects are returned

Reproduction Steps

use terraform config to provision a azurerm_resource_management_private_link and azurerm_private_endpoint:

provider "azurerm" {
  features {}
}
resource "azurerm_resource_group" "management_privatelink" {
  name     = "management_privatelink"
  location = "eastus"
}
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" {
}
data "azurerm_management_group" "management_group" {
  name = "<redacted>"
}
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_virtual_network" "management_privatelink" {
  name                = "management_privatelink-network"
  address_space       = ["10.0.0.0/16"]
  location            = azurerm_resource_group.management_privatelink.location
  resource_group_name = azurerm_resource_group.management_privatelink.name
}
resource "azurerm_subnet" "endpoint" {
  name                 = "endpoint"
  resource_group_name  = azurerm_resource_group.management_privatelink.name
  virtual_network_name = azurerm_virtual_network.management_privatelink.name
  address_prefixes     = ["10.0.2.0/24"]

  enforce_private_link_endpoint_network_policies = true
}
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           = azurerm_subnet.endpoint.id
  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",
    ]
  }
}

if no private endpoint is created, the privateEndpointConnections will be empty array, but if private endpoint is created, we can see the array contains objects:

-> % az rest --method get --uri "/subscriptions/<redacted>/resourceGroups/management_privatelink/providers/Microsoft.Authorization/resourceManagementPrivateLinks/management_privatelink?api-version=2020-05-01"
{
  "id": "/subscriptions/<redacted>/resourceGroups/management_privatelink/providers/Microsoft.Authorization/resourceManagementPrivateLinks/management_privatelink",
  "location": "eastus",
  "name": "management_privatelink",
  "properties": {
    "privateEndpointConnections": [
      {
        "id": "/subscriptions/<redacted>/resourceGroups/management_privatelink/providers/Microsoft.Authorization/resourceManagementPrivateLinks/management_privatelink/privateEndpointConnections/management_privatelink.<redacted>",
        "name": "management_privatelink.<redacted>",
        "properties": {
          "privateEndpoint": {
            "id": "/subscriptions/<redacted>/resourceGroups/management_privatelink/providers/Microsoft.Network/privateEndpoints/management_privatelink"
          },
          "privateLinkServiceConnectionState": {
            "description": "Auto-approved",
            "status": "Approved"
          },
          "provisioningState": "Succeeded"
        },
        "type": "Microsoft.Authorization/resourceManagementPrivateLinks/privateEndpointConnections"
      }
    ]
  },
  "type": "Microsoft.Authorization/resourceManagementPrivateLinks"
}

Environment

terraform

v-jiaodi commented 3 months ago

@tjegbejimba Please help take a look, thanks.