terraform-provider-azurerm
terraform-provider-azurerm copied to clipboard
`azurerm_mssql_managed_instance` : Fix acctests failure
The following acctests failed due to differences in routes settings after applying the test step and performing a terraform refresh.
Failed test cases:
TestAccMsSqlManagedInstanceFailoverGroup_update,
TestAccMsSqlManagedInstance_premium,
TestAccMsSqlManagedInstance_dnsZonePartner,
TestAccMsSqlManagedInstance_multipleDnsZonePartners
Test cases fail in TC: https://hashicorp.teamcity.com/buildConfiguration/TF_AzureRM_AZURERM_SERVICE_PUBLIC_MSSQLMANAGEDINSTANCE/133104?hideTestsFromDependencies=false&expandBuildDeploymentsSection=false&expandBuildTestsSection=true&hideProblemsFromDependencies=false&expandBuildChangesSection=true
After comparing the routes configured by TF and returned by API, it was found that the routes returned by the API at the primary location (westeurope) and the secondary location (francecentral) are different. So, submit this PR to configure routes individually based on the location configuration to fix test case failure.
Test results in TC: https://hashicorp.teamcity.com/buildConfiguration/TF_AzureRM_AZURERM_SERVICE_PUBLIC_MSSQLMANAGEDINSTANCE/135862?buildTab=tests
Notes:
The reason why you explicitly specify the following "provider" block in testcases instead of specifying it in the template is because the template method is also called in the test case TestAccMsSqlManagedTransparentDataEncryption_keyVaultSystemAssignedIdentity, which results in a "Duplicate provider configuratio" error.
provider "azurerm" {
features {}
}
@sinbai - is this ready for review?
@sinbai - is this ready for review?
Yes.
Running this we are still getting failured:
------- Stdout: ------- === RUN TestAccMsSqlManagedInstance_identity === PAUSE TestAccMsSqlManagedInstance_identity === CONT TestAccMsSqlManagedInstance_identity testing_new.go:90: Error running post-test destroy, there may be dangling resources: exit status 1 Error: deleting Resource Group "acctestRG1-sql-240506181806757163": the Resource Group still contains Resources. Terraform is configured to check for Resources within the Resource Group when deleting the Resource Group - and raise an error if nested Resources still exist to avoid unintentionally deleting these Resources. Terraform has detected that the following Resources still exist within the Resource Group: * `/subscriptions/*******/resourceGroups/acctestRG1-sql-240506181806757163/providers/Microsoft.Network/networkIntentPolicies/mi_default_15814648-afc9-4bef-89d9-3e41f6fdd11e_10-0-0-0-24_Update` This feature is intended to avoid the unintentional destruction of nested Resources provisioned through some other means (for example, an ARM Template Deployment) - as such you must either remove these Resources, or disable this behaviour using the feature flag `prevent_deletion_if_contains_resources` within the `features` block when configuring the Provider, for example: provider "azurerm" { features { resource_group { prevent_deletion_if_contains_resources = false } } } When that feature flag is set, Terraform will skip checking for any Resources within the Resource Group and delete this using the Azure API directly (which will clear up any nested resources). More information on the `features` block can be found in the documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/features-block --- FAIL: TestAccMsSqlManagedInstance_identity (5131.98s) FAIL
Hi @katbyte the purpose of this PR is to fix the following failure in the latest main branch test of TC, taking test case TestAccMsSqlManagedInstanceFailoverGroup_update as an example:
.
For the above test case TestAccMsSqlManagedInstance_identity failure, I have filed an API issue to track it as it is an API issue.
We can see that in the TC test containing this PR, the test results of TestAccMsSqlManagedInstanceFailoverGroup_update are the same as the above TestAccMsSqlManagedInstance_identity, which is caused by the API issue. I assume for this case TF should not add prevent_deletion_if_contains_resources = false but wait for RP team fix.
current all tests are failing:
This PR is being labeled as "stale" because it has not been updated for 30 or more days.
If this PR is still valid, please remove the "stale" label. If this PR is blocked, please add it to the "Blocked" milestone.
If you need some help completing this PR, please leave a comment letting us know. Thank you!
Closing since there's been no activity for a while.
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.