aboutsummaryrefslogtreecommitdiff
path: root/opentofu/README.md
blob: f47e00e596b3ba4d036d14ffcc0f55b8aa553a7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# OpenTofu Infrastructure Provisioning

This repository contains OpenTofu configurations and modules for automating infrastructure provisioning in my homelab environment.

## **Overview**
OpenTofu is used to define, manage, and provision infrastructure as code (IaC). This setup provides a modular approach for creating and managing infrastructure efficiently.

## **Project Structure**
- **`README.md`** – Project overview and documentation.
- **`examples/`** – Sample configurations demonstrating how to use modules in different scenarios.
- **`modules/`** – Reusable OpenTofu modules for provisioning infrastructure components.
- **`outputs.tf`** – Definitions of outputs to expose key resource attributes.
- **`provider.tf`** – Configuration for OpenTofu providers, such as Proxmox.
- **`terraform.tfvars`** – Variable values for customizing deployments.
- **`variables.tf`** – Definitions of input variables used across the configuration.
- **`versions.tf`** – Specifies required OpenTofu and provider versions to maintain compatibility.

## **Script**

Created a small script to init, fmt, and plan.

```sh
./init-validate-plan.sh plan.out
tofu apply "plan.out"
```

## **Credentials**

There needs to be a file with credentials in them.
With this kind of content :

```tf
proxmox_api_url          = "https://<pve ip/fqdn>:<port>/api2/json"
proxmox_api_token_id     = "<id>"
proxmox_api_token_secret = "<token>"
```

Refer to this :

- https://opentofu.org/docs/language/values/variables/#variable-definition-precedence
- https://registry.terraform.io/providers/Telmate/proxmox/latest/docs