0

我有非常简单的地形代码。

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "=2.46.0"
    }

    azuread = {
      source  = "hashicorp/azuread"
      version = "~> 2.0.0"
    }

  }
}

provider "azurerm" {
  features {}
}

provider "azuread" {
  tenant_id       = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

terraform {
  backend "azurerm" {
      resource_group_name = "xxxx"
      storage_account_name = "xxxxxxxxx"
      container_name = "xxxxxxxxxxxxx"
      key = "xxxxxxxxxxxxxxxxx"
      
    }
 }

data "azuread_client_config" "current" {}

resource "azurerm_resource_group" "test" {
  name     = "test-rg-005"
  location = "East US"
}


resource "azuread_application" "example" {
  display_name = "Example-app"
}

但是,当我通过 azure devops 上的 yml 管道运行它时,我在应用阶段收到此错误。

Plan: 1 to add, 0 to change, 0 to destroy.

azuread_application.example: Creating...

│ Error: Could not create application
│ 
│   with azuread_application.example,
│   on terraform.tf line 42, in resource "azuread_application" "example":
│   42: resource "azuread_application" "example" {
│ 
│ json.Marshal(): json: error calling MarshalJSON for type
│ msgraph.Application: json: error calling MarshalJSON for type
│ *msgraph.Owners: marshaling Owners: encountered DirectoryObject with nil
│ ODataId

##[error]Error: The process '/opt/hostedtoolcache/terraform/1.0.5/x64/terraform' failed with 
exit code 1

任何线索都会有所帮助,但不清楚这个错误是关于什么的?

谢谢。

4

1 回答 1

0

MSFT 更新后,Azure Active Directory 提供程序中存在错误。这会影响创建新资源的任何 azure 广告提供商使用,但它似乎正在处理已部署的资源,即更改和升级 azure ad 中已部署资源的配置。以下是错误更新的链接。

https://github.com/hashicorp/terraform-provider-azuread/issues/588

于 2021-10-06T15:01:47.580 回答