Azure / Azure/azure-rest-api-specs

[BUG] `Microsoft.AzureStackHCI@2024-01-01`: NetworkInterfaces, VirtualHardDisks, MarketplaceGalleryImage and VirtualMachine Resource Properties Not Fully Synced After Creation

Open
#31,876 3 comments 0 reactions 1 assignee Claimed by @pathuang-sia View on GitHub
bug Mgmt
Dominant language
TypeSpec
Stars
3.1k
Forks
5.9k
Avg merge
2d 22h
Merged PRs (30d)
444

Description

### API Spec link

https://github.com/Azure/azure-rest-api-specs/tree/main/specification/azurestackhci/resource-manager/Microsoft.AzureStackHCI/stable/2024-01-01

### API Spec version

2024-01-01

### Describe the bug

If call GET right after the successful polling of the PUT, some properties are not synced, need to wait for several seconds for the properties to fully synced. For example, the Stack HCI NetworkInterface PUT request has ipConfiguration block, but after polling the ipConfiguration is not shown in GET response, need to wait for serveral seconds.

This might cause Terraform diff:
```hcl
| -/+ resource "azurerm_stack_hci_network_interface" "test" {
| ~ id = "/subscriptions//resourceGroups/acctest-hci-vm-241206072951970238/providers/Microsoft.AzureStackHCI/networkInterfaces/acctest-ni-241206072951970238" -> (known after apply)
| + mac_address = "02:ec:01:0c:00:08" # forces replacement
| name = "acctest-ni-241206072951970238"
| # (4 unchanged attributes hidden)
|
| + ip_configuration { # forces replacement
| + gateway = (known after apply)
| + prefix_length = (known after apply)
| + private_ip_address = "192.168.1.15" # forces replacement
| + subnet_id = "/subscriptions//resourceGroups/acctest-hci-vm-241206072951970238/providers/Microsoft.AzureStackHCI/logicalNetworks/acctest-ln-241206072951970238" # forces replacement
| }
| }
|
| # azurerm_stack_hci_virtual_hard_disk.test must be replaced
| -/+ resource "azurerm_stack_hci_virtual_hard_disk" "test" {
| - block_size_in_bytes = 0 -> null
| ~ disk_size_in_gb = 0 -> 2 # forces replacement
| ~ id = "/subscriptions//resourceGroups/acctest-hci-vm-241206072951970238/providers/Microsoft.AzureStackHCI/virtualHardDisks/acctest-vhd-241206072951970238" -> (known after apply)
| - logical_sector_in_bytes = 0 -> null
| name = "acctest-vhd-241206072951970238"
| - physical_sector_in_bytes = 0 -> null
| # (7 unchanged attributes hidden)
| }

```
```
| -/+ resource "azurerm_stack_hci_marketplace_gallery_image" "test" {
| ~ id = "/subscriptions//resourceGroups/acctest-hci-mgi-4r9kg/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/acctest-mgi-4r9kg" -> (known after apply)
| name = "acctest-mgi-4r9kg"
| + version = "20348.2655.240905" # forces replacement
| # (7 unchanged attributes hidden)
|
| + identifier { # forces replacement
| + offer = "WindowsServer" # forces replacement
| + publisher = "MicrosoftWindowsServer" # forces replacement
| + sku = "2022-datacenter-azure-edition-core" # forces replacement
| }
| }

```

```hcl
| -/+ resource "azurerm_stack_hci_windows_virtual_machine" "test" {
| ~ id = "/subscriptions//resourceGroups/acctest-hci-vm-241212075027831926/providers/Microsoft.HybridCompute/machines/acctest-hcivm-241212075027831926/providers/Microsoft.AzureStackHCI/virtualMachineInstances/default" -> (known after apply)
| # (5 unchanged attributes hidden)
|
| ~ hardware_profile {
| ~ memory_mb = 0 -> 8192 # forces replacement
| ~ processor_number = 0 -> 2 # forces replacement
| + vm_size = "Custom" # forces replacement
| }
|
| ~ storage_profile {
| ~ data_disk_ids = [
| + "/subscriptions//resourceGroups/acctest-hci-vm-241212075027831926/providers/Microsoft.AzureStackHCI/virtualHardDisks/acctest-vhd-241212075027831926",
| ]
| + image_id = "/subscriptions//resourceGroups/acctest-hci-vm-241212075027831926/providers/Microsoft.AzureStackHCI/marketplaceGalleryImages/acctest-mgi-241212075027831926" # forces replacement
| # (2 unchanged attributes hidden)
| }
|
| # (2 unchanged blocks hidden)
| }

```

### Expected behavior

If call GET right after the successful polling of the PUT, all properties should be synced

### Actual behavior

If call GET right after the successful polling of the PUT, some properties are not synced

### Reproduction Steps

## PUT
```
2024/12/06 07:30:52 [DEBUG] AzureRM Request:
PUT /subscriptions//resourceGroups/acctest-hci-vm-241206072951970238/providers/Microsoft.AzureStackHCI/networkInterfaces/acctest-ni-241206072951970238?api-version=2024-01-01 HTTP/1.1
Host: management.azure.com
User-Agent: HashiCorp/go-azure-sdk (Go-http-Client/1.1 networkinterfaces/2024-01-01) HashiCorp Terraform/1.9.4 (+https://www.terraform.io) terraform-provider-azurerm/acc pid-222c6c49-1b0a-5959-a213-6608f9eb8820
Content-Length: 646
Content-Type: application/json; charset=utf-8
X-Ms-Correlation-Request-Id: 61e79f8a-665e-f181-39ea-e4450a0c0f7a
Accept-Encoding: gzip

{"extendedLocation":{"name":"/subscriptions//resourceGroups/acctest-hci-1205/providers/Microsoft.ExtendedLocation/customLocations/customlocation1205","type":"CustomLocation"},"location":"eastus","name":"acctest-ni-241206072951970238","properties":{"dnsSettings":{"dnsServers":["192.168.1.254"]},"ipConfigurations":[{"properties":{"privateIPAddress":"192.168.1.15","subnet":{"id":"/subscriptions//resourceGroups/acctest-hci-vm-241206072951970238/providers/Microsoft.AzureStackHCI/logicalNetworks/acctest-ln-241206072951970238"}}}],"macAddress":"02:ec:01:0c:00:08"},"tags":{}}
```
```
2024/12/06 07:30:54 [DEBUG] AzureRM Response for https://management.azure.com/subscriptions//resourceGroups/acctest-hci-vm-241206072951970238/providers/Microsoft.AzureStackHCI/networkInterfaces/acctest-ni-241206072951970238?api-version=2024-01-01:
HTTP/2.0 201 Created
Content-Length: 1196
Azure-Asyncoperation: https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/7307bfb9-93cf-4721-a7be-0d88b7268270*40B829D6F7966684A01C8C4484AEE6A9B6DCC27AA9F7850C9CAAC9B3F0D517EC?api-version=2024-01-01&t=638690670543089371&c=
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Fri, 06 Dec 2024 07:30:53 GMT
Etag: "2b0c2114-0000-0100-0000-6752a82d0000"
Expires: -1
Mise-Correlation-Id: c671cc8c-e8d2-4f4c-a0af-1117aa889d74
Pragma: no-cache
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Azure-Ref: 20241206T073053Z-1777b5dc85blzw8hhC1MNZx0ys0000001k7g00000000d3vt
X-Cache: CONFIG_NOCACHE
X-Content-Type-Options: nosniff
X-Ms-Correlation-Request-Id: 61e79f8a-665e-f181-39ea-e4450a0c0f7a
X-Ms-Providerhub-Traffic: True
X-Ms-Ratelimit-Remaining-Subscription-Global-Writes: 2999
X-Ms-Ratelimit-Remaining-Subscription-Writes: 199
X-Ms-Request-Id: cdf5b1a3-60ad-40fd-93c8-33a229de489d
X-Ms-Routing-Request-Id: JAPANWEST:20241206T073054Z:5c38294a-0f2b-4188-9dd0-256c844fe165
X-Msedge-Ref: Ref A: 021AB300BD4A45B2B3FD928CA4E19477 Ref B: TYO201100117051 Ref C: 2024-12-06T07:30:52Z

{"id":"/subscriptions//resourceGroups/acctest-hci-vm-241206072951970238/providers/Microsoft.AzureStackHCI/networkInterfaces/acctest-ni-241206072951970238","name":"acctest-ni-241206072951970238","type":"microsoft.azurestackhci/networkinterfaces","location":"eastus","extendedLocation":{"name":"/subscriptions//resourceGroups/acctest-hci-1205/providers/Microsoft.ExtendedLocation/customLocations/customlocation1205","type":"CustomLocation"},"tags":{},"systemData":{"createdBy":"6260f80a-123d-430b-aea2-59e03a2ca078","createdByType":"Application","createdAt":"2024-12-06T07:30:53.5120675Z","lastModifiedBy":"6260f80a-123d-430b-aea2-59e03a2ca078","lastModifiedByType":"Application","lastModifiedAt":"2024-12-06T07:30:53.5120675Z"},"properties":{"provisioningState":"Accepted","dnsSettings":{"dnsServers":["192.168.1.254"]},"ipConfigurations":[{"properties":{"privateIPAddress":"192.168.1.15","subnet":{"id":"/subscriptions//resourceGroups/acctest-hci-vm-241206072951970238/providers/Microsoft.AzureStackHCI/logicalNetworks/acctest-ln-241206072951970238"}}}],"macAddress":"02:ec:01:0c:00:08"}}
```

## polling:
```
2024/12/06 07:31:25 [DEBUG] AzureRM Response for https://management.azure.com/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/7307bfb9-93cf-4721-a7be-0d88b7268270*40B829D6F7966684A01C8C4484AEE6A9B6DCC27AA9F7850C9CAAC9B3F0D517EC?api-version=2024-01-01&t=638690670543089371&c=
HTTP/2.0 200 OK
Content-Length: 623
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Fri, 06 Dec 2024 07:31:24 GMT
Etag: "bb04aa98-0000-0100-0000-6752a8450000"
Expires: -1
Pragma: no-cache
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Cache: CONFIG_NOCACHE
X-Content-Type-Options: nosniff
X-Ms-Correlation-Request-Id: 61e79f8a-665e-f181-39ea-e4450a0c0f7a
X-Ms-Ratelimit-Remaining-Tenant-Reads: 249
X-Ms-Request-Id: 1dbca5d6-84ef-41f5-8497-9e55830216d3
X-Ms-Routing-Request-Id: JAPANWEST:20241206T073125Z:0b4a9aa1-efbd-4752-bf6d-97f8ece03f20
X-Msedge-Ref: Ref A: A0FF87C67EBB4AC5B695D50F8D8CD57D Ref B: TYO201151001052 Ref C: 2024-12-06T07:31:25Z

{"id":"/providers/Microsoft.AzureStackHCI/locations/EASTUS/operationStatuses/7307bfb9-93cf-4721-a7be-0d88b7268270*40B829D6F7966684A01C8C4484AEE6A9B6DCC27AA9F7850C9CAAC9B3F0D517EC","name":"7307bfb9-93cf-4721-a7be-0d88b7268270*40B829D6F7966684A01C8C4484AEE6A9B6DCC27AA9F7850C9CAAC9B3F0D517EC","resourceId":"/subscriptions//resourceGroups/acctest-hci-vm-241206072951970238/providers/Microsoft.AzureStackHCI/networkInterfaces/acctest-ni-241206072951970238","status":"Succeeded","startTime":"2024-12-06T07:30:53.6337487Z","endTime":"2024-12-06T07:31:17.7526452Z","error":{},"properties":null}
```

## GET

```
GET /subscriptions//resourceGroups/acctest-hci-vm-241206072951970238/providers/Microsoft.AzureStackHCI/networkInterfaces/acctest-ni-241206072951970238?api-version=2024-01-01 HTTP/1.1
Host: management.azure.com
User-Agent: HashiCorp/go-azure-sdk (Go-http-Client/1.1 networkinterfaces/2024-01-01) HashiCorp Terraform/1.9.4 (+https://www.terraform.io) terraform-provider-azurerm/acc pid-222c6c49-1b0a-5959-a213-6608f9eb8820
Content-Type: application/json; charset=utf-8
X-Ms-Correlation-Request-Id: 61e79f8a-665e-f181-39ea-e4450a0c0f7a
Accept-Encoding: gzip

2024/12/06 07:31:25 [DEBUG] AzureRM Response for https://management.azure.com/subscriptions//resourceGroups/acctest-hci-vm-241206072951970238/providers/Microsoft.AzureStackHCI/networkInterfaces/acctest-ni-241206072951970238?api-version=2024-01-01:
HTTP/2.0 200 OK
Content-Length: 927
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Fri, 06 Dec 2024 07:31:25 GMT
Etag: "2b0cdf16-0000-0100-0000-6752a8470000"
Expires: -1
Pragma: no-cache
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Cache: CONFIG_NOCACHE
X-Content-Type-Options: nosniff
X-Ms-Correlation-Request-Id: 61e79f8a-665e-f181-39ea-e4450a0c0f7a
X-Ms-Providerhub-Traffic: True
X-Ms-Ratelimit-Remaining-Subscription-Global-Reads: 3749
X-Ms-Ratelimit-Remaining-Subscription-Reads: 249
X-Ms-Request-Id: e74f03a3-9f71-4cdd-85a3-ded992b0ea4e
X-Ms-Routing-Request-Id: JAPANEAST:20241206T073125Z:48e4fbba-641e-4123-8901-c62c1396b223
X-Msedge-Ref: Ref A: AEF165564BBD4D92B429CC5EEE9C7C55 Ref B: TYO201151006042 Ref C: 2024-12-06T07:31:25Z

{"id":"/subscriptions//resourceGroups/acctest-hci-vm-241206072951970238/providers/Microsoft.AzureStackHCI/networkInterfaces/acctest-ni-241206072951970238","name":"acctest-ni-241206072951970238","type":"microsoft.azurestackhci/networkinterfaces","location":"eastus","extendedLocation":{"name":"/subscriptions//resourceGroups/acctest-hci-1205/providers/Microsoft.ExtendedLocation/customLocations/customlocation1205","type":"CustomLocation"},"tags":{},"systemData":{"createdBy":"6260f80a-123d-430b-aea2-59e03a2ca078","createdByType":"Application","createdAt":"2024-12-06T07:30:53.5120675Z","lastModifiedBy":"319f651f-7ddb-4fc6-9857-7aef9250bd05","lastModifiedByType":"Application","lastModifiedAt":"2024-12-06T07:31:19.3484123Z"},"properties":{"provisioningState":"Succeeded","dnsSettings":{"dnsServers":["192.168.1.254"]},"ipConfigurations":[],"status":{}}}
```

### Environment
```
User-Agent: HashiCorp/go-azure-sdk (Go-http-Client/1.1 virtualmachineinstances/2024-01-01) HashiCorp Terraform/1.9.4 (+https://www.terraform.io) terraform-provider-azurerm/acc pid-222c6c49-1b0a-5959-a213-6608f9eb8820
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.