Skip to content

Instantly share code, notes, and snippets.

@mtranter
Created May 13, 2020 04:01
Show Gist options
  • Save mtranter/3d1687876534087c4a13f8c1d7352e3e to your computer and use it in GitHub Desktop.
Save mtranter/3d1687876534087c4a13f8c1d7352e3e to your computer and use it in GitHub Desktop.
Terragrunt Orb - Draft
version: 2.1
description: Publish Infrastructure with terragrunt
orbs:
terragrunt:
commands:
plan:
parameters:
target_dir:
type: string
default: .
plan_file:
type: string
default: ""
tf_vars:
type: string
steps:
- run:
name: Terragrunt plan
command: |
vars=""
IFS="," read -ra TF_VARS \<<< "<< parameters.tf_vars >>"
for t in "${TF_VARS[@]}"; do vars="$vars -var $t"; done;
cd << parameters.target_dir >>
terragrunt plan <<# parameters.tf_vars >>$vars<</ parameters.tf_vars >> <<# parameters.plan_file >> -out << parameters.plan_file >> <</ parameters.plan_file >>
apply:
parameters:
target_dir:
type: string
default: .
plan_file:
type: string
default: ""
tf_vars:
type: string
steps:
- run:
name: Terragrunt Apply
command: |
vars=""
IFS="," read -ra TF_VARS \<<< "<< parameters.tf_vars >>"
for t in "${TF_VARS[@]}"; do vars="$vars -var $t"; done;
cd << parameters.target_dir >>
terragrunt apply -auto-approve <<# parameters.tf_vars >>$vars<</ parameters.tf_vars >> <<# parameters.plan_file >> -out << parameters.plan_file >> <</ parameters.plan_file >>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment