Skip to content
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_feature breaks state when using slashes #19437

Closed
1 task done
fgroen opened this issue Nov 25, 2022 · 2 comments · Fixed by #19470
Closed
1 task done

azurerm_app_configuration_feature breaks state when using slashes #19437

fgroen opened this issue Nov 25, 2022 · 2 comments · Fixed by #19470

Comments

@fgroen
Copy link

fgroen commented Nov 25, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.3.5

AzureRM Provider Version

3.33.0

Affected Resource(s)/Data Source(s)

azurerm_app_configuration_feature

Terraform Configuration Files

data "azurerm_client_config" "current" {}

resource "azurerm_role_assignment" "appconf_dataowner" {
  scope                = var.resource_group_id
  role_definition_name = "App Configuration Data Owner"
  principal_id         = data.azurerm_client_config.current.object_id
}

resource "azurerm_app_configuration" "appconfig" {
  name                = "appconf-fred"
  resource_group_name = var.resource_group_name
  location            = var.resource_group_location
  sku                 = "standard"
  tags                = var.tags
}

resource "azurerm_app_configuration_feature" "feature_toggle" {
  configuration_store_id = azurerm_app_configuration.appconfig.id
  name                   = "my/test"
  description            = "My feature"
  enabled                = true
}

Debug Output/Panic Output

module.appconfiguration[0].azurerm_app_configuration_feature.feature_toggle: Creating...
╷
│ Error: while parsing resource ID: while parsing resource ID: The number of path segments is not divisible by 2 in "subscriptions/XXXX/resourceGroups/rg-terraform-fred/providers/Microsoft.AppConfiguration/configurationStores/appconf-fred/AppConfigurationFeature/my/test/Label/\x00"
│
│   with module.appconfiguration[0].azurerm_app_configuration_feature.feature_toggle,
│   on appconfig\main.tf line 20, in resource "azurerm_app_configuration_feature" "feature_toggle":
│   20: resource "azurerm_app_configuration_feature" "feature_toggle" {
│
│ while parsing resource ID: while parsing resource ID: The number of path segments is not divisible by 2 in"subscriptions/XXXX/resourceGroups/rg-terraform-fred/providers/Microsoft.AppConfiguration/configurationStores/appconf-fred/AppConfigurationFeature/my/test/Label/\x00"

Expected Behaviour

A feature succesfully being added in app configuration with name 'my/feature' and with key '.appconfig.featureflag/my/test'.

Actual Behaviour

The feature is added, but terraform is failing with an error after creation. State is also 'corrupted', meaning I cannot fix it by changing my feature configuration. (for example by changing the slash into a dash)

Steps to Reproduce

  1. setup app configuration as described in the documentation: https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/app_configuration_feature
  2. add a slash in the name
  3. execute terraform plan -> no errors
  4. execute terraform apply -> fails with an error (feature is created in azure app configuration)
  5. remove the slash from the name
  6. execute terraforn plan -> fails with the same error

Important Factoids

No response

References

A fix was done here #16835 but the focus was on the labels if I'm not mistaken?
A fix for supporting the slash in keys was done here: #13852

Both fixed were done for azurerm_app_configuration_key but should also be executed for azurerm_app_configuration_feature?

@ziyeqf
Copy link
Contributor

ziyeqf commented Nov 29, 2022

Hi @fgroen, thanks for opening this issue.

Sorry the provider does not support name with slashes in azurerm_app_configuration_feature, a pr (#19470) has been submitted to fix this bug.

to fix the state file. Here are 2 options to fix the state file.


  1. If it's acceptable to wait for the fix pr merged and released, please wait for it and then it will automatically fix the state file without resources deletion.

  1. If it's not acceptable to wait, please delete the feature by Portal or azcli and then run
terraform state rm 'azurerm_app_configuration_feature.feature_toggle'   

to delete it from state file.


For any further question please leave comments, thank you!

@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants