在 terraform 中为 azure-devops 和 mysql 提供商使用第三方提供商的问题

Issue using third party providers in terraform for azure-devops and mysql provider

在执行 terraform init 时出现错误,按照 terraform 官方文档,我正在尝试通过 terraform 创建 azure-pipeline 并为其创建模块,但无法初始化,如果我直接传递它,它工作正常.tf 文件,但在添加到模块时,terraform init 命令本身失败。

╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/mysql: provider registry registry.terraform.io does not have a provider named       
│ registry.terraform.io/hashicorp/mysql
│
│ Did you intend to use terraform-providers/mysql? If so, you must specify that source address in each module which requires that provider. To see which       
│ modules are currently depending on hashicorp/mysql, run the following command:
│     terraform providers
╵

╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/azuredevops: provider registry registry.terraform.io does not have a provider named 
│ registry.terraform.io/hashicorp/azuredevops
│
│ Did you intend to use microsoft/azuredevops? If so, you must specify that source address in each module which requires that provider. To see which modules   
│ are currently depending on hashicorp/azuredevops, run the following command:
│     terraform providers

任何在这里寻找答案的人,对于任何第三方提供商,我们也需要在模块中添加源代码。就像我必须在模块中添加 azure-devops 源一样

terraform {
  required_providers {
    azuredevops = {
      source = "microsoft/azuredevops"
      version = "0.1.7"
    }
  }
}

#Create Azure Repo and Azure Pipeline
data "azuredevops_project" "project" {
  name = "Test"
}

#Create New Repo
resource "azuredevops_git_repository" "repo" {
  project_id = data.azuredevops_project.project.id
  name       = var.name
  initialization {
    init_type   = "Import"
    source_type = "Git"
    source_url  = lookup(var.template_map,var.template)
  }
}