Terraform

From wiki.vacula.xyz
Revision as of 16:07, 13 August 2024 by Dracula (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Terraform serves as an infrastructure-as-code deployment tool.

Quick Usage

# Prepare terraform in the current directory
terraform init
# Format the .tf file
terraform fmt 
# Verify .tf file syntax
terraform validate
# Show changes 
terraform plan
# Apply changes
terraform apply
# Remove everything 
terraform destroy

Libvirt/KVM/QEMU

terraform {
  required_providers {
    libvirt = {
      source = "dmacvicar/libvirt"
    }
  }
}

provider "libvirt" {
  uri = "qemu:///system"
}

resource "libvirt_domain" "test1" {
  name = "terraform_test"
}