Skip to main content

Terraform

Terraform is an open-source infrastructure as code tool that allows you to create, deploy, and manage cloud infrastructure using a declarative configuration language.

🚀 Usage​

Add the following command to your CI configuration file:

fluentci run --wasm terraform init
fluentci run --wasm terraform validate
fluentci run --wasm terraform plan
fluentci run --wasm terraform apply

Commands​

NameDescription
initInitialize a new or existing Terraform configuration.
validateCheck the Terraform configuration for errors.
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", "init", vec![])?;
dag().call("https://pkg.fluentci.io/[email protected]?wasm=1", "validate", vec![])?;
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 Terraform:

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: init
run: fluentci run --wasm terraform init
env:
GOOGLE_APPLICATION_CREDENTIALS: ./service-account.json
- name: validate
run: fluentci run --wasm terraform validate
env:
GOOGLE_APPLICATION_CREDENTIALS: ./service-account.json
- name: plan
run: fluentci run --wasm terraform plan
env:
GOOGLE_APPLICATION_CREDENTIALS: ./service-account.json
- name: apply
run: fluentci run --wasm terraform apply
env:
GOOGLE_APPLICATION_CREDENTIALS: ./service-account.json