{"id":11,"date":"2026-08-17T00:21:39","date_gmt":"2026-08-17T03:21:39","guid":{"rendered":"https:\/\/telapreta.dev.br\/blog\/index.php\/terraform-proxmox-ve-automatizar-vms\/"},"modified":"2026-08-17T01:02:22","modified_gmt":"2026-08-17T04:02:22","slug":"terraform-proxmox-ve-automatizar-vms","status":"publish","type":"post","link":"https:\/\/telapreta.dev.br\/blog\/index.php\/terraform-proxmox-ve-automatizar-vms\/","title":{"rendered":"Como Usar Terraform no Proxmox VE para Automatizar a Cria\u00e7\u00e3o de VMs"},"content":{"rendered":"<div class=\"telapreta-post-body\" style=\"line-height: 1.8;font-size: 1.05rem;color: #e2e8f0\">\n<p><em>Guia Pr\u00e1tico Infrastructure as Code (IaC): Crie templates de Cloud-Init no Proxmox e fa\u00e7a provisionamento automatizado de servidores com Terraform. Por <strong>Fabio Silva<\/strong>.<\/em><\/p>\n<hr style=\"border-color: #1e293b;margin: 30px 0\" \/>\n<h2 style=\"color: #10b981;margin-top: 30px\">\u2699\ufe0f Por que automatizar o Proxmox com Terraform?<\/h2>\n<p>O Proxmox VE \u00e9 um dos hipervisores open-source mais potentes do mercado. Combinado com o provider do Terraform (Telmate ou bpg\/proxmox), \u00e9 poss\u00edvel tratar m\u00e1quinas virtuais no seu homelab ou datacenter com a mesma eleg\u00e2ncia da AWS ou Azure.<\/p>\n<h2 style=\"color: #10b981;margin-top: 30px\">\ud83d\udccb Pr\u00e9-requisitos<\/h2>\n<ul style=\"line-height: 1.8\">\n<li>Cluster Proxmox VE rodando vers\u00e3o 7.x ou 8.x.<\/li>\n<li>Usu\u00e1rio de API no Proxmox com Token gerado (<code>terraform-user@pve!provider_token<\/code>).<\/li>\n<li>Template Ubuntu Server 22.04 \/ 24.04 com <strong>Cloud-Init<\/strong> instalado.<\/li>\n<\/ul>\n<h2 style=\"color: #10b981;margin-top: 30px\">\ud83d\udcc4 C\u00f3digo main.tf Completo<\/h2>\n<pre style=\"background: #0f172a;padding: 15px;border-radius: 8px;border: 1px solid #1e293b;color: #10b981;font-family: monospace\">\nterraform {\n  required_providers {\n    proxmox = {\n      source  = \"bpg\/proxmox\"\n      version = \"0.60.0\"\n    }\n  }\n}\n\nprovider \"proxmox\" {\n  endpoint = \"https:\/\/192.168.1.100:8006\/\"\n  api_token = \"terraform-user@pve!token=12345678-abcd-1234-abcd-1234567890ab\"\n  insecure  = true\n}\n\nresource \"proxmox_virtual_environment_vm\" \"k8s_worker\" {\n  count     = 3\n  name      = \"k8s-node-0${count.index + 1}\"\n  node_name = \"pve-node-1\"\n  vm_id     = 200 + count.index\n\n  cpu {\n    cores = 4\n    type  = \"host\"\n  }\n\n  memory {\n    dedicated = 8192\n  }\n\n  disk {\n    datastore_id = \"local-lvm\"\n    size         = 40\n    interface    = \"scsi0\"\n  }\n\n  initialization {\n    ip_config {\n      ipv4 {\n        address = \"192.168.1.5${count.index + 1}\/24\"\n        gateway = \"192.168.1.1\"\n      }\n    }\n  }\n}\n<\/pre>\n<h2 style=\"color: #10b981;margin-top: 30px\">\ud83d\ude80 Executando o Deploy<\/h2>\n<pre style=\"background: #0f172a;padding: 10px;border-radius: 6px;border: 1px solid #1e293b;color: #10b981;font-family: monospace\">\nterraform init\nterraform plan\nterraform apply --auto-approve\n<\/pre>\n<hr style=\"border-color: #1e293b;margin: 35px 0\" \/>\n<p style=\"color: #94a3b8;font-size: 0.95rem\"><em>Artigo originalmente publicado por <strong>Fabio Silva<\/strong> \u2014 Arquiteto de Solu\u00e7\u00f5es em Cloud, DevOps e IA Generativa.<\/em><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Guia Pr\u00e1tico Infrastructure as Code (IaC): Crie templates de Cloud-Init no Proxmox e fa\u00e7a provisionamento automatizado de servidores com Terraform. Por Fabio Silva. \u2699\ufe0f Por que automatizar o Proxmox com Terraform? O Proxmox VE \u00e9 um dos hipervisores open-source mais potentes do mercado. Combinado com o provider do Terraform (Telmate ou bpg\/proxmox), \u00e9 poss\u00edvel tratar &#8230; <a title=\"Como Usar Terraform no Proxmox VE para Automatizar a Cria\u00e7\u00e3o de VMs\" class=\"read-more\" href=\"https:\/\/telapreta.dev.br\/blog\/index.php\/terraform-proxmox-ve-automatizar-vms\/\" aria-label=\"Read more about Como Usar Terraform no Proxmox VE para Automatizar a Cria\u00e7\u00e3o de VMs\">Ler mais<\/a><\/p>\n","protected":false},"author":1,"featured_media":35,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5],"tags":[],"class_list":["post-11","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-devops-cloud","category-infraestrutura"],"_links":{"self":[{"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/posts\/11","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=11"}],"version-history":[{"count":4,"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/posts\/11\/revisions"}],"predecessor-version":[{"id":200,"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/posts\/11\/revisions\/200"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/media\/35"}],"wp:attachment":[{"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=11"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=11"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/telapreta.dev.br\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=11"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}