minamijoyo / tfupdate

Update version constraints in your Terraform configurations
MIT License
539 stars 23 forks source link

Support a configuration file to pin versions recursively #75

Open nitrocode opened 1 year ago

nitrocode commented 1 year ago

It would be nice if tfupdate could support a configuration file to pin versions recursively. Then we could have a config in our mono infra repo and run a single command in a pre-commit hook and in our gh action to ensure we use the verified versions.

I was thinking of the following config, similar to tflint

#.tfupdate.hcl
tfupdate {
  recursive = true

  terraform {
    required_version = "> 1.0.0"

    providers = {
      "aws" = {
        source = "hashicorp/aws"
        version = "~> 4"
      }
      "tls" = {
        source = "hashicorp/tls"
        version = "~> 3"
      }
      # 50 other providers with specific versions
    }
  }
}

Then we can run the command without having to string together multiple commands

tfupdate