Bart C
Bart C

Reputation: 1557

Provider versions set in required_providers, but terraform still complains

I'm trying to set the version of my providers in a new manner in required_providers like so

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"
}

In line with the docs here and here

However, when I run terraform init I still get the following output.

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"

Am I doing something wrong?

Here is the whole output from the 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.

Upvotes: 5

Views: 4323

Answers (1)

Marian Bazalik
Marian Bazalik

Reputation: 1405

Making @MartinAtkins' comment into an answer:

These -/name providers are temporary representations of non-namespaced provider references in your state. If you run terraform apply then it should create a new state snapshot with those upgraded automatically (based on the configuration) and then future terraform init runs should not mention them again.

Upvotes: 3

Related Questions