Terraform

Terraform

Made by DeepSource

Provider doesn't have version constraint TF-L0047

Bug risk
Major

All providers should have version constraints through required_providers.

Providers are plugins released on a separate rhythm from Terraform itself, and so they have their own version numbers. For production use, you should constrain the acceptable provider versions via configuration, to ensure that new versions with breaking changes will not be automatically installed by terraform init in future.

Example:

provider "template" {}

provider "template" {
  version = "2"
}

To fix this: Add the required_providers block to the terraform configuration block and include current versions for all providers. For example:

terraform {
  required_providers {
    template = "~> 2.0"
  }
}

Provider version constraints can be specified using a version argument within a provider block for backwards compatibility. This approach is now discouraged, particularly for child modules.