Skip to main content

OpenTofu

OpenTofu lets you declaratively manage your cloud infrastructure.

🚀 Usage​

Add the following command to your CI configuration file:

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

Commands​

NameDescription
setupInstall a specific version of OpenTofu.
initPrepare your working directory for other commands
validateCheck whether the configuration is valid
planShow changes required by the current configuration
applyCreate or update infrastructure
destroyDestroy previously-created infrastructure

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 manage cloud infrastructure using OpenTofu:

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