skip to Main Content

Terraform Version

1.5.1

Terraform Configuration Files

  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
    }
  }
}

# Configure the Microsoft Azure Provider
provider "azurerm" {
  features {}
}


data "azurerm_billing_enrollment_account_scope" "example" {
  billing_account_name    = "account holder name"
  enrollment_account_name = "NOYX-xxx-xxxx"
}

resource "azurerm_subscription" "example" {
  subscription_name = "My Example EA Subscription"
  billing_scope_id  = data.azurerm_billing_enrollment_account_scope.example.id
}

Debug Output

2023-06-26T10:37:41.381+0530 [DEBUG] provider.terraform-provider-azurerm_v3.62.1_x5.exe: AzureRM Request: 
GET /subscriptions/45bd2bdb-be9a-4e7c-9358-944ba5a90060/providers/Microsoft.EventHub?api-version=2022-09-01 HTTP/1.1
Host: management.azure.com
User-Agent: Go/go1.20.5 (amd64-windows) go-autorest/v14.2.1 hashicorp/go-azure-sdk/providers/2022-09-01 HashiCorp Terraform/1.5.1 (+https://www.terraform.io) Terraform Plugin SDK/2.10.1 terraform-provider-azurerm/3.62.1 pid-222c6c49-1b0a-5959-a213-6608f9eb8820
Content-Type: application/json; charset=utf-8
X-Ms-Correlation-Request-Id: 7367ad54-9cd7-1084-a740-4fd2e6d3e649
Accept-Encoding: gzip: timestamp=2023-06-26T10:37:41.381+0530
2023-06-26T10:37:41.426+0530 [DEBUG] provider.terraform-provider-azurerm_v3.62.1_x5.exe: AzureRM Response for https://management.azure.com/subscriptions/45bd2bdb-be9a-4e7c-9358-944ba5a90060/providers/Microsoft.EventHub?api-version=2022-09-01: 
HTTP/2.0 200 OK
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Mon, 26 Jun 2023 05:07:40 GMT
Expires: -1
Pragma: no-cache
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Ms-Correlation-Request-Id: 7367ad54-9cd7-1084-a740-4fd2e6d3e649
X-Ms-Ratelimit-Remaining-Subscription-Reads: 11997
X-Ms-Request-Id: b729746a-4630-4299-b489-58f02562c41c
X-Ms-Routing-Request-Id: WESTINDIA:20230626T050741Z:b729746a-4630-4299-b489-58f02562c41c

{"id":"/subscriptions/45bd2bdb-be9a-4e7c-9358-944ba5a90060/providers/Microsoft.EventHub","namespace":"Microsoft.EventHub","authorizations":[{"applicationId":"80369ed6-5f11-4dd9-bef3-692475845e77","roleDefinitionId":"eb8e1991-5de0-42a6-a64b-29b059341b7b"},{"applicationId":"6201d19e-14fb-4472-a2d6-5634a5c97568"}],"resourceTypes":[{"resourceType":"namespaces","locations":["Australia Central","Australia East","Australia Southeast","Brazil South","Canada Central","Canada East","Central India","Central US","East Asia","East US","East US 2","France Central","Germany West Central","Japan East","Japan West","Korea Central","Korea South","North Central US","North Europe","Norway East","Poland Central","Qatar Central","South Africa North","South Central US","South India","Southeast Asia","Sweden Central","Switzerland North","UAE North","UK South","UK West","West Central US","West Europe","West India","West US","West US 2","West US 3"],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview","2021-11-01","2021-06-01-preview","2021-01-01-preview","2018-01-01-preview","2017-04-01","2015-08-01","2014-09-01"],"defaultApiVersion":"2017-04-01","apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-04-01"}],"capabilities":"CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SystemAssignedResourceIdentity, SupportsTags, SupportsLocation"},{"resourceType":"clusters","locations":["Australia Central","Australia East","Australia Southeast","Brazil South","Canada Central","Canada East","Central India","Central US","East Asia","East US","East US 2","France Central","Germany West Central","Japan East","Japan West","Korea Central","Korea South","North Central US","North Europe","Norway East","Poland Central","Qatar Central","South Africa North","South Central US","Southeast Asia","South India","Sweden Central","Switzerland North","UAE North","UK South","UK West","West Central US","West Europe","West India","West US","West US 2","West US 3"],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview","2021-11-01","2021-06-01-preview","2018-01-01-preview"],"capabilities":"CrossResourceGroupResourceMove, CrossSubscriptionResourceMove, SupportsTags, SupportsLocation"},{"resourceType":"namespaces/authorizationrules","locations":["Australia Central","Australia East","Australia Southeast","Brazil South","Brazil Southeast","Canada Central","Canada East","Central India","Central US","East Asia","East US","East US 2","France Central","Germany West Central","Japan East","Japan West","Korea Central","Korea South","North Central US","North Europe","Norway East","Poland Central","Qatar Central","South Africa North","South Central US","Southeast Asia","South India","Sweden Central","Switzerland North","UAE North","UK South","UK West","West Central US","West Europe","West India","West US","West US 2","West US 3"],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview","2021-11-01","2021-06-01-preview","2021-01-01-preview","2018-01-01-preview","2017-04-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-04-01"}],"capabilities":"None"},{"resourceType":"namespaces/networkrulesets","locations":["Australia Central","Australia East","Australia Southeast","Brazil South","Canada Central","Canada East","Central India","Central US","East Asia","East US","East US 2","France Central","Germany West Central","Japan East","Japan West","Korea Central","Korea South","North Central US","North Europe","Norway East","Poland Central","Qatar Central","South Africa North","South Central US","Southeast Asia","South India","Sweden Central","Switzerland North","UAE North","UK South","UK West","West Central US","West Europe","West India","West US","West US 2","West US 3"],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview","2021-11-01","2021-06-01-preview","2021-01-01-preview","2018-01-01-preview","2017-04-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-04-01"}],"capabilities":"None"},{"resourceType":"namespaces/privateEndpointConnections","locations":["Australia Central","Australia East","Australia Southeast","Brazil South","Canada Central","Canada East","Central India","Central US","East Asia","East US","East US 2","France Central","Germany West Central","Japan East","Japan West","Korea Central","Korea South","North Central US","North Europe","Norway East","Poland Central","Qatar Central","South Africa North","South Central US","Southeast Asia","South India","Sweden Central","Switzerland North","UAE North","UK South","UK West","West Central US","West Europe","West India","West US","West US 2","West US 3"],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview","2021-11-01","2021-06-01-preview","2021-01-01-preview","2018-01-01-preview"],"capabilities":"None"},{"resourceType":"namespaces/privateEndpointConnectionProxies","locations":["Australia Central","Australia East","Australia Southeast","Brazil South","Canada Central","Canada East","Central India","Central US","East Asia","East US","East US 2","France Central","Germany West Central","Japan East","Japan West","Korea Central","Korea South","North Central US","North Europe","Norway East","Poland Central","Qatar Central","South Africa North","South Central US","Southeast Asia","South India","Sweden Central","Switzerland North","UAE North","UK South","UK West","West Central US","West Europe","West India","West US","West US 2","West US 3"],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview","2021-11-01","2021-06-01-preview","2021-01-01-preview","2018-01-01-preview"],"capabilities":"None"},{"resourceType":"namespaces/networkSecurityPerimeterConfigurations","locations":["Australia Central","Australia East","Australia Southeast","Brazil South","Canada Central","Canada East","Central India","Central US","East Asia","East US","East US 2","France Central","Germany West Central","Japan East","Japan West","Korea Central","Korea South","North Central US","North Europe","Norway East","Poland Central","Qatar Central","South Africa North","South Central US","Southeast Asia","South India","Sweden Central","Switzerland North","UAE North","UK South","UK West","West Central US","West Europe","West India","West US","West US 2","West US 3"],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview"],"capabilities":"None"},{"resourceType":"namespaces/networkSecurityPerimeterAssociationProxies","locations":["Australia Central","Australia East","Australia Southeast","Brazil South","Canada Central","Canada East","Central India","Central US","East Asia","East US","East US 2","France Central","Germany West Central","Japan East","Japan West","Korea Central","Korea South","North Central US","North Europe","Norway East","Poland Central","Qatar Central","South Africa North","South Central US","Southeast Asia","South India","Sweden Central","Switzerland North","UAE North","UK South","UK West","West Central US","West Europe","West India","West US","West US 2","West US 3"],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview"],"capabilities":"None"},{"resourceType":"namespaces/eventhubs","locations":["Australia Central","Australia East","Australia Southeast","Brazil South","Brazil Southeast","Canada Central","Canada East","Central India","Central US","East Asia","East US","East US 2","France Central","Germany West Central","Japan East","Japan West","Korea Central","Korea South","North Central US","North Europe","Norway East","Poland Central","Qatar Central","South Africa North","South Central US","Southeast Asia","South India","Sweden Central","Switzerland North","UAE North","UK South","UK West","West Central US","West Europe","West India","West US","West US 2","West US 3"],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview","2021-11-01","2021-06-01-preview","2021-01-01-preview","2018-01-01-preview","2017-04-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-04-01"}],"capabilities":"None"},{"resourceType":"namespaces/eventhubs/authorizationrules","locations":["Australia Central","Australia East","Australia Southeast","Brazil South","Brazil Southeast","Canada Central","Canada East","Central India","Central US","East Asia","East US","East US 2","France Central","Germany West Central","Japan East","Japan West","Korea Central","Korea South","North Central US","North Europe","Norway East","Poland Central","Qatar Central","South Africa North","South Central US","Southeast Asia","South India","Sweden Central","Switzerland North","UAE North","UK South","UK West","West Central US","West Europe","West India","West US","West US 2","West US 3"],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview","2021-11-01","2021-06-01-preview","2021-01-01-preview","2018-01-01-preview","2017-04-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-04-01"}],"capabilities":"None"},{"resourceType":"namespaces/eventhubs/consumergroups","locations":["Australia Central","Australia East","Australia Southeast","Brazil South","Brazil Southeast","Canada Central","Canada East","Central India","Central US","East Asia","East US","East US 2","France Central","Germany West Central","Japan East","Japan West","Korea Central","Korea South","North Central US","North Europe","Norway East","Poland Central","Qatar Central","South Africa North","South Central US","Southeast Asia","South India","Sweden Central","Switzerland North","UAE North","UK South","UK West","West Central US","West Europe","West India","West US","West US 2","West US 3"],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview","2021-11-01","2021-06-01-preview","2021-01-01-preview","2018-01-01-preview","2017-04-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-04-01"}],"capabilities":"None"},{"resourceType":"namespaces/applicationGroups","locations":["Australia Central","Australia East","Australia Southeast","Brazil South","Canada Central","Canada East","Central India","Central US","East Asia","East US","East US 2","France Central","Germany West Central","Japan East","Japan West","Korea Central","Korea South","North Central US","North Europe","Norway East","Poland Central","Qatar Central","South Africa North","South Central US","Southeast Asia","South India","Sweden Central","Switzerland North","UAE North","UK South","UK West","West Central US","West Europe","West India","West US","West US 2","West US 3"],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview"],"capabilities":"None"},{"resourceType":"checkNamespaceAvailability","locations":[],"apiVersions":["2015-08-01","2014-09-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2015-08-01"}],"capabilities":"None"},{"resourceType":"checkNameAvailability","locations":[],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview","2021-11-01","2021-06-01-preview","2021-01-01-preview","2018-01-01-preview","2017-04-01","2015-08-01","2014-09-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-04-01"}],"capabilities":"None"},{"resourceType":"sku","locations":[],"apiVersions":["2017-04-01","2015-08-01","2014-09-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-04-01"}],"capabilities":"None"},{"resourceType":"operations","locations":[],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview","2021-11-01","2021-06-01-preview","2021-01-01-preview","2018-01-01-preview","2017-04-01","2015-08-01","2014-09-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-04-01"}],"capabilities":"None"},{"resourceType":"namespaces/disasterrecoveryconfigs","locations":["Australia Central","Australia East","Australia Southeast","Brazil South","Canada Central","Canada East","Central India","Central US","East Asia","East US","East US 2","France Central","Germany West Central","Japan East","Japan West","Korea Central","Korea South","North Central US","North Europe","Norway East","Poland Central","Qatar Central","South Africa North","South Central US","Southeast Asia","South India","Sweden Central","Switzerland North","UAE North","UK South","UK West","West Central US","West Europe","West India","West US","West US 2","West US 3"],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview","2021-11-01","2021-06-01-preview","2021-01-01-preview","2018-01-01-preview","2017-04-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-04-01"}],"capabilities":"None"},{"resourceType":"namespaces/disasterrecoveryconfigs/checkNameAvailability","locations":["Australia Central","Australia East","Australia Southeast","Brazil South","Canada Central","Canada East","Central India","Central US","East Asia","East US","East US 2","France Central","Germany West Central","Japan East","Japan West","Korea Central","Korea South","North Central US","North Europe","Norway East","Poland Central","Qatar Central","South Africa North","South Central US","Southeast Asia","South India","Sweden Central","Switzerland North","UAE North","UK South","UK West","West Central US","West Europe","West India","West US","West US 2","West US 3"],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview","2021-11-01","2021-06-01-preview","2021-01-01-preview","2018-01-01-preview","2017-04-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-04-01"}],"capabilities":"None"},{"resourceType":"locations","locations":[],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview","2021-11-01","2021-06-01-preview","2021-01-01-preview","2018-01-01-preview","2017-04-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-04-01"}],"capabilities":"None"},{"resourceType":"locations/operationStatus","locations":[],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview"],"capabilities":"None"},{"resourceType":"locations/clusterOperationResults","locations":["Australia Central","Australia East","Australia Southeast","Brazil South","Canada Central","Canada East","Central India","Central US","East Asia","East US","East US 2","France Central","Germany West Central","Japan East","Japan West","Korea Central","Korea South","North Central US","North Europe","Norway East","Poland Central","Qatar Central","South Africa North","South Central US","Southeast Asia","South India","Sweden Central","Switzerland North","UAE North","UK South","UK West","West Central US","West Europe","West India","West US","West US 2","West US 3"],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview","2021-11-01","2021-06-01-preview","2021-01-01-preview","2018-01-01-preview"],"capabilities":"None"},{"resourceType":"locations/namespaceOperationResults","locations":["Australia Central","Australia East","Australia Southeast","Brazil South","Canada Central","Canada East","Central India","Central US","East Asia","East US","East US 2","France Central","Germany West Central","Japan East","Japan West","Korea Central","Korea South","North Central US","North Europe","Norway East","Poland Central","Qatar Central","South Africa North","South Central US","Southeast Asia","South India","Sweden Central","Switzerland North","UAE North","UK South","UK West","West Central US","West Europe","West India","West US","West US 2","West US 3"],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview","2021-11-01","2021-06-01-preview","2021-01-01-preview","2018-01-01-preview","2017-04-01"],"capabilities":"None"},{"resourceType":"locations/notifyNetworkSecurityPerimeterUpdatesAvailable","locations":["East US","East US 2","South Central US","Australia Central","Australia Central 2","Australia East","Australia Southeast","Brazil South","Brazil SouthEast","Canada Central","Canada East","Central India","Central US","Central US EUAP","East Asia","East US 2 EUAP","France Central","France South","Germany North","Germany West Central","Japan East","Japan West","Korea Central","Korea South","North Central US","North Europe","Norway East","Norway West","Poland Central","Qatar Central","South Africa North","South Africa West","Southeast Asia","South India","Sweden Central","Switzerland North","Switzerland West","UAE Central","UAE North","UK South","UK West","West Central US","West Europe","West India","West US","West US 2","West US 3"],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview"],"capabilities":"None"},{"resourceType":"locations/deleteVirtualNetworkOrSubnets","locations":["Australia Central","Australia East","Australia Southeast","Brazil South","Canada Central","Canada East","Central India","Central US","East Asia","East US","East US 2","France Central","Germany West Central","Japan East","Japan West","Korea Central","Korea South","North Central US","North Europe","Norway East","Poland Central","Qatar Central","South Africa North","South Central US","Southeast Asia","South India","Sweden Central","Switzerland North","UAE North","UK South","UK West","West Central US","West Europe","West India","West US","West US 2","West US 3"],"apiVersions":["2023-01-01-preview","2022-10-01-preview","2022-01-01-preview","2021-11-01","2021-06-01-preview","2021-01-01-preview","2018-01-01-preview","2017-04-01"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2017-04-01"}],"capabilities":"None"},{"resourceType":"availableClusterRegions","locations":[],"apiVersions":["2018-01-01-preview"],"apiProfiles":[{"profileVersion":"2018-06-01-profile","apiVersion":"2018-01-01-preview"}],"capabilities":"None"}],"registrationState":"Registering","registrationPolicy":"RegistrationRequired"}: timestamp=2023-06-26T10:37:41.424+0530

Expected Behavior

show what resources are created

Actual Behavior

it hangs for ever and command never completes

Steps to Reproduce

  1. terraform init
  2. terraform plan

Additional Context

No response

References

No response

2

Answers


  1. The response message from MS API says that EventHub entered the "registering" state — this can take a very long time.

    You can check if it finished in the meantime by running az provider show --namespace Microsoft.EventHub -o table — it should say registered if it has finished. After that provider has been registered you should run again so that it gets to calling the provider responsible for creating a Subscription which is Microsoft.Subscription according to their API Docs here

    Login or Signup to reply.
  2. Need to verify below:

    1. This is mainly a terraform-related issue but a very temporary one. Based on the debug logs you provided, the issue is with the event hub provider versions. Make sure that all the providers are updated and compatible with the desired versions.

      Note: These kinds of issues will go away after a while. If the issue persists, uninstall the Terraform setup and reinstall it from scratch to avoid any conflicts.

    2. Check whether the subscription provided in the code is actively working.

    3. Ascertain that the Azure AD application connected with the Terraform setup has to have access to subscription details. Verify if the application has the necessary roles assigned, like "Owner" or "Contributor," in order to access subscription details.

    4. Restart the terraform configuration set up and run terraform again. Try clearing the cache once again.

    5. Use terraform refresh command to update/refresh the current terraform state configuration.

    I tried your requirement in mine, and it was successfully working as follows:

    terraform {
      required_providers {
        azurerm = {
          source = "hashicorp/azurerm"
          version = "3.62.1"
        }
      }
    }
    provider "azurerm" {
      features {}
    }
    
    data "azurerm_billing_enrollment_account_scope" "example" {
      billing_account_name    = "xxxxxx"
      enrollment_account_name = "xxxxxx"
    }
    resource "azurerm_subscription" "example" {
      subscription_name = "My Example EA Subscription"
      billing_scope_id  = data.azurerm_billing_enrollment_account_scope.example.id
    }
    

    Output:

    enter image description here

    enter image description here

    Note: The azurerm_subscription resource is currently in an experimental form and at few times, it is not completely supportive by the Azure providers. This might be the reason for not getting any response when you run terraform apply.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search