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.47k stars 4.56k forks source link

Invalid IotDpsState i.e. should be active/suspended, IotDpsState: Transitioning #21463

Open pchevallier opened 1 year ago

pchevallier commented 1 year ago

Is there an existing issue for this?

Community Note

Terraform Version

1.4.5

AzureRM Provider Version

3.52.0

Affected Resource(s)/Data Source(s)

azurerm_private_endpoint

Terraform Configuration Files

A Private Endpoint was successfully created against the IoT HUB DPS service using the azurerm_private_endpoint service

When trying to remove it, Terraform detects an invalid IoT HUB DPS state "transitioning" instead of "active" (see output below) and rejects the deletion.

Debug Output/Panic Output

{"etag":"xxxxxx=","name":"PROVS-xxxxxxxxx","location":"canadacentral","properties":{"state":"Active","provisioningState":"Succeeded","iotHubs":[{"applyAllocationPolicy":true,"allocationWeight":1,"name":"IOT-xxxxxxx.azure-devices.net","connectionString":"HostName=IOT-xxxxxxxxx.azure-devices.net;SharedAccessKeyName=POL-IOT-HUB-xxxxxxx;SharedAccessKey=****","location":"canadacentral"}],"allocationPolicy":"Hashed","serviceOperationsHostName":"PROVS-xxxxxx.azure-devices-provisioning.net","deviceProvisioningHostName":"global.azure-devices-provisioning.net","idScope":"xxxxxxx","privateEndpointConnections":[{"properties":{"privateEndpoint":{

Error: waiting for deletion of Private Endpoint "PE-XXXXXXXXXXXXXXXX" (Resource Group "RG-XXXXXXXXXXXXX"): Code="409301" Message="Call to Microsoft.Devices/provisioningServices failed. Error message: Invalid IotDpsState i.e. should be active/suspended, IotDpsState: Transitioning.

Expected Behaviour

The IoT HUB DPS state should return the correct state (active in this case)

Actual Behaviour

The IoT HUB DPS status is returned to "transitioning"

Steps to Reproduce

No response

Important Factoids

No response

References

No response

myc2h6o commented 1 year ago

Hi @pchevallier thanks for opening the issue! Unfortunately, this error comes from Azure API directly, indicating that the IoTHub DPS is in the middle of some operations. I read from the json response of the DPS you shared and the state is indeed Active. If there is no simultaneous operations to the DPS resource, there may be some issue within the Azure cache, I'd suggest open a support ticket to Azure to check the state of the DPS while deleting the private endpoint.

pchevallier commented 1 year ago

Thanks @myc2h6o I will try to duplicate this issue using the CLI and if this is indeed the case, I will then open a ticket accordingly.