tools:opentofu

This is an old revision of the document!


OpenTofu

OpenTofu digunakan untuk mengelola infrastruktur menggunakan Infrastructure as Code (IaC). Instalasi berikut menggunakan repository resmi OpenTofu pada Debian dan Ubuntu.

Install dependencies:

sudo apt update
sudo apt install -y ca-certificates curl gnupg

Installing using the installer

You can use the OpenTofu installer script to run the installation. Code Block

# Download the installer script:
curl --proto '=https' --tlsv1.2 -fsSL https://get.opentofu.org/install-opentofu.sh -o install-opentofu.sh
# Alternatively: wget --secure-protocol=TLSv1_2 --https-only https://get.opentofu.org/install-opentofu.sh -O install-opentofu.sh

# Give it execution permissions:
chmod +x install-opentofu.sh

# Please inspect the downloaded script

# Run the installer:
./install-opentofu.sh --install-method deb

# Remove the installer:
rm -f install-opentofu.sh

Periksa versi OpenTofu:

tofu version

Buat direktori proyek dan file konfigurasi:

mkdir tofu-project
cd tofu-project
nano main.tf

Isi `main.tf`:

output "message" {
  value = "Hello from OpenTofu"
}

Jalankan perintah berikut:

tofu init
tofu validate
tofu plan
tofu apply
  • tools/opentofu.1791563439.txt.gz
  • Last modified: 2026/10/09 23:30
  • by ilyasa