-
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_key
, azurerm_app_configuration_feature
- change resource ID to Data Plane URL format
#20082
azurerm_app_configuration_key
, azurerm_app_configuration_feature
- change resource ID to Data Plane URL format
#20082
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.
@teowa - i'm not sure this is the correct solution, given if it IS valid to have label in the name we should support it. This might be something we need to write a custom id parser for that is a little smarter.
@tombuildsstuff any ideas/comments?
@teowa thanks for this PR. So whilst this approach solves this issue to some extent - I think the other question here is why are these Data Plane resources using a Resource Manager ID at all? Whilst some of the functionality for App Configuration is available within the Resource Manager API - the primary interface for configuration is the Data Plane API which comes with it's own set of Resource IDs. Whilst it's possible to use Resource Manager IDs for these resources, since the validation rules are different between Data Plane and Resource Manager (insofar as Resource Manager requires Key-Value pairs in the URI, whereas Data Plane allows any arbitrary expression) - so whilst URI-encoding the key would work - I think we'd be better to switch the Resource ID being used for these resources to match what the API's expecting here. Doing so would allow the use of a more bespoke parser as @katbyte has suggested, which I'd agree would remove the problem here entirely - so I think would be the better approach here, and whilst this would require a State Migration to do, I think would probably make more sense than trying to shoe-horn this into the Resource Manager ID, since this is ultimately using the Data Plane SDK/API. As such would you be able to take a look into updating the Resource ID format being used for these resources to match:
Whilst that may seem like an odd choice - particularly for As such, would you mind taking a look into adding the ID parsers, and then adding state migrations to update these? Thanks! |
…m into fix_app_configuration_key_complicated_label
Current parser accept either of below format ID for no label:
And ID string in state file uses the 2nd. Should there be a strict parser? Thanks. |
…m into fix_app_configuration_key_complicated_label
…m into fix_app_configuration_key_complicated_label
@teowa - i think 1 or 2 is likely the best option, doesn't seem to be any point in making it more complex for a user by requiring could we also please update the PR title to reflect the id change? thanks |
@katbyte The parser accept all of above format, but to keep consistence with current ID format, |
azurerm_app_configuration_key
, azurerm_app_configuration_feature
- fix bug with complicated name and labelazurerm_app_configuration_key
, azurerm_app_configuration_feature
- change resource ID to data source URL format
azurerm_app_configuration_key
, azurerm_app_configuration_feature
- change resource ID to data source URL formatazurerm_app_configuration_key
, azurerm_app_configuration_feature
- change resource ID to Data Plane URL format
|
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.
aside from 2 docs comments this LGTM 🧪
This functionality has been released in v3.49.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
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 #20038
Resolves #20849
Context:
The error is because of using
/AppConfigurationKey/SAMPLE/Label
as label, which is sourced from the App Configuration Key ID format in Azurerm:/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/resourceGroup1/providers/Microsoft.AppConfiguration/configurationStores/appConf1/AppConfigurationKey/{appConfKey1}/Label/{label1}
, currently we support/
in the{appConfKey1}
and{label1}
segments and stores the/
directly in the resource ID (e.g./AppConfigurationKey/key:name/test/Label/test:label/name"
is a ID withkey:name/test
as the key andtest:label/name
as the label). This can ease the use of import feature with straight forward resource ID, but has some limitations like using/Label/
or/AppConfigurationKey/
literal in label will cause some conflict in ID parsing. To copy with using/Label/
in label property, two possible solutions are:/Label/
to%2FLabel%2F
) and then stores to the ID, but this makes the resource ID not so straight forward./Label/
directly to ID and forbidden using/Label/
literal inlabel
property.This PR implements the second of above, keeps the current ID format (store the/
instead of escaped%2F
), but returns the error message telling users not to use/Label/
literal label property, and since current used regex is greedy, we can use the/AppConfigurationKey/
in label. what do you think?Update
change resource ID to valid data plane URL format:
azurerm_app_configuration_feature
https://appconfname1.azconfig.io/kv/.appconfig.featureflag%2FkeyName?label=%00
(for no label)https://appconfname1.azconfig.io/kv/.appconfig.featureflag%2FkeyName?label=labelName
(for when a label is present)azurerm_app_configuration_key
https://appconfname1.azconfig.io/kv/keyName?label=labelName?label=%00
(for no label)https://appconfname1.azconfig.io/kv/keyName?label=labelName
(for when a label is present)the keyName in URL path should be escaped with Golang
url.PathEscape
method and the labelName in URL query is escaped withurl.QueryEscape
method.Test: