Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions docs/resources/virtual_environment_acme_certificate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
layout: page
title: proxmox_virtual_environment_acme_certificate
parent: Resources
subcategory: Virtual Environment
---

# Resource: proxmox_virtual_environment_acme_certificate

Manages ACME SSL certificates for Proxmox VE nodes. This resource orders and renews certificates from an ACME Certificate Authority for a specific node.

## Example Usage

### Basic ACME Certificate with HTTP-01 Challenge

```terraform
# First, create an ACME account
resource "proxmox_virtual_environment_acme_account" "example" {
name = "production"
contact = "[email protected]"
directory = "https://acme-v02.api.letsencrypt.org/directory"
tos = "https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf"
}

# Order a certificate for the node
resource "proxmox_virtual_environment_acme_certificate" "example" {
node_name = "pve"
account = proxmox_virtual_environment_acme_account.example.name

domains = [
{
domain = "pve.example.com"
# No plugin specified implies HTTP-01 challenge
}
]
}
```

### ACME Certificate with DNS-01 Challenge

```terraform
# Create an ACME account
resource "proxmox_virtual_environment_acme_account" "example" {
name = "production"
contact = "[email protected]"
directory = "https://acme-v02.api.letsencrypt.org/directory"
tos = "https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf"
}

# Configure a DNS plugin (Desec example)
resource "proxmox_virtual_environment_acme_dns_plugin" "desec" {
plugin = "desec"
api = "desec"

data = {
DEDYN_TOKEN = var.dedyn_token
}
}

# Order a certificate using the DNS plugin
resource "proxmox_virtual_environment_acme_certificate" "test" {
node_name = "pve"
account = proxmox_virtual_environment_acme_account.example.name
force = false

domains = [
{
domain = "pve.example.dedyn.io"
plugin = proxmox_virtual_environment_acme_dns_plugin.desec.plugin
}
]

depends_on = [
proxmox_virtual_environment_acme_account.example,
proxmox_virtual_environment_acme_dns_plugin.desec
]
}
```

### Force Certificate Renewal

```terraform
resource "proxmox_virtual_environment_acme_certificate" "example_force" {
node_name = "pve"
account = proxmox_virtual_environment_acme_account.example.name
force = true # This will trigger renewal on every apply

domains = [
{
domain = "pve.example.com"
}
]
}
```

## Import

ACME certificates can be imported using the node name:

```shell
#!/usr/bin/env sh
# ACME certificates can be imported using the node name, e.g.:
terraform import proxmox_virtual_environment_acme_certificate.example pve
```

## Related Resources

- [`proxmox_virtual_environment_acme_account`](virtual_environment_acme_account) - Manages ACME accounts
- [`proxmox_virtual_environment_acme_dns_plugin`](virtual_environment_acme_dns_plugin) - Manages ACME DNS plugins for DNS-01 challenges
- [`proxmox_virtual_environment_certificate`](virtual_environment_certificate) - Manages custom SSL/TLS certificates (non-ACME)
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env sh
# ACME certificates can be imported using the node name, e.g.:
terraform import proxmox_virtual_environment_acme_certificate.example pve-node-01
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Example: Basic ACME certificate with HTTP-01 challenge (standalone)
resource "proxmox_virtual_environment_acme_account" "example" {
name = "production"
contact = "[email protected]"
directory = "https://acme-v02.api.letsencrypt.org/directory"
tos = "https://letsencrypt.org/documents/LE-SA-v1.3-September-21-2022.pdf"
}

resource "proxmox_virtual_environment_acme_certificate" "http_example" {
node_name = "pve-node-01"
account = proxmox_virtual_environment_acme_account.example.name

domains = [
{
domain = "pve.example.com"
# No plugin specified = HTTP-01 challenge
}
]
}

# Example: ACME certificate with DNS-01 challenge using Cloudflare
resource "proxmox_virtual_environment_acme_dns_plugin" "cloudflare" {
plugin = "cloudflare"
api = "cf"

# Wait 2 minutes for DNS propagation
validation_delay = 120

data = {
CF_Account_ID = "your-cloudflare-account-id"
CF_Token = "your-cloudflare-api-token"
CF_Zone_ID = "your-cloudflare-zone-id"
}
}

resource "proxmox_virtual_environment_acme_certificate" "dns_example" {
node_name = "pve-node-01"
account = proxmox_virtual_environment_acme_account.example.name

domains = [
{
domain = "pve.example.com"
plugin = proxmox_virtual_environment_acme_dns_plugin.cloudflare.plugin
}
]

depends_on = [
proxmox_virtual_environment_acme_account.example,
proxmox_virtual_environment_acme_dns_plugin.cloudflare
]
}

# Example: Force certificate renewal
resource "proxmox_virtual_environment_acme_certificate" "force_renew" {
node_name = "pve-node-01"
account = proxmox_virtual_environment_acme_account.example.name
force = true

domains = [
{
domain = "pve.example.com"
plugin = proxmox_virtual_environment_acme_dns_plugin.cloudflare.plugin
}
]

depends_on = [
proxmox_virtual_environment_acme_account.example,
proxmox_virtual_environment_acme_dns_plugin.cloudflare
]
}

Loading