Blog của Sang

Terraform SSH Provider cho Homelab

Provider

1terraform {
2  required_providers {
3    ssh = {
4      source = "loafoe/ssh"
5      version = "2.6.0"
6    }
7  }
8}

Ví dụ

1resource "ssh_resource" "docker_install" {
2  host = var.vps_ip
3  commands = [
4    "apt-get update && apt-get install -y docker.io"
5  ]
6}

Không cần Ansible, không cần Python trên VPS.