Anything you do to OpenTofu twice should be automated. This walks the path from a manual install to a repeatable, pipeline-driven setup.
1. Install it reproducibly
brew install opentofu
tofu version
tofu init2. Describe the desired state
Identical HCL to Terraform - just run with tofu.
terraform {
required_providers { aws = { source = "hashicorp/aws" } }
encryption { # OpenTofu native state encryption
key_provider "pbkdf2" "k" { passphrase = var.state_pass }
method "aes_gcm" "m" { keys = key_provider.pbkdf2.k }
state { method = method.aes_gcm.m }
}
}3. Run it from CI
Swap the binary; the workflow is the same as Terraform.
- uses: opentofu/setup-opentofu@v1
- run: tofu init -input=false && tofu plan -input=falseWant senior help putting OpenTofu to work - or a team bootcamp on it? CodeWizard runs Israel's largest DevOps community and embeds named senior engineers with a transparent hours log. Book a free consult or explore the Academy.