Closed obourdon closed 3 years ago
My take is that any failing scenario on VMSS deployment will behave the same way. For instance when specifying a probe for which condition will never be successful (missing probe service, ...).
If I am right about this,I will also add a test scenario to check this case.
After further checking, seems like failing probes do not trigger this issue as in the debug traces one can see:
GET /subscriptions/SUBSCRIPTION_ID/providers/Microsoft.Compute/locations/westeurope/operations/4b7dbe56-a2e6-472c-85ee-b32a19961f6f?api-version=2020-06-01 HTTP/1.1^M
Host: management.azure.com^M
User-Agent: Go/go1.13.15 (amd64-darwin) go-autorest/v14.2.1 Azure-SDK-For-Go/v48.1.0 compute/2020-06-01 HashiCorp Terraform/0.12.7-sdk (+https://www.terraform.io) Terraform Plugin SDK/1.13.1 terraform-provider\
\
-azurerm/acc pid-222c6c49-1b0a-5959-a213-6608f9eb8820^M
X-Ms-Correlation-Request-Id: 664d93e2-55b3-7f4f-bbe1-9a2b4aedb1a3^M
Accept-Encoding: gzip^M
^M
2020/11/13 14:09:17 [DEBUG] AzureRM Response for https://management.azure.com/subscriptions/SUBSCRIPTION_ID/providers/Microsoft.Compute/locations/westeurope/operations/4b7dbe56-a2e6-472c-8\
5ee-b32a19961f6f?api-version=2020-06-01:
HTTP/2.0 200 OK^M
Cache-Control: no-cache^M
Content-Type: application/json; charset=utf-8^M
Date: Fri, 13 Nov 2020 13:09:16 GMT^M
Expires: -1^M
Pragma: no-cache^M
Server: Microsoft-HTTPAPI/2.0^M
Server: Microsoft-HTTPAPI/2.0^M
Strict-Transport-Security: max-age=31536000; includeSubDomains^M
Vary: Accept-Encoding^M
X-Content-Type-Options: nosniff^M
X-Ms-Correlation-Request-Id: 664d93e2-55b3-7f4f-bbe1-9a2b4aedb1a3^M
X-Ms-Ratelimit-Remaining-Resource: Microsoft.Compute/GetOperation3Min;14996,Microsoft.Compute/GetOperation30Min;29974^M
X-Ms-Ratelimit-Remaining-Subscription-Reads: 11951^M
X-Ms-Request-Id: 250107be-5c77-471c-85a6-4a616d75b458^M
X-Ms-Routing-Request-Id: FRANCECENTRAL:20201113T130917Z:6fd4b516-5f49-4ee2-9370-ebed448a81bd^M
^M
{^M
"startTime": "2020-11-13T13:07:05.7142297+00:00",^M
"endTime": "2020-11-13T13:08:27.2772214+00:00",^M
"status": "Succeeded",^M
"name": "4b7dbe56-a2e6-472c-85ee-b32a19961f6f"^M
}
2020/11/13 14:09:17 [DEBUG] Virtual Machine Scale Set "acctestvmss-201113140648857075" (Resource Group "acctestRG-201113140648857075") was created
and therefore the TF state file contains the associated resource which can therefore be destroyed accordingly (even though the instance state is properly diagnosed as UNHEALTHY)
hey @obourdon
Thanks for opening this issue.
As mentioned in #9316 - unfortunately this behaviour is by design, since the Azure API uses a ProvisioningState of "Failed" to mean multiple things, up to and including "this resource will eventually recover". Whilst that's unfortunate - to ensure consistency during failure conditions, we require that operators to determine if it's safe to determine how's best to proceed in their environment - since the Azure API doesn't provide enough context to be able to determine this automatically - and again this would likely change on a per-operator basis.
Since this behaviour is unfortunately by design due to the behaviour of the Azure API - whilst I'd like to thank you for opening this issue (and the associated PR), I'm going to close this issue for the moment - but a more detailed explanation is available in #9316.
Thanks!
I'm going to lock this issue because it has been closed for 30 days β³. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error π€ π , please reach out to my human friends π hashibot-feedback@hashicorp.com. Thanks!
Community Note
Terraform (and AzureRM Provider) Version
Affected Resource(s)
azurerm_linux_virtual_machine_scale_set
Terraform Configuration Files
Debug Output
If you run the following command in AzureRM provider code cloned from this repository
You get the following:
Expected Behaviour
The VMSS resource (and potentially attached and failing instances) should still be stored in the state file so that the delete step works
Actual Behaviour
The VMSS and attached instances are still present in resources list and should be deleted manually
Steps to Reproduce
See above in debug output section
References
None found