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

Updating terraform required_providers version #8746

Closed
syphernl opened this issue Feb 18, 2021 · 8 comments · Fixed by #8791
Closed

Updating terraform required_providers version #8746

syphernl opened this issue Feb 18, 2021 · 8 comments · Fixed by #8791
Assignees
Labels
auto:reproduction A minimal reproduction is necessary to proceed manager:terraform Terraform package manager priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:feature Feature (new functionality)

Comments

@syphernl
Copy link

What would you like Renovate to be able to do?

Currently Renovate updates .terraform-version and our Docker tag reference in .gitlab-ci.yml however in versions.tf we have a version too which is not being updated by Renovate and requires manual intervention to do so.

The versions.tf file looks like this:

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "3.28.0"
    }
    gitlab = {
      source  = "gitlabhq/gitlab"
      version = "3.4.0"
    }
    random = {
      source  = "hashicorp/random"
      version = "3.0.1"
    }
  }
  required_version = "0.14.6"
}

I would have expected the required_version to be updated from 0.14.6 to 0.14.7 during the Renovate run.

Did you already have any implementation ideas?

Probably looking for the same version in required_providers and update it.
If it is a non-specific version (e.g. >= 0.13) it should probably take care of that as well in case the minor version goes up (e.g. 0.14.7 -> 0.15.0)

@rarkins rarkins added manager:terraform Terraform package manager priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others auto:reproduction A minimal reproduction is necessary to proceed status:requirements Full requirements are not yet known, so implementation should not be started type:feature Feature (new functionality) labels Feb 18, 2021
@github-actions
Copy link
Contributor

Hi there,

The Renovate team needs your help! To fix the problem, we first need to know exactly what's causing the bug. A minimal reproduction help us to pinpoint the exact cause of the bug.

To get started, please read our guide on minimal reproductions to understand what is needed.

We may close the issue if you have not provided a minimal reproduction within two weeks. If you need more time, or are stuck, please ask for help or more time in a comment.

Good luck,

The Renovate team

@github-actions
Copy link
Contributor

This issue has been labeled with status:requirements. This indicates that we don't know enough to start work and further requirements or a reproduction are needed first.

This label will be replaced with status:ready once all requirements and reproductions necessary to start work have been met.

If it's not clear what is missing to move this issue forward, ask for clarification in a new comment. If you think we already have what we need to move forward, mention this in a new comment.

@rarkins
Copy link
Collaborator

rarkins commented Feb 18, 2021

This needs logic added to the lib/manager/terraform/extract.ts so that it detects required_version and extracts it as a dependency

@viceice
Copy link
Member

viceice commented Feb 18, 2021

Workaround using a regex manager:

   {
      "fileMatch": ["\\.tf$"],
      "matchStrings": ["required_version\\s*=\\s*\"(?<currentValue>.+?)\""],
      "datasourceTemplate": "docker",
      "versioningTemplate": "hashicorp",
      "depNameTemplate": "hashicorp/terraform"
    }

@syphernl
Copy link
Author

Awesome, thanks for the workaround @viceice 👍🏻!

@secustor
Copy link
Collaborator

@rarkins you can assign me this.

IMHO there should be a way to opt out of required_* updates. Maybe be a new package rule matcher could solve this.

@rarkins
Copy link
Collaborator

rarkins commented Feb 18, 2021

@secustor you could assign a depType perhaps? The way depType is used today by terraform/extract is a little redundant with datasource, although if you were to remove them then it would be a backwards-incompatible change needing a migration. e.g.

    Object {
      "datasource": "helm",
      "depName": "./charts/example",
      "depType": "helm",
      "registryUrls": Array [
        undefined,
      ],
      "skipReason": "local-chart",
    },

@rarkins rarkins added status:ready and removed status:requirements Full requirements are not yet known, so implementation should not be started labels Feb 18, 2021
@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 24.60.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto:reproduction A minimal reproduction is necessary to proceed manager:terraform Terraform package manager priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:feature Feature (new functionality)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants