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

Microsoft.ApiManagement Error: unexpected segment "policies/policy" #23112

Closed
1 task done
michelefa1988 opened this issue Aug 29, 2023 · 7 comments · Fixed by #23128
Closed
1 task done

Microsoft.ApiManagement Error: unexpected segment "policies/policy" #23112

michelefa1988 opened this issue Aug 29, 2023 · 7 comments · Fixed by #23128

Comments

@michelefa1988
Copy link

michelefa1988 commented Aug 29, 2023

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 and review the contribution guide to help.

Terraform Version

1.4.0

AzureRM Provider Version

3.70.0

Affected Resource(s)/Data Source(s)

azurerm_api_management_product

Terraform Configuration Files

resource "azurerm_api_management_product" "api_management_product" {
  product_id            = var.product_id
  api_management_name   = var.api_management_name
  resource_group_name   = var.resource_group
  display_name          = var.display_name
  subscription_required = true
  approval_required     = false
  published             = true
}

Debug Output/Panic Output

Error: parsing "/subscriptions/xxxx-xxxx-xxxx-xxxx-xxxxx/resourceGroups/rg/providers/Microsoft.ApiManagement/service/apim/products/xxx/policies/policy": unexpected segment "policies/policy" present at the end of the URI (input "/subscriptions/xxxx-xxxx-xxxx-xxxx-xxxx/resourceGroups/rg/providers/Microsoft.ApiManagement/service/apim/products/test-user/policies/policy")
│ 
│   with module.env-definition.module.test_user_wyzer_api_management_product_policy.azurerm_api_management_product_policy.api_management_product_policy,
│   on ../../../terraform-providers/azure/modules/api-management/azurerm_api_management_product_policy/azurerm_api_management_product_policy.tf line 19, in resource "azurerm_api_management_product_policy" "api_management_product_policy":
│   19: resource "azurerm_api_management_product_policy" "api_management_product_policy" {
│ 

Expected Behaviour

Plan expected to finish cleanly

Actual Behaviour

Planning failed. Terraform encountered an error while generating this plan.

Steps to Reproduce

No response

Important Factoids

No response

References

No response

@michelefa1988
Copy link
Author

Relates to #23015

@rcskosir
Copy link
Contributor

This also likely relates to #23095

@sinbai
Copy link
Contributor

sinbai commented Aug 30, 2023

Hi @michelefa1988, thanks for opening this issue. Per the provided terraform configuration, the affected terraform resource is azurerm_api_management_product. However, in Debug Output/Panic Output, the id "/subscriptions/xxxx-xxxx-xxx-xxxxx-xxxx/resourceGroups/rg/providers/Microsoft.ApiManagement/service/apim-product-dev-gewc/apis/Health/policies/policy" appears to be the ID of terraform resource azurerm_api_management_api_policy. Could you please explain where this id is coming from? Is it possible to provide the complete repro steps to help reproduce/troubleshoot?

@michelefa1988
Copy link
Author

@sinbai can you please check again. I have various aim related products which are not working

@sinbai
Copy link
Contributor

sinbai commented Aug 31, 2023

Hi @michelefa1988 I have submitted PR #23128 to try to resolve this error. Before the PR is released, could you please manually remove the suffix /policies/policy of the id (including the resources : azurerm_api_management_api_policy, azurerm_api_management_api_operation_policy, azurerm_api_management_product_policy ) in state file to see if it is resolved? (e.g. replace "/subscriptions/xxxx-xxxx-xxx-xxxxx-xxxx/resourceGroups/rg/providers/Microsoft.ApiManagement/service/apim-product-dev-gewc/apis/Health/policies/policy" with /subscriptions/xxxx-xxxx-xxx-xxxxx-xxxx/resourceGroups/rg/providers/Microsoft.ApiManagement/service/apim-product-dev-gewc/apis/Health)

@rcskosir rcskosir added the bug label Aug 31, 2023
@michelefa1988
Copy link
Author

Yup, this seemed to have solved it and terraform plan works well. :)

Copy link

github-actions bot commented May 7, 2024

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 May 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants