Skip to content

Using Terraform

MuriloChianfa edited this page Sep 8, 2024 · 3 revisions

Setting up our project using the terraform.

1) Clone this repository to your local machine

git clone git@github.com:MuriloChianfa/self-hosted-secure-infra.git
cd self-hosted-secure-infra/terraform

2) Create the tfvars files and fill with your secrets

vi terraform.tfvars

Add this content to file

api_url = "https://YOUR_IP_ADDRESS:8006/api2/json"
token_secret = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
token_id = "terraform@pve!terraform-token"
allowedsshkey = "ssh-ed25519 xxxxxxxxxxxxxxx root@pc"

3) Now you need to install the terraform into your local pc

curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add -
apt-add-repository "deb [arch=$(dpkg --print-architecture)] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
apt update && apt install terraform

4) We're ready to use the terraform:

terraform init
terraform plan

Is important to use parallelism=1 to not flood Proxmox API

terraform apply -parallelism=1

In the final of these steps, you would see your infrastructure ready to install all services Using Ansible.