Skip to content
This repository has been archived by the owner on Apr 5, 2024. It is now read-only.
/ terrapak-action Public archive

Terrapak helps you manage your Terraform modules with a seemless integration with your pull requests

License

Notifications You must be signed in to change notification settings

eunanio/terrapak-action

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Warning

Deprecation: This repository is no longer supported. Please use the Terrapak

Terrapak for Github Actions

This action integrates with your GitHub pull requests to automatically publish new versions of your Terraform modules in conjunction with Terrapak

Getting Started

Terrapak uses a configuration file to define the modules you want to publish. Create a file named terrapak.hcl in the root of your repository. The file should contain a list of modules you want to publish. Each module should have a name and a path to the module directory. The path is relative to the root of the repository. Example terrapak.hcl file:

terrapak {
    hostname = "terrapak.dev"
    organization = "myorg"
}

module "aws-bucket" {
    provider = "aws"
    path = "modules/aws/bucket"
    version = "1.0.0"
    # Example url: terrapak.dev/myorg/aws-bucket/aws
}

Example usage as module source:

module "bucket" {
    source = "terrapak.dev/myorg/aws-bucket/aws"
    version = "1.0.0"
    bucket_name = "my-bucket"
}

Requirements

To use this action you must first setup a instance of Terrapak

Workflows

Add the following workflow to your repository to automatically publish new versions of your modules when a pull request is merged to the target branch.

While your pull request is open, the module is considered a draft and will accept changes willingly, but will not be permanent. Once the pull request is merged, that version of the module will be published to the registry and will no longer accept further changes.

# terrapak_pull_request.yml
name: "Run Terrapak Sync"

on:
  pull_request:
    types: [opened, synchronize]


jobs:
  module-sync:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with: 
          fetch-depth: 0
      - name: Config-Workspace
        run: git config --global --add safe.directory /github/workspace
      - name: Terrapak Sync
        uses: eunanhardy/terrapak-action@v1
        with:
          action: sync
          github_token: ${{secrets.GITHUB_TOKEN}}
          token: ${{secrets.TP_TOKEN}}

Workflows for Publishing and Unpublishing modules are also available.

# terrapak_close.yml
name: "Module Cleanup..."

on:
  pull_request:
    types: [closed]

jobs:
  module-remove:
    runs-on: ubuntu-latest
    if: github.event.pull_request.merged == false
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: "Terrapak Remove"
        uses: eunanhardy/terrapak-action@v1
        with:
          action: closed
  module-publish:
    runs-on: ubuntu-latest
    if: github.event.pull_request.merged
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: "Terrapak Publish"
        uses: eunanhardy/terrapak-action@v1
        with:
          action: merged

About

Terrapak helps you manage your Terraform modules with a seemless integration with your pull requests

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published