【问题标题】:Issue using third party providers in terraform for azure-devops and mysql provider在 terraform 中为 azure-devops 和 mysql 提供程序使用第三方提供程序的问题
【发布时间】:2021-11-15 07:00:10
【问题描述】:

在执行 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

【问题讨论】:

    标签: terraform terraform-provider-azure terraform-provider


    【解决方案1】:

    这里的任何人都在寻找答案,对于任何第三方提供商,我们也需要在模块中添加源代码。就像我必须在模块中添加 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)
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2023-01-22
      • 2020-08-31
      • 2021-07-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-28
      相关资源
      最近更新 更多