Skip to main content

Terragrunt

Terragrunt is a flexible orchestration tool that allows Infrastructure as Code written in OpenTofu/terragrunt to scale.

🚀 Usage​

Add the following command to your CI configuration file:

fluentci run --wasm terragrunt hclfmt --terragrunt-check --terragrunt-diff
fluentci run --wasm terragrunt validate
fluentci run --wasm terragrunt apply

Commands​

NameDescription
setupInstall terragrunt cli
hclfmtRecursively find hcl files and rewrite them into a canonical format.
planGenerate and show an execution plan.
applyApply the changes required to reach the desired state.

Code Examples​

Add fluentci-pdk crate to your Cargo.toml:

[dependencies]
fluentci-pdk = "0.2.1"

Use the following code to call a module function:

use fluentci_pdk::dag;

// ...

dag().call("https://pkg.fluentci.io/[email protected]?wasm=1", "hclfmt", vec!["-terragrunt-check", "--terragrunt-diff"])?;
dag().call("https://pkg.fluentci.io/[email protected]?wasm=1", "plan", vec![])?;
dag().call("https://pkg.fluentci.io/[email protected]?wasm=1", "apply", vec![])?;

CI/CD pipeline integrations​

The following examples show how to integrate FluentCI with popular CI providers to provision infrastructure using terragrunt:

ci.yml
name: ci
on:
push:
branches:
- main
jobs:
tasks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup Fluent CI
uses: fluentci-io/setup-fluentci@v5
- name: check
run: fluentci run --wasm terragrunt hclfmt --terragrunt-check --terragrunt-diff
env:
GOOGLE_APPLICATION_CREDENTIALS: ./service-account.json
- name: plan
run: fluentci run --wasm terragrunt plan
env:
GOOGLE_APPLICATION_CREDENTIALS: ./service-account.json
- name: apply
run: fluentci run --wasm terragrunt apply
env:
GOOGLE_APPLICATION_CREDENTIALS: ./service-account.json