我正在像这样在required_providers中尝试以新的方式设置提供商的版本
terraform {
required_providers {
cloudflare = {
source = "cloudflare/cloudflare"
version = "~> 2.11.0"
}
google = {
source = "hashicorp/google"
version = "~> 3.39.0"
}
kubernetes = {
source = "hashicorp/kubernetes"
version = "~> 1.13.2"
}
vault = {
source = "hashicorp/vault"
version = "~> 2.14.0"
}
}
required_version = "~> 0.13.2"
}
但是,当我运行terraform init
时,仍然得到以下输出。
The following providers do not have any version constraints in configuration,
so the latest version was installed.
To prevent automatic upgrades to new major versions that may contain breaking
changes, we recommend adding version constraints in a required_providers block
in your configuration, with the constraint strings suggested below.
* -/google: version = "~> 3.39.0"
* -/kubernetes: version = "~> 1.13.2"
* -/vault: version = "~> 2.14.0"
我做错什么了吗?
这是terraform init
❯ terraform init
Initializing the backend...
Initializing provider plugins...
- Finding latest version of -/google...
- Finding latest version of -/kubernetes...
- Finding latest version of -/vault...
- Finding hashicorp/google versions matching "~> 3.39.0"...
- Finding hashicorp/kubernetes versions matching "~> 1.13.2"...
- Finding hashicorp/vault versions matching "~> 2.14.0"...
- Finding cloudflare/cloudflare versions matching "~> 2.11.0"...
- Installing hashicorp/google v3.39.0...
- Installed hashicorp/google v3.39.0 (signed by HashiCorp)
- Installing hashicorp/kubernetes v1.13.2...
- Installed hashicorp/kubernetes v1.13.2 (signed by HashiCorp)
- Installing hashicorp/vault v2.14.0...
- Installed hashicorp/vault v2.14.0 (signed by HashiCorp)
- Installing cloudflare/cloudflare v2.11.0...
- Installed cloudflare/cloudflare v2.11.0 (signed by a HashiCorp partner, key ID DE413CEC881C3283)
- Installing -/google v3.39.0...
- Installed -/google v3.39.0 (signed by HashiCorp)
- Installing -/kubernetes v1.13.2...
- Installed -/kubernetes v1.13.2 (signed by HashiCorp)
- Installing -/vault v2.14.0...
- Installed -/vault v2.14.0 (signed by HashiCorp)
Partner and community providers are signed by their developers.
If you\'d like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/plugins/signing.html
The following providers do not have any version constraints in configuration,
so the latest version was installed.
To prevent automatic upgrades to new major versions that may contain breaking
changes, we recommend adding version constraints in a required_providers block
in your configuration, with the constraint strings suggested below.
* -/google: version = "~> 3.39.0"
* -/kubernetes: version = "~> 1.13.2"
* -/vault: version = "~> 2.14.0"
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.