首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >需要Terraform Opsgenie字符串值

需要Terraform Opsgenie字符串值
EN

Stack Overflow用户
提问于 2021-04-08 22:51:55
回答 1查看 179关注 0票数 0

我只是简单地试着为opsgenie提供一个terrafomr init

我的terraform版本是:

代码语言:javascript
复制
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

我的提供者是:

代码语言:javascript
复制
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"
    }
  }

我得到的错误是:

代码语言:javascript
复制
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.
EN

回答 1

Stack Overflow用户

发布于 2021-04-09 06:03:10

您的TF是太旧的,而您的语法是新的。来自docs

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

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

代码语言:javascript
复制
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"
  }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67006539

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档