Skip to content

Conversation

@smmauck-msft
Copy link

@smmauck-msft smmauck-msft commented Nov 20, 2025

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

The ARM metadata service unfortunately returns the resourceManager endpoint in an inconsistent format between clouds. In Azure Public, it is returned with a trailing slash:

https://management.azure.com/metadata/endpoints?api-version=2022-09-01

  "resourceManager": "https://management.azure.com/",

However, in Azure US Government, it is returned without the trailing slash:

https://management.usgovcloudapi.net/metadata/endpoints?api-version=2022-09-01

  "resourceManager": "https://management.usgovcloudapi.net",

It seems that for the AzureRM Terraform Provider we require the environment to be initialized without the trailing slash. In fact, the built-in Azure Public environment (when not initializing the environment through the metadata endpoint) is also missing the trailing slash:

env.ResourceManager = ResourceManagerAPI("https://management.azure.com")

If the trailing slash is present, users have reported issues such as hashicorp/terraform-provider-azurerm#29819

Given how many dependencies other external clients might have on the ARM metadata service, it's likely easier to simply sanitize the input here rather than pressing for it to be changed on the ARM side.

This is a (please select all that apply):

  • Bug Fix
  • New Feature
  • Enhancement
  • Breaking Change

Related Issue(s)

Fixes hashicorp/terraform-provider-azurerm#29819

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the provider.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

Note

If this PR changes meaningfully during the course of review please update the title and description as required.

@smmauck-msft smmauck-msft requested a review from a team as a code owner November 20, 2025 22:37
@github-actions github-actions bot added the release-once-merged The SDK should be released once this PR is merged label Nov 20, 2025
@hashicorp-cla-app
Copy link

hashicorp-cla-app bot commented Nov 20, 2025

CLA assistant check
All committers have signed the CLA.

@hashicorp-cla-app
Copy link

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-once-merged The SDK should be released once this PR is merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: terraform destroy fails due to trailing slash parsing in response from the provided metadata_host

1 participant