簡體   English   中英

Terraform Azuread 提供商授權錯誤

[英]Terraform Azuread provider Authorizer Error

我的 GitLab CI/CD 管道拋出 Terraform Azuread 提供商授權錯誤,這已成為我的主要障礙,我根本找不到繞過它的方法。

我的 Terraform 配置包括一個data.tf文件,該文件具有以下單行條目:

data "azuread_client_config" "current" {}

我還有一個provider.tf文件,其內容包括以下 azuread 提供程序塊:

provider "azuread" {
   tenant_id = "#TenantID#"
   use_cli = "false"
}

運行 GitLab CI/CD 管道,拋出以下錯誤:

Error: no Authorizer could be configured, please check your configuration

with provider ["registry.terraform.io/hashicorp/azuread"],
on provider.tf line 29, in provider "azuread":
29: provider "azuread" {

如果我從我的 terraform 配置中排除 data.tf 文件或注釋掉它的單行條目,管道運行時不會拋出任何錯誤。 在包含 data.tf 文件后,我做錯了什么,或者我需要做什么才能使管道成功運行?

數據來源:azuread_client_config

使用此數據源訪問 AzureAD 提供程序的配置。

#這是在 Terraform 通過 Azure CLI 進行身份驗證時

data "azuread_client_config" "current" {}

output "object_id" {
  value = data.azuread_client_config.current.object_id
}

#配置 Azure Active Directory Provider

provider "azuread" {

  # NOTE: Environment Variables can also be used for Service Principal authentication

  # client_id     = "..."
  # client_secret = "..."
  # tenant_id     = "..."
}

因此,如果您在 provider.tf 文件中使用provider azuread {} ,建議您從data.tf文件中刪除data "azuread_client_config" "current" {}行。 因為您已經在使用 Service Principle 進行身份驗證,所以沒有必要使用azuread 的數據源

您還可以參考此文檔,了解 Azure Active Directory Provider 支持的Data SourcesResources

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM