Skip to content

supratim-persistent/terraform-module-version-checker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-module-version-checker

This is a neat utility to keep track of your terraform module versions. If you are using terraform modules tagged with versions for updates relased frequently and eventually calling those versioned modules in your repository, this utility does a good job in tracking if any new version of the module is released and creates an issue in your current reposiotory for upgrading to the new version.

It also does not duplicate issue meaning if an issue has already been created for a module version upgrade, it does not recreate that issue again, however, if a new module version has been released after the issue has been created, it simply updates the issue with the new module version to be upgarded instead of creating another issue.

Note: For checking duplicate issues, the utility checks the list of open issue titles with the string Upgarde <module_name> to latest version as shown below since it creates the issues with the same title, so any issue created for module upgrade manually should stick to the same format to avoid duplications.

Issues Page

Few points to consider:

The utility looks for module references in main.tf files only.

The utility looks for a specific format in which the module is referenced in the main.tf file from the downstream module which is as below. Without the module being referenced with version ref as shown below will result in errors on running this action.

module "rg" {

  source  = "git::[email protected]:<repo_owner>/<repo_name>.git//services/resource-group?ref=v0.1.6"
  ## Example : source  = "git::[email protected]:persistentsystems/some-terraform-repo.git//services/resource-group/base/v1?ref=v0.1.6"

  context = local.context
  name = "${local.context.application_name}-${local.context.environment_name}"

}

Example Usage

  1. Set up a workflow yaml in your repository to run this action on a schedule say every day at a specific time as shown below
on:
  schedule:
    # * is a special character in YAML so you have to quote this string
    - cron:  '*/15 * * * *'
  1. Checkout the repo that contains the modules for which module version has to be tracked
- name: Checkout Code
  uses: actions/checkout@v2
  1. Run the action as below with the mandatory input variables.
- name: Terraform Module Version Checker
  uses: supratim-persistent/terraform-module-version-checker@v2
  with:
    REPO_OWNER: '<TO BE POPULATED>'
    REPO_NAME: '<TO BE POPULATED>'
    GITHUB_OAUTH_TOKEN: ${{ secrets.GIT_AUTH_TOKEN }}

Complete Example with the workflow pipeline

name: TF Version Checker
on: 
  schedule:
  - cron: '05 0 * * *'

jobs:
  TF-CHECKER:
    runs-on: ubuntu-latest
    name: tf module version checker
    steps:
    - name: Checkout Code
      uses: actions/checkout@v2
    - name: Terraform Module Version Checker
      uses: supratim-persistent/terraform-module-version-checker@v2
      with:
        REPO_OWNER: '<TO BE POPULATED>'
        REPO_NAME: '<TO BE POPULATED>'
        GITHUB_OAUTH_TOKEN: ${{ secrets.GIT_AUTH_TOKEN }}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages