Terraform Azure订阅创建问题

nwsw7zdq  于 2023-06-30  发布在  其他
关注(0)|答案(2)|浏览(128)

Terraform版本

1.5.1

Terraform配置文件

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
}

调试输出

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

预期行为

显示创建的资源

实际行为

它永远挂起,命令永远不会完成

复制步骤

1.地形初始化
1.地形图

附加上下文

  • 没有回应 *

参考资料

  • 没有回应 *
5vf7fwbs

5vf7fwbs1#

需验证如下:

1.这主要是一个与地形有关的问题,但这是一个非常暂时的问题。根据您提供的调试日志,问题出在事件中心提供程序版本上。确保所有提供程序都已更新并与所需版本兼容。

  • 注意:* 这些问题会在一段时间后消失。如果问题仍然存在,请卸载Terraform安装程序并从头开始重新安装,以避免任何冲突。

1.检查代码中提供的订阅是否有效。
1.确定与Terraform安装程序连接的Azure AD应用程序必须能够访问订阅详细信息。验证应用程序是否已分配必要的角色,如“所有者”或“参与者”,以便访问订阅详细信息。
1.重新启动terraform配置设置并再次运行terraform。尝试再次清除该高速缓存。
1.使用terraform refresh命令更新/刷新当前地形状态配置。

  • 我尝试了你的要求在我的,它是成功的工作如下:*
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
}
  • 输出:*

  • 注意:* azurerm_subscription资源目前处于实验状态,有时Azure提供商并不完全支持它。这可能是运行terraform apply时没有得到任何响应的原因。
7ivaypg9

7ivaypg92#

来自MS API的响应消息表明EventHub进入了“注册”状态--这可能需要很长时间。
您可以通过运行az provider show --namespace Microsoft.EventHub -o table来检查它是否同时完成了--如果完成了,它应该说registered。注册提供程序后,您应该再次运行,以便调用负责创建订阅的提供程序(根据此处的API文档为Microsoft.Subscription

相关问题