Giter Club home page Giter Club logo

devops-infra / action-terraform-copy-vars Goto Github PK

View Code? Open in Web Editor NEW
1.0 4.0 1.0 137 KB

GitHub Action automatically copying variables' definitions from a single file to many modules

Home Page: https://christophshyper.github.io/

License: MIT License

Dockerfile 25.82% Makefile 22.98% Shell 6.87% Python 44.34%
terraform terraform-modules terragrunt action-terraform github-action github-actions github-action-docker github-actions-docker docker dockerhub

action-terraform-copy-vars's Introduction

GitHub Action coping Terraform variables across modules

GitHub Action automatically copying variables' definitions from a single file to many modules.

Dockerized as devopsinfra/action-terraform-copy-vars.

Features:

  • It's main use will be everywhere where Terraform is used with more than one module in a monorepo.
  • Reads file defined with all_vars_file and will use whole definitions of variables from it.
  • For every module matching dirs_with_modules will search files matching files_with_vars and replace matching variables from all_vars_file.
  • To not loose the changes combine with my other action devops-infra/action-commit-push.

Badge swag

Master branch Other branches
GitHub repo GitHub code size in bytes GitHub last commit GitHub license
DockerHub Docker version Image size Docker Pulls

Reference

    - name: Fail on different veriables' definitions
      uses: devops-infra/[email protected]
      with:
        fail_on_changes: true
Input Variable Required Default Description
dirs_with_modules No terraform Comma separated list of directory prefixes with modules.
files_with_vars No variables.tf Comma separated list of files containing variables in directories matching dirs_with_modules.
all_vars_file No all-variables.tf Name of a file containing base definitions of all variables.
fail_on_missing No false Whether action should fail if all_vars_file is missing some definitions from modules.

Examples

Fail action if not all variables in variables.tf in terragrunt subdirectories match their definitions in all-variables.tf.

name: Check Terraform variables
on:
  push
jobs:
  terraform-copy-vars:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout repoistory
      uses: actions/checkout@v2
    - name: Fail on different veriables' definitions
      uses: devops-infra/[email protected]
      with:
        fail_on_changes: true

Copy variables definitions from all-variables.tf to all variables.tf in modules subdirectories and commit updated files back to the repository using my other action devops-infra/action-commit-push.

name: Copy Terraform variables accross modules
on:
  push
jobs:
  terraform-copy-vars:
    runs-on: ubuntu-latest
    steps:
    - name: Checkout repoistory
      uses: actions/checkout@v2
    - name: Update Terraform variables
      uses: devops-infra/[email protected]
      with:
        dirs_with_modules: modules
        files_with_vars: variables.tf
        all_vars_file: all-variables.tf
    - name: Commit changes to repo
      uses: devops-infra/action-commit-push@master
      with:
        github_token: ${{ secrets.GITHUB_TOKEN }}
        commit_prefix: "[AUTO-VARIABLES]"

action-terraform-copy-vars's People

Contributors

christophshyper avatar dependabot[bot] avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

brucebentley

action-terraform-copy-vars's Issues

Improve linting

Brief description

Improve linting.

Error: Dockerfile:48 DL3013 warning: Pin versions in pip. Instead of `pip install <package>` use `pip install <package>==<version>` or `pip install --requirement <requirements file>`
Error: Dockerfile:48 DL3017 error: Do not use apk upgrade
Error: Dockerfile:48 DL3042 warning: Avoid use of cache directory with pip. Use `pip install --no-cache-dir <package>`
Error: Dockerfile:48 DL3018 warning: Pin versions in apk add. Instead of `apk add <package>` use `apk add <package>=<version>`
Error: Dockerfile:64 DL3025 warning: Use arguments JSON notation for CMD and ENTRYPOINT arguments
Error: Dockerfile:66 DL3025 warning: Use arguments JSON notation for CMD and ENTRYPOINT arguments

https://github.com/devops-infra/action-terraform-copy-vars/runs/2731381519?check_suite_focus=true

Fix also PR and Issue templates.

Checklist

  • Provided a clear and concise description of what the issue is.
  • Given a clear and concise description of what is expected.
  • Proposed a clear and concise description of any alternative solutions or other features.
  • Added any other context or screenshots about the feature request.
  • Associated pull request has been already created and link was provided.

Check CONTRIBUTING.md for more information

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.