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_recovery_services_vault - subscription could not be found in Azure Government #5818

Closed
sdhibit opened this issue Feb 19, 2020 · 2 comments · Fixed by #5825
Closed

Comments

@sdhibit
Copy link

sdhibit commented Feb 19, 2020

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 (and AzureRM Provider) Version

terraform -v

Terraform version: 0.12.20

  • provider.azurerm v1.43.0
  • provider.azurerm v1.44.0

Affected Resource(s)

  • azurerm_recovery_services_vault

Terraform Configuration Files

provider "azurerm" {
  version = "=1.44"

  environment = "usgovernment"
}

resource "azurerm_resource_group" "rg" {
  name     = "rg-example-recovery-vault"
  location = "usgovvirginia"
}

resource "azurerm_recovery_services_vault" "vault" {
  name                = "example-recovery-vault"
  location            = azurerm_resource_group.rg.location
  resource_group_name = azurerm_resource_group.rg.name
  sku                 = "Standard"

  soft_delete_enabled = true
}

Debug Output

2020-02-19T13:32:38.162Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: [DEBUG] AzureRM Request: 
2020-02-19T13:32:38.162Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: PATCH /Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-example-recovery-vault/providers/Microsoft.RecoveryServices/vaults/example-recovery-vault/backupconfig/vaultconfig?api-version=2019-05-13 HTTP/1.1
2020-02-19T13:32:38.162Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: Host: management.azure.com
2020-02-19T13:32:38.162Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: User-Agent: Go/go1.12.6 (amd64-linux) go-autorest/v13.3.0 Azure-SDK-For-Go/v38.1.0 backup/2019-05-13 HashiCorp Terraform/0.12.20 (+https://www.terraform.io) Terraform Plugin SDK/1.6.0 terraform-provider-azurerm/1.44.0 pid-222c6c49-1b0a-5959-a213-6608f9eb8820
2020-02-19T13:32:38.162Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: Content-Length: 85
2020-02-19T13:32:38.162Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: Content-Type: application/json; charset=utf-8
2020-02-19T13:32:38.162Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: X-Ms-Correlation-Request-Id: 33650683-3637-35da-55de-7151b0fc25cd
2020-02-19T13:32:38.162Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: Accept-Encoding: gzip
2020-02-19T13:32:38.162Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: 
2020-02-19T13:32:38.162Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: {"properties":{"enhancedSecurityState":"Enabled","softDeleteFeatureState":"Enabled"}}
2020-02-19T13:32:38.561Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: [DEBUG] AzureRM Response for https://management.azure.com/Subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-example-recovery-vault/providers/Microsoft.RecoveryServices/vaults/example-recovery-vault/backupconfig/vaultconfig?api-version=2019-05-13: 
2020-02-19T13:32:38.561Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: HTTP/2.0 404 Not Found
2020-02-19T13:32:38.561Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: Content-Length: 129
2020-02-19T13:32:38.561Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: Cache-Control: no-cache
2020-02-19T13:32:38.561Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: Content-Type: application/json; charset=utf-8
2020-02-19T13:32:38.561Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: Date: Wed, 19 Feb 2020 13:32:37 GMT
2020-02-19T13:32:38.561Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: Expires: -1
2020-02-19T13:32:38.561Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: Pragma: no-cache
2020-02-19T13:32:38.561Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: Strict-Transport-Security: max-age=31536000; includeSubDomains
2020-02-19T13:32:38.561Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: X-Content-Type-Options: nosniff
2020-02-19T13:32:38.561Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: X-Ms-Correlation-Request-Id: 33650683-3637-35da-55de-7151b0fc25cd
2020-02-19T13:32:38.561Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: X-Ms-Failure-Cause: gateway
2020-02-19T13:32:38.561Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: X-Ms-Request-Id: 5826ecbb-f855-4884-a5e6-3f1bdc135dde
2020-02-19T13:32:38.561Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: X-Ms-Routing-Request-Id: CANADAEAST:20200219T133238Z:5826ecbb-f855-4884-a5e6-3f1bdc135dde
2020-02-19T13:32:38.561Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: 
2020-02-19T13:32:38.561Z [DEBUG] plugin.terraform-provider-azurerm_v1.44.0_x4: {"error":{"code":"SubscriptionNotFound","message":"The subscription '' could not be found."}}

Expected Behavior

The VaultConfigs client added in v1.43 should use the correct Azure Endpoint URL. In this example, REST API calls should be going to management.usgovcloudapi.net, not management.azure.com.

Actual Behavior

The VaultConfigs client always uses management.azure.com since the cloud environment set in the azurerm provider block is not used.

azurerm_resource_group.rg: Refreshing state...
azurerm_recovery_services_vault.vault: Creating...

Error: Error waiting for on update for Recovery Service Vault "example-recovery-vault" (Resource Group "rg-example-recovery-vault"): Error updating Recovery Service Vault Cfg "example-recovery-vault" (Resource Group "rg-example-recovery-vault"): backup.ResourceVaultConfigsClient#Update: Failure responding to request: StatusCode=404 -- Original Error: autorest/azure: Service returned an error. Status=404 Code="SubscriptionNotFound" Message="The subscription '' could not be found."

  on main.tf line 12, in resource "azurerm_recovery_services_vault" "vault":
  12: resource "azurerm_recovery_services_vault" "vault" {

Steps to Reproduce

  1. terraform apply

Important Factoids

This issue appears to affect all sovereign clouds, but only has been tested in US Government.

o.ResourceManagerEndpoint should be passed in to backup.NewResourceVaultConfigsClient on the line below:

https://github.com/terraform-providers/terraform-provider-azurerm/blob/v1.43.0/azurerm/internal/services/recoveryservices/client/client.go#L26

References

@ghost
Copy link

ghost commented Feb 24, 2020

This has been released in version 2.0.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.0.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Mar 28, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants