[英]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)
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.