我只是简单地试着为opsgenie提供一个terrafomr init。
我的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.发布于 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):
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"
}https://stackoverflow.com/questions/67006539
复制相似问题