简体   繁体   中英

Terraform provider restrictions

I'm encountering problems when trying to run terraform init -upgrade :

╷
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/aws: no     available releases match the given constraints >= 2.23.0, >= 2.46.0, >= 3.0.0, >=
│ 3.62.0, >= 3.69.0, ~> 3.69, >= 3.72.0, >= 4.0.0, >= 4.5.0, 4.5.0

I was able to run a similar setup with terraform version 3.74 in my main manifest before but I upgraded some modules and as far as I can see the current min version is 4.5.0 so I switched to that. I'm unsure if the current problem is caused by the

  ~> 3.69

from one of my included modules or if I'm missing something else.

My current provider configuration is the following:

terraform {
  required_version = ">= 1.0"
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "4.5.0"
    }
  }
}

I found some modules that use the ~> operator for their examples like:

./.terraform/modules/kubernetes_addon.velero_thanos_bucket/examples/notification/versions.tf:      version = "~> 3.69"
./.terraform/modules/kubernetes_addon.velero_thanos_bucket/examples/object/versions.tf:      version = "~> 3.69"
./.terraform/modules/s3_bucket_for_logs/examples/complete-legacy/versions.tf:      version = "~> 3.69.0"

I'm already using the newest version of those modules and they have been working when I was enforcing version 3.74 in the required_providers previously.

~> is a very stringent constraint, and so is = as you require above.

= (or no operator): Allows only one exact version number. Cannot be combined with other conditions.

~>: Allows only the rightmost version component to increment. For example, to allow new patch releases within a specific minor release, use the full version number: ~> 1.0.4 will allow installation of 1.0.5 and 1.0.10 but not 1.1.0. This is usually called the pessimistic constraint operator.

Something can't both be exactly 4.5.0 and greater than 3.69 but less than 4.0.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM