-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
azurerm_app_configuration
- omit no permission error in get soft-deleted
#19661
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The feature flag here
terraform-provider-azurerm/internal/services/appconfiguration/app_configuration_resource.go
Line 260 in eb2e4c6
if !meta.(*clients.Client).Features.AppConfiguration.RecoverSoftDeleted { |
Needs to wrap the whole retrieval of the deleted configuration stores which begins on line 249
terraform-provider-azurerm/internal/services/appconfiguration/app_configuration_resource.go
Line 249 in eb2e4c6
deletedConfigurationStoresId := deletedconfigurationstores.NewDeletedConfigurationStoreID(subscriptionId, location, name) |
internal/services/appconfiguration/app_configuration_resource.go
Outdated
Show resolved
Hide resolved
@stephybun , thanks for reviewing this. I have modified the code. But I find if move the retrieval of deleted into the features toggle scope, we cannot return the And there is test failure, the App Conf resource creation is failed and should not exist but returned by resource group list API, which might related to #18796
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should still return an error if the user is missing the necessary permissions for retrieval and is opted into this feature which is enabled by default, the error message should be changed to something like this:
func userIsMissingNecessaryPermission(name, location string) string {
return fmt.Sprintf(`
An existing soft-deleted App Configuration exists with the Name %q in the location %q, however
the credentials Terraform is using has insufficient permissions to check for an existing soft-deleted App Configuration.
You can opt out of this behaviour by using the "features" block (located within the "provider" block) - more information
can be found here:
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs#features
Alternatively you can manually recover this (e.g. using the Azure CLI) and then import
this into Terraform via "terraform import".
`, name, location)
}
internal/services/appconfiguration/app_configuration_resource.go
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @teowa, there's a test failure for this service, would you mind fixing it? Once that's done this should be good to go!
------- Stdout: -------
=== RUN TestAccAppConfigurationKeysDataSource_allkeys
=== PAUSE TestAccAppConfigurationKeysDataSource_allkeys
=== CONT TestAccAppConfigurationKeysDataSource_allkeys
testcase.go:110: Step 1/1 error: Error running apply: exit status 1
Error: checking for presence of existing Key: Configuration Store Id "/subscriptions/*******/resourceGroups/acctestRG-appconfig-230118072400473047/providers/Microsoft.AppConfiguration/configurationStores/testacc-appconf230118072400473047" / Label "label1" / Key "key1": appconfiguration.BaseClient#GetKeyValue: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: error response cannot be parsed: {"" '\x00' '\x00'} error: EOF
with azurerm_app_configuration_key.test,
on terraform_plugin_test.tf line 44, in resource "azurerm_app_configuration_key" "test":
44: resource "azurerm_app_configuration_key" "test" {
checking for presence of existing Key: Configuration Store Id
"/subscriptions/*******/resourceGroups/acctestRG-appconfig-230118072400473047/providers/Microsoft.AppConfiguration/configurationStores/testacc-appconf230118072400473047"
/ Label "label1" / Key "key1": appconfiguration.BaseClient#GetKeyValue:
Failure responding to request: StatusCode=403 -- Original Error:
autorest/azure: error response cannot be parsed: {"" '\x00' '\x00'} error:
EOF
Error: checking for presence of existing Key: Configuration Store Id "/subscriptions/*******/resourceGroups/acctestRG-appconfig-230118072400473047/providers/Microsoft.AppConfiguration/configurationStores/testacc-appconf230118072400473047" / Label "label2" / Key "key1": appconfiguration.BaseClient#GetKeyValue: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: error response cannot be parsed: {"" '\x00' '\x00'} error: EOF
with azurerm_app_configuration_key.test2,
on terraform_plugin_test.tf line 52, in resource "azurerm_app_configuration_key" "test2":
52: resource "azurerm_app_configuration_key" "test2" {
checking for presence of existing Key: Configuration Store Id
"/subscriptions/*******/resourceGroups/acctestRG-appconfig-230118072400473047/providers/Microsoft.AppConfiguration/configurationStores/testacc-appconf230118072400473047"
/ Label "label2" / Key "key1": appconfiguration.BaseClient#GetKeyValue:
Failure responding to request: StatusCode=403 -- Original Error:
autorest/azure: error response cannot be parsed: {"" '\x00' '\x00'} error:
EOF
…m into fix_app_conf_purge_403
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still have test failures:
------- Stdout: -------
=== RUN TestAccAppConfigurationKeysDataSource_allkeys
=== PAUSE TestAccAppConfigurationKeysDataSource_allkeys
=== CONT TestAccAppConfigurationKeysDataSource_allkeys
testcase.go:110: Step 1/1 error: Error running apply: exit status 1
Error: checking for presence of existing Key: Configuration Store Id "/subscriptions/*******/resourceGroups/acctestRG-appconfig-230130193705070873/providers/Microsoft.AppConfiguration/configurationStores/testacc-appconf230130193705070873" / Label "label1" / Key "key1": appconfiguration.BaseClient#GetKeyValue: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: error response cannot be parsed: {"" '\x00' '\x00'} error: EOF
with azurerm_app_configuration_key.test,
on terraform_plugin_test.tf line 44, in resource "azurerm_app_configuration_key" "test":
44: resource "azurerm_app_configuration_key" "test" {
checking for presence of existing Key: Configuration Store Id
"/subscriptions/*******/resourceGroups/acctestRG-appconfig-230130193705070873/providers/Microsoft.AppConfiguration/configurationStores/testacc-appconf230130193705070873"
/ Label "label1" / Key "key1": appconfiguration.BaseClient#GetKeyValue:
Failure responding to request: StatusCode=403 -- Original Error:
autorest/azure: error response cannot be parsed: {"" '\x00' '\x00'} error:
EOF
Error: checking for presence of existing Key: Configuration Store Id "/subscriptions/*******/resourceGroups/acctestRG-appconfig-230130193705070873/providers/Microsoft.AppConfiguration/configurationStores/testacc-appconf230130193705070873" / Label "label2" / Key "key1": appconfiguration.BaseClient#GetKeyValue: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: error response cannot be parsed: {"" '\x00' '\x00'} error: EOF
with azurerm_app_configuration_key.test2,
on terraform_plugin_test.tf line 52, in resource "azurerm_app_configuration_key" "test2":
52: resource "azurerm_app_configuration_key" "test2" {
checking for presence of existing Key: Configuration Store Id
"/subscriptions/*******/resourceGroups/acctestRG-appconfig-230130193705070873/providers/Microsoft.AppConfiguration/configurationStores/testacc-appconf230130193705070873"
/ Label "label2" / Key "key1": appconfiguration.BaseClient#GetKeyValue:
Failure responding to request: StatusCode=403 -- Original Error:
autorest/azure: error response cannot be parsed: {"" '\x00' '\x00'} error:
EOF
Error: checking for presence of existing Key: Configuration Store Id "/subscriptions/*******/resourceGroups/acctestRG-appconfig-230130193705070873/providers/Microsoft.AppConfiguration/configurationStores/testacc-appconf230130193705070873" / Label "testlabel" / Key "key2": appconfiguration.BaseClient#GetKeyValue: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: error response cannot be parsed: {"" '\x00' '\x00'} error: EOF
with azurerm_app_configuration_key.test3,
on terraform_plugin_test.tf line 60, in resource "azurerm_app_configuration_key" "test3":
60: resource "azurerm_app_configuration_key" "test3" {
checking for presence of existing Key: Configuration Store Id
"/subscriptions/*******/resourceGroups/acctestRG-appconfig-230130193705070873/providers/Microsoft.AppConfiguration/configurationStores/testacc-appconf230130193705070873"
/ Label "testlabel" / Key "key2": appconfiguration.BaseClient#GetKeyValue:
Failure responding to request: StatusCode=403 -- Original Error:
autorest/azure: error response cannot be parsed: {"" '\x00' '\x00'} error:
EOF
Error: checking for presence of existing Key: Configuration Store Id "/subscriptions/*******/resourceGroups/acctestRG-appconfig-230130193705070873/providers/Microsoft.AppConfiguration/configurationStores/testacc-appconf230130193705070873" / Label "testlabel" / Key "key3": appconfiguration.BaseClient#GetKeyValue: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: error response cannot be parsed: {"" '\x00' '\x00'} error: EOF
with azurerm_app_configuration_key.test4,
on terraform_plugin_test.tf line 68, in resource "azurerm_app_configuration_key" "test4":
68: resource "azurerm_app_configuration_key" "test4" {
checking for presence of existing Key: Configuration Store Id
"/subscriptions/*******/resourceGroups/acctestRG-appconfig-230130193705070873/providers/Microsoft.AppConfiguration/configurationStores/testacc-appconf230130193705070873"
/ Label "testlabel" / Key "key3": appconfiguration.BaseClient#GetKeyValue:
Failure responding to request: StatusCode=403 -- Original Error:
autorest/azure: error response cannot be parsed: {"" '\x00' '\x00'} error:
EOF
Error: checking for presence of existing Key: Configuration Store Id "/subscriptions/*******/resourceGroups/acctestRG-appconfig-230130193705070873/providers/Microsoft.AppConfiguration/configurationStores/testacc-appconf230130193705070873" / Label "" / Key "key3": appconfiguration.BaseClient#GetKeyValue: Failure responding to request: StatusCode=403 -- Original Error: autorest/azure: error response cannot be parsed: {"" '\x00' '\x00'} error: EOF
with azurerm_app_configuration_key.test5,
on terraform_plugin_test.tf line 76, in resource "azurerm_app_configuration_key" "test5":
76: resource "azurerm_app_configuration_key" "test5" {
checking for presence of existing Key: Configuration Store Id
"/subscriptions/*******/resourceGroups/acctestRG-appconfig-230130193705070873/providers/Microsoft.AppConfiguration/configurationStores/testacc-appconf230130193705070873"
/ Label "" / Key "key3": appconfiguration.BaseClient#GetKeyValue: Failure
responding to request: StatusCode=403 -- Original Error: autorest/azure:
error response cannot be parsed: {"" '\x00' '\x00'} error: EOF
--- FAIL: TestAccAppConfigurationKeysDataSource_allkeys (97.43s)
FAIL
@teowa any update on this? |
The PR should be OK, the failed test is related to #20324 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…m into fix_app_conf_purge_403
@brental - while the GH CI is passing the acctests are failing stil. @teowa - we are still seeing a test failure:
|
Fixing of the failed test |
@teowa this should have been unblocked by hashicorp/pandora#2363 |
HI @stephybun , I have submit another PR #21750 to fix the failed test case. |
Does anyone know, when this PR will be merged? |
internal/services/appconfiguration/app_configuration_resource.go
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@teowa looks like a rebase is required
------- Stdout: -------
=== RUN TestAccAppConfiguration_softDeletePurgeThenRecreate
=== PAUSE TestAccAppConfiguration_softDeletePurgeThenRecreate
=== CONT TestAccAppConfiguration_softDeletePurgeThenRecreate
testcase.go:110: Step 4/5 error: Error running apply: exit status 1
Error: creating Configuration Store (Subscription: "*******"
Resource Group Name: "acctestRG-appconfig-230601085823840487"
Configuration Store Name: "testaccappconf230601085823840487"): polling after Create: internal-error: a polling status of `Failed` should be surfaced as a PollingFailedError
with azurerm_app_configuration.test,
on terraform_plugin_test.tf line 26, in resource "azurerm_app_configuration" "test":
26: resource "azurerm_app_configuration" "test" {
--- FAIL: TestAccAppConfiguration_softDeletePurgeThenRecreate (659.92s)
FAIL
…m into fix_app_conf_purge_403
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are passing now, thanks @teowa LGTM 👍
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. |
resolves #19605
Omit no permission error in get soft-deleted.