Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tfupdate version constraints #388

Closed
chris3ware opened this issue May 25, 2022 · 1 comment
Closed

tfupdate version constraints #388

chris3ware opened this issue May 25, 2022 · 1 comment
Assignees
Labels
estimate/4h Need 4 hours to be done feature New feature or request hook/tfupdate Bash hook

Comments

@chris3ware
Copy link

chris3ware commented May 25, 2022

What problem are you facing?

I am trying to integrate tfupdate into my pre-commit configuration. It works perfectly for exact versions i.e:

- --args=--version 0.7.1

tfupdate also supports terraform version constraints - but I am struggling to use this functionality with pre-commit so I wondered if it was supported or if I was doing something wrong?

My attempted configuration looks like this:

- id: tfupdate
  name: Terraform provider version SOPS
   args:
       - --args=provider sops
       - --args=--version ">= 0.7.1"

The error returned when running pre-commit run is this:

Terraform provider version SOPS..........................................Failed
- hook id: tfupdate
- exit code: 1

The command expects 2 arguments, but got 3

The associated tfupdate command (tfupdate provider --version ">= 0.7.1" --recursive sops .) run from the CLI works as expected.

How could pre-commit-terraform help solve your problem?

Should terraform pre-commit accept version constraint arguments for tfupdate? A good use case for this is required_providers in a module. For example for current AWS provider looks like this - but I don't think I can enforce this with pre-commit tfupdate currently.

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">= 3.71.0, < 4.0.0"
    }
}

My tfupdate version is: 0.6.5
pre-commit terraform version is: 1.71.0

@MaxymVlasov
Copy link
Collaborator

This issue has been resolved in version 1.76.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
estimate/4h Need 4 hours to be done feature New feature or request hook/tfupdate Bash hook
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants