【问题标题】:Terraform Opsgenie string value required需要 Terraform Opsgenie 字符串值
【发布时间】:2021-07-04 11:22:37
【问题描述】:

我只是想terrafomr init opsgenie 的提供者。

我的 terraform 版本是:

Terraform v0.12.6

Your version of Terraform is out of date! The latest version
is 0.14.10. You can update by downloading from www.terraform.io/downloads.html

我的提供者是:

terraform {
  # https://www.terraform.io/docs/configuration/terraform.html#specifying-a-required-terraform-version
  required_version = "~> 0.12"

  # https://www.terraform.io/docs/configuration/provider-requirements.html
  required_providers {
    opsgenie = {
      source  = "opsgenie/opsgenie",
      version = "~> 0"
    }
  }

我得到的错误是:

There are some problems with the configuration, described below.

The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.

Error: Invalid version constraint

  on provider.tf line 16, in terraform:
  16:     opsgenie = {
  17:       source = "opsgenie/opsgenie"
  18:       version = "0.6.3"
  19:     }

A string value is required for opsgenie.

【问题讨论】:

    标签: terraform opsgenie


    【解决方案1】:

    你的 TF 太旧了,你的语法是新的。来自docs

    在 Terraform v0.13 中添加了 required_providers 的 name = { source, version } 语法。以前版本的 Terraform 使用版本约束字符串而不是对象(如 mycloud = "~> 1.0"),并且无法指定提供程序源地址。如果您想编写一个适用于 Terraform v0.12 和 v0.13 的模块,请参阅下面的 v0.12-兼容提供程序要求。

    你可以试试old syntax(或者升级你的TF):

    terraform {
      # https://www.terraform.io/docs/configuration/terraform.html#specifying-a-required-terraform-version
      required_version = "~> 0.12"
    
      # https://www.terraform.io/docs/configuration/provider-requirements.html
      required_providers {
        opsgenie = "~> 0"
      }
    

    【讨论】:

      猜你喜欢
      • 2021-06-23
      • 2020-03-31
      • 2021-03-22
      • 1970-01-01
      • 2019-10-19
      • 2021-11-27
      • 1970-01-01
      • 2020-04-09
      • 1970-01-01
      相关资源
      最近更新 更多