Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
41 changes: 41 additions & 0 deletions docs/data-sources/virtual_environment_sdn_subnet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
layout: page
title: proxmox_virtual_environment_sdn_subnet
parent: Data Sources
subcategory: Virtual Environment
description: |-
Retrieve details about a specific SDN Subnet in Proxmox VE.
---

# Data Source: proxmox_virtual_environment_sdn_subnet

Retrieve details about a specific SDN Subnet in Proxmox VE.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably indicate here if the target resource does not exist in PVE, the datasource will return an error. It's pretty common (albeit a bad practice) to return a datasource with null attributes in this case, which some users may expect.
It may also be worthwhile to mark the attributes as required as well, as I assume they all (or at least most of them) will be present on the ds.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for the other datasources

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See what you mean.
For me it seems clearer to return an error when the target resource doesn't exist as it can indicate the user something is wrong... On the other hand, returning resource will null attribute could allow the rest of the deployment to work correctly, but may lead to errors later on.. What do you think is best ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me it seems clearer to return an error when the target resource doesn't exist as it can indicate the user something is wrong...

Yeah, I totally agree with that, and I think we should maintain this approach for all new data sources moving forward.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `subnet` (String)
- `vnet` (String) The VNet this subnet belongs to.

### Read-Only

- `canonical_name` (String)
- `dhcp_dns_server` (String) The DNS server used for DHCP.
- `dhcp_range` (Attributes List) List of DHCP ranges (start and end IPs). (see [below for nested schema](#nestedatt--dhcp_range))
- `dnszoneprefix` (String) Prefix used for DNS zone delegation.
- `gateway` (String) The gateway address for the subnet.
- `id` (String) The full ID in the format 'vnet-id/subnet-id'.
- `snat` (Boolean) Whether SNAT is enabled for the subnet.
- `type` (String)

<a id="nestedatt--dhcp_range"></a>
### Nested Schema for `dhcp_range`

Read-Only:

- `end_address` (String) End of the DHCP range.
- `start_address` (String) Start of the DHCP range.
32 changes: 32 additions & 0 deletions docs/data-sources/virtual_environment_sdn_vnet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
layout: page
title: proxmox_virtual_environment_sdn_vnet
parent: Data Sources
subcategory: Virtual Environment
description: |-
Retrieves information about an existing SDN Vnet in Proxmox VE.
---

# Data Source: proxmox_virtual_environment_sdn_vnet

Retrieves information about an existing SDN Vnet in Proxmox VE.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) The name of the vnet.

### Read-Only

- `alias` (String) - An alias for this vnet.
- `id` (String) - The ID of the vnet (usually the name).
- `isolate_ports` (Boolean) - Whether ports are isolated.
- `tag` (Number) - VLAN/VXLAN tag.
- `type` (String) - Type of the vnet.
- `vlanaware` (Boolean) - Whether this vnet is VLAN aware.
- `zone` (String) - The zone associated with the vnet.
- `zonetype` (String) - The type of the zone associated with this vnet.
45 changes: 45 additions & 0 deletions docs/data-sources/virtual_environment_sdn_zone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
layout: page
title: proxmox_virtual_environment_sdn_zone
parent: Data Sources
subcategory: Virtual Environment
description: |-
Fetch a Proxmox SDN Zone by name.
---

# Data Source: proxmox_virtual_environment_sdn_zone


This data source allows you to fetch information about an existing SDN zone in a Proxmox Virtual Environment (PVE) cluster by its name.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) Name (ID) of the SDN zone.

### Read-Only

- `advertise_subnets` (Boolean) - Whether to advertise subnets to the zone.
- `bridge` (String) – Linux bridge device used (if applicable).
- `controller` (String) – Controller for EVPN zones.
- `disable_arp_nd_suppression` (Boolean) – Whether ARP/ND suppression is disabled.
- `dns` (String) – DNS server configured for the zone.
- `dns_zone` (String) – The DNS zone name used by this SDN zone.
- `exit_nodes` (String) – Nodes designated as exit points.
- `exit_nodes_local_routing` (Boolean) – Whether local routing is enabled for exit nodes.
- `id` (String) - The ID of the SDN zone.
- `ipam` (String) – The IP Address Management (IPAM) method used in the zone.
- `mtu` (Number) – Maximum Transmission Unit for this zone.
- `nodes` (String) – Comma-separated list of node names associated with the zone.
- `peers` (String) – Peers used for some zone types only.
- `primary_exit_node` (String) – The main exit node.
- `reversedns` (String) – Reverse DNS server for the zone.
- `rt_import` (String) – Route targets to import.
- `tag` (Number) – VLAN tag or other numeric identifier.
- `type` (String) – The SDN zone type (e.g., `simple`, `vlan`, `vxlan`, `evpn`).
- `vlan_protocol` (String) – VLAN protocol used.
- `vrf_vxlan` (Number) – VXLAN ID associated with VRF zones.
44 changes: 44 additions & 0 deletions docs/resources/virtual_environment_sdn_subnet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
layout: page
title: proxmox_virtual_environment_sdn_subnet
parent: Resources
subcategory: Virtual Environment
description: |-
Manages SDN Subnets in Proxmox VE.
---

# Resource: proxmox_virtual_environment_sdn_subnet

Manages SDN Subnets in Proxmox VE.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `subnet` (String) The name/ID of the subnet.
- `vnet` (String) The VNet to which this subnet belongs.

### Optional

- `dhcp_dns_server` (String) The DNS server used for DHCP.
- `dhcp_range` (Attributes List) List of DHCP ranges (start and end IPs). (see [below for nested schema](#nestedatt--dhcp_range))
- `dnszoneprefix` (String) Prefix used for DNS zone delegation.
- `gateway` (String) The gateway address for the subnet.
- `snat` (Boolean) Whether SNAT is enabled for the subnet.

### Read-Only

- `canonical_name` (String) Canonical name of the subnet (e.g. zoneM-10.10.0.0-24).
- `id` (String) The unique identifier of this resource.
- `type` (String) Subnet type (set default at 'subnet')

<a id="nestedatt--dhcp_range"></a>
### Nested Schema for `dhcp_range`

Required:

- `end_address` (String) End of the DHCP range.
- `start_address` (String) Start of the DHCP range.
35 changes: 35 additions & 0 deletions docs/resources/virtual_environment_sdn_vnet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
layout: page
title: proxmox_virtual_environment_sdn_vnet
parent: Resources
subcategory: Virtual Environment
description: |-
Manages Proxmox VE SDN vnet.
---

# Resource: proxmox_virtual_environment_sdn_vnet

Manages Proxmox VE SDN vnet.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) Unique identifier for the vnet.
- `zone` (String) The zone to which this vnet belongs.
- `zonetype` (String) Parent's zone type. MUST be specified.

### Optional

- `alias` (String) An optional alias for this vnet.
- `isolate_ports` (Boolean) Whether to isolate ports within this vnet.
- `tag` (Number) Tag value for VLAN/VXLAN (depends on zone type).
- `vlanaware` (Boolean) Whether this vnet is VLAN aware.

### Read-Only

- `id` (String) The unique identifier of this resource.
- `type` (String) Type of vnet (e.g. 'vnet').
60 changes: 60 additions & 0 deletions docs/resources/virtual_environment_sdn_zone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
layout: page
title: proxmox_virtual_environment_sdn_zone
parent: Resources
subcategory: Virtual Environment
description: |-
Manages SDN Zones in Proxmox VE.
---

# Resource: proxmox_virtual_environment_sdn_zone

Manages SDN Zones in Proxmox VE.
Some attributes in the `proxmox_virtual_environment_sdn_zone` resource or data source are only applicable to certain zone types. For example:

`bridge` is relevant only for `vlan` zones.

`peers`, `controller`, `vrf_vxlan`, and related attributes are specific to `vxlan` and `evpn` zone types.

`service_vlan` and `vlan_protocol` apply to `qinq` zones.

While the Proxmox API does not explicitly document these constraints, they are enforced by the Proxmox backend and have been validated manually through API experimentation.

The Terraform provider implements field-level validation to ensure that only compatible attributes are used with each zone type. If incompatible attributes are set, Terraform will raise a configuration error during plan or apply to prevent invalid requests to the Proxmox API.

This design helps ensure correctness and avoids unexpected API failures when managing SDN zones across different zone types.



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) The unique ID of the SDN zone.
- `type` (String) Zone type (e.g. simple, vlan, qinq, vxlan, evpn).

### Optional

- `advertise_subnets` (Boolean) Enable subnet advertisement for EVPN.
- `bridge` (String) Bridge interface for VLAN/QinQ.
- `controller` (String) EVPN controller address.
- `disable_arp_nd_suppression` (Boolean) Disable ARP/ND suppression for EVPN.
- `dns` (String) DNS server address.
- `dns_zone` (String) DNS zone name.
- `exit_nodes` (String) Comma-separated list of exit nodes for EVPN.
- `exit_nodes_local_routing` (Boolean) Enable local routing for EVPN exit nodes.
- `ipam` (String) IP Address Management system.
- `mtu` (Number) MTU value for the zone.
- `nodes` (String) Comma-separated list of Proxmox node names.
- `peers` (String) Peers list for VXLAN.
- `primary_exit_node` (String) Primary exit node for EVPN.
- `reversedns` (String) Reverse DNS settings.
- `rt_import` (String) Route target import for EVPN.
- `tag` (Number) Service VLAN tag for QinQ.
- `vlan_protocol` (String) Service VLAN protocol for QinQ.
- `vrf_vxlan` (Number) EVPN VRF VXLAN ID.

### Read-Only

- `id` (String) The unique identifier of this resource.
6 changes: 3 additions & 3 deletions example/resource_virtual_environment_container.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ resource "proxmox_virtual_environment_container" "example_template" {
start_on_boot = "true"

disk {
datastore_id = "local-lvm"
datastore_id = var.virtual_environment_storage
size = 4
}

mount_point {
// volume mount
volume = "local-lvm"
volume = var.virtual_environment_storage
size = "4G"
path = "mnt/local"
}
Expand Down Expand Up @@ -66,7 +66,7 @@ resource "proxmox_virtual_environment_container" "example_template" {

resource "proxmox_virtual_environment_container" "example" {
disk {
datastore_id = "local-lvm"
datastore_id = var.virtual_environment_storage
}

clone {
Expand Down
4 changes: 2 additions & 2 deletions example/resource_virtual_environment_download_file.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
resource "proxmox_virtual_environment_download_file" "release_20240725_ubuntu_24_noble_lxc_img" {
content_type = "vztmpl"
datastore_id = "local"
node_name = "pve"
node_name = var.virtual_environment_node_name
url = var.release_20240725_ubuntu_24_noble_lxc_img_url
checksum = var.release_20240725_ubuntu_24_noble_lxc_img_checksum
checksum_algorithm = "sha256"
Expand All @@ -15,7 +15,7 @@ resource "proxmox_virtual_environment_download_file" "latest_debian_12_bookworm_
content_type = "iso"
datastore_id = "local"
file_name = "debian-12-generic-amd64.img"
node_name = "pve"
node_name = var.virtual_environment_node_name
url = var.latest_debian_12_bookworm_qcow2_img_url
overwrite = true
overwrite_unmanaged = true
Expand Down
Loading