Auto-update blog content from Obsidian: 2025-07-02 05:59:23
All checks were successful
Blog Deployment / Check-Rebuild (push) Successful in 5s
Blog Deployment / Build (push) Has been skipped
Blog Deployment / Deploy-Staging (push) Successful in 9s
Blog Deployment / Test-Staging (push) Successful in 2s
Blog Deployment / Merge (push) Successful in 5s
Blog Deployment / Deploy-Production (push) Successful in 8s
Blog Deployment / Test-Production (push) Successful in 2s
Blog Deployment / Notify (push) Successful in 2s
Blog Deployment / Clean (push) Has been skipped
All checks were successful
Blog Deployment / Check-Rebuild (push) Successful in 5s
Blog Deployment / Build (push) Has been skipped
Blog Deployment / Deploy-Staging (push) Successful in 9s
Blog Deployment / Test-Staging (push) Successful in 2s
Blog Deployment / Merge (push) Successful in 5s
Blog Deployment / Deploy-Production (push) Successful in 8s
Blog Deployment / Test-Production (push) Successful in 2s
Blog Deployment / Notify (push) Successful in 2s
Blog Deployment / Clean (push) Has been skipped
This commit is contained in:
@@ -155,6 +155,17 @@ terraform {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
provider "proxmox" {
|
||||||
|
endpoint = var.proxmox_endpoint
|
||||||
|
api_token = var.proxmox_api_token
|
||||||
|
insecure = false
|
||||||
|
ssh {
|
||||||
|
agent = false
|
||||||
|
private_key = file("~/.ssh/id_ed25519")
|
||||||
|
username = "root"
|
||||||
|
}
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `variables.tf`
|
#### `variables.tf`
|
||||||
@@ -162,6 +173,17 @@ terraform {
|
|||||||
> ⚠️ The defaults are based on my environment, adapt them to yours.
|
> ⚠️ The defaults are based on my environment, adapt them to yours.
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
|
variable "proxmox_endpoint" {
|
||||||
|
description = "Proxmox URL endpoint"
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "proxmox_api_token" {
|
||||||
|
description = "Proxmox API token"
|
||||||
|
type = string
|
||||||
|
sensitive = true
|
||||||
|
}
|
||||||
|
|
||||||
variable "node_name" {
|
variable "node_name" {
|
||||||
description = "Proxmox host for the VM"
|
description = "Proxmox host for the VM"
|
||||||
type = string
|
type = string
|
||||||
@@ -240,7 +262,7 @@ Now that we've moved all the resources required to deploy our VM into the `pve_v
|
|||||||
|
|
||||||
### Code Structure
|
### Code Structure
|
||||||
|
|
||||||
For clarity, I've separated the modules and the projects:
|
Here what is look like:
|
||||||
```plaintext
|
```plaintext
|
||||||
terraform
|
terraform
|
||||||
|-- modules
|
|-- modules
|
||||||
@@ -251,8 +273,7 @@ terraform
|
|||||||
`-- projects
|
`-- projects
|
||||||
`-- simple-vm-with-module
|
`-- simple-vm-with-module
|
||||||
|-- credentials.auto.tfvars
|
|-- credentials.auto.tfvars
|
||||||
|-- main.tf
|
|-- main.
|
||||||
|-- provider.tf
|
|
||||||
`-- variables.tf
|
`-- variables.tf
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -269,6 +290,8 @@ module "pve_vm" {
|
|||||||
vm_cpu = 2
|
vm_cpu = 2
|
||||||
vm_ram = 2048
|
vm_ram = 2048
|
||||||
vm_vlan = 66
|
vm_vlan = 66
|
||||||
|
proxmox_endpoint = var.proxmox_endpoint
|
||||||
|
proxmox_api_token = var.proxmox_api_token
|
||||||
}
|
}
|
||||||
|
|
||||||
output "vm_ip" {
|
output "vm_ip" {
|
||||||
@@ -276,29 +299,6 @@ output "vm_ip" {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `provider.tf`
|
|
||||||
|
|
||||||
```hcl
|
|
||||||
terraform {
|
|
||||||
required_providers {
|
|
||||||
proxmox = {
|
|
||||||
source = "bpg/proxmox"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
provider "proxmox" {
|
|
||||||
endpoint = var.proxmox_endpoint
|
|
||||||
api_token = var.proxmox_api_token
|
|
||||||
insecure = false
|
|
||||||
ssh {
|
|
||||||
agent = false
|
|
||||||
private_key = file("~/.ssh/id_ed25519")
|
|
||||||
username = "root"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `variables.tf`
|
#### `variables.tf`
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
|
Reference in New Issue
Block a user