Skip to content

Provision/orchestrate infrastructure and automate pipelines/configuration management processes.

License

Notifications You must be signed in to change notification settings

metacron/turbojet

Repository files navigation

Turbojet

Engine (container image) to provision/orchestrate infrastructure and automate pipelines/configuration management processes.

Turbojet Engine

Technology stack: Terraform, Terragrunt, Ansible. Versions can be found in Dockerfile.

💡 You can customize the version args and build your own image.

Table of contents

Environment variables

All environment variables available to the container is available to Terraform, Terragrunt, Ansible without any special procedure. Be careful when setting credentials or sensitive data as configuration for your implementation, especially with logging from Terragrunt, Terraform, Ansible.

CHANGE_DIR

A directory to use as current working directory before executing the container command. Default '/workspace'.

GITCONFIG

Optional gitconfig file content, useful for private repository authentication when the terragrunt/terraform module source is a git URI. Default:

[url "https://git@github.com"]
    insteadOf = "ssh://git@github.com"

Enabling private repositories access can be done as the example below:

[url "https://git@github.com"]
    insteadOf = "ssh://git@github.com"
[url "https://YOUR_PERSONAL_ACCESS_TOKEN@github.com"]
    insteadOf = "ssh://private@github.com"

Usage

The container image is published at 📦 the metactron/turbojet GitHub package.

As a GitHub Actions step

# jobs.*.steps:
- name: Run terragrunt apply-all
  uses: docker://ghcr.io/metacron/turbojet:unstable
  id: terragrunt
  timeout-minutes: 30
  env:
    # AWS_ACCESS_KEY_ID: 
    # AWS_SECRET_ACCESS_KEY:

    # GOOGLE_APPLICATION_CREDENTIALS: ${{ github.workspace }}/gcp_credentials.json

    # SOURCE_REF: ${{ github.ref }}

    # CHANGE_DIR: resources/gcp
  with:
    args: terragrunt apply-all --terragrunt-non-interactive

As a local installation replacement

Create a /usr/local/bin/terraform file:

#!/bin/bash
docker run --rm -it -v $(pwd):/workspace ghcr.io/metacron/turbojet:latest terraform $@

Create a /usr/local/bin/terragrunt file:

#!/bin/bash
docker run --rm -it -v $(pwd):/workspace ghcr.io/metacron/turbojet:latest terragrunt $@

Create a /usr/local/bin/ansible file:

#!/bin/bash
docker run --rm -it -v $(pwd):/workspace ghcr.io/metacron/turbojet:latest ansible $@

💡 Create other files for ansible-playbook, ansible-value and etc using the same template shown for ansible command.

Mark all files as executables:

chmod +x \
  /usr/local/bin/terraform \
  /usr/local/bin/terragrunt \
  /usr/local/bin/ansible

Now you can use ansible, terraform and terragrunt like commands from a local installation.

As a Kubernetes Job

apiVersion: batch/v1
kind: Job
metadata:
  name: ansible-my-playbook
spec:
  backoffLimit: 5
  activeDeadlineSeconds: 100
  template:
    spec:
      containers:
      - name: ansible-playbook
        image: ghcr.io/metacron/turbojet:latest
        command: ["ansible-playbook",  "-i", "localhost,", "-c", "local", "my_playbook.yml"]
      restartPolicy: Never