0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-08-25 04:45:46 +00:00

Merge branch 'main' into main

This commit is contained in:
Pavel Boldyrev 2025-08-11 23:54:20 -04:00 committed by GitHub
commit ab544a57bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
27 changed files with 82 additions and 169 deletions

View File

@ -1452,6 +1452,15 @@
"contributions": [ "contributions": [
"doc" "doc"
] ]
},
{
"login": "kam193",
"name": "Kamil Mańkowski",
"avatar_url": "https://avatars.githubusercontent.com/u/8472271?v=4",
"profile": "https://github.com/kam193",
"contributions": [
"code"
]
} }
], ],
"contributorsPerLine": 7, "contributorsPerLine": 7,

View File

@ -1,6 +1,6 @@
FROM golang:1.24.5@sha256:ef5b4be1f94b36c90385abd9b6b4f201723ae28e71acacb76d00687333c17282 FROM golang:1.24.6@sha256:2c89c41fb9efc3807029b59af69645867cfe978d2b877d475be0d72f6c6ce6f6
ARG GOLANGCI_LINT_VERSION=2.3.0 # renovate: depName=golangci/golangci-lint datasource=github-releases ARG GOLANGCI_LINT_VERSION=2.3.1 # renovate: depName=golangci/golangci-lint datasource=github-releases
RUN apt update && apt upgrade -y && \ RUN apt update && apt upgrade -y && \
apt-get install --no-install-recommends -y ca-certificates curl gnupg lsb-release jq zsh neovim gh && \ apt-get install --no-install-recommends -y ca-certificates curl gnupg lsb-release jq zsh neovim gh && \

View File

@ -16,7 +16,7 @@ jobs:
pull-requests: write pull-requests: write
checks: write checks: write
steps: steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with: with:
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
fetch-depth: 0 # a full history is required for pull request analysis fetch-depth: 0 # a full history is required for pull request analysis

View File

@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with: with:
fetch-depth: 0 fetch-depth: 0
@ -42,6 +42,6 @@ jobs:
if: ${{ steps.filter.outputs.go == 'true' || steps.filter.outputs.linter == 'true'}} if: ${{ steps.filter.outputs.go == 'true' || steps.filter.outputs.linter == 'true'}}
uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8 uses: golangci/golangci-lint-action@4afd733a84b1f43292c63897423277bb7f4313a9 # v8
with: with:
version: v2.3.0 # renovate: depName=golangci/golangci-lint datasource=github-releases version: v2.3.1 # renovate: depName=golangci/golangci-lint datasource=github-releases
skip-cache: true skip-cache: true
args: -v --timeout=10m args: -v --timeout=10m

View File

@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- name: Generate Short Lived OAuth App Token - name: Generate Short Lived OAuth App Token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 uses: actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b # v2.1.1
id: app-token id: app-token
with: with:
app-id: "${{ secrets.BOT_APP_ID }}" app-id: "${{ secrets.BOT_APP_ID }}"
@ -19,10 +19,10 @@ jobs:
repositories: "${{ github.event.repository.name }}" repositories: "${{ github.event.repository.name }}"
- name: Checkout - name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Link Checker - name: Link Checker
uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332 # v2.4.1 uses: lycheeverse/lychee-action@5c4ee84814c983aa7164eaee476f014e53ff3963 # v2.5.0
id: lychee id: lychee
env: env:
GITHUB_TOKEN: "${{ steps.app-token.outputs.token }}" GITHUB_TOKEN: "${{ steps.app-token.outputs.token }}"

View File

@ -23,7 +23,7 @@ jobs:
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
- name: Generate Short Lived OAuth App Token - name: Generate Short Lived OAuth App Token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 uses: actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b # v2.1.1
id: app-token id: app-token
with: with:
app-id: "${{ secrets.BOT_APP_ID }}" app-id: "${{ secrets.BOT_APP_ID }}"
@ -32,7 +32,7 @@ jobs:
repositories: "${{ github.event.repository.name }}" repositories: "${{ github.event.repository.name }}"
- name: Checkout - name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with: with:
fetch-depth: 0 fetch-depth: 0

View File

@ -13,7 +13,7 @@ jobs:
contents: write contents: write
steps: steps:
- name: Generate Short Lived OAuth App Token - name: Generate Short Lived OAuth App Token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 uses: actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b # v2.1.1
id: app-token id: app-token
with: with:
app-id: "${{ secrets.BOT_APP_ID }}" app-id: "${{ secrets.BOT_APP_ID }}"

View File

@ -12,7 +12,7 @@ jobs:
pull-requests: write pull-requests: write
steps: steps:
- name: Generate Short Lived OAuth App Token - name: Generate Short Lived OAuth App Token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 uses: actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b # v2.1.1
id: app-token id: app-token
with: with:
app-id: "${{ secrets.BOT_APP_ID }}" app-id: "${{ secrets.BOT_APP_ID }}"

View File

@ -13,7 +13,7 @@ jobs:
timeout-minutes: 5 timeout-minutes: 5
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with: with:
fetch-depth: 1 fetch-depth: 1
@ -51,7 +51,7 @@ jobs:
run: echo "$GITHUB_CONTEXT" run: echo "$GITHUB_CONTEXT"
- name: Checkout - name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with: with:
fetch-depth: 1 fetch-depth: 1

View File

@ -35,7 +35,7 @@ jobs:
run: echo "$GITHUB_CONTEXT" run: echo "$GITHUB_CONTEXT"
- name: Checkout - name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
with: with:
fetch-depth: 1 fetch-depth: 1
ref: ${{ github.event.inputs.ref || github.ref}} ref: ${{ github.event.inputs.ref || github.ref}}

View File

@ -205,6 +205,7 @@
</tr> </tr>
<tr> <tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/twentybit"><img src="https://avatars.githubusercontent.com/u/60849886?v=4?s=100" width="100px;" alt="Ryan W"/><br /><sub><b>Ryan W</b></sub></a><br /><a href="https://github.com/bpg/terraform-provider-proxmox/commits?author=twentybit" title="Documentation">📖</a></td> <td align="center" valign="top" width="14.28%"><a href="https://github.com/twentybit"><img src="https://avatars.githubusercontent.com/u/60849886?v=4?s=100" width="100px;" alt="Ryan W"/><br /><sub><b>Ryan W</b></sub></a><br /><a href="https://github.com/bpg/terraform-provider-proxmox/commits?author=twentybit" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/kam193"><img src="https://avatars.githubusercontent.com/u/8472271?v=4?s=100" width="100px;" alt="Kamil Mańkowski"/><br /><sub><b>Kamil Mańkowski</b></sub></a><br /><a href="https://github.com/bpg/terraform-provider-proxmox/commits?author=kam193" title="Code">💻</a></td>
</tr> </tr>
</tbody> </tbody>
<tfoot> <tfoot>

View File

@ -3,7 +3,7 @@ TARGETS=darwin linux windows
TERRAFORM_PLUGIN_EXTENSION= TERRAFORM_PLUGIN_EXTENSION=
VERSION=0.81.0# x-release-please-version VERSION=0.81.0# x-release-please-version
GOLANGCI_LINT_VERSION=2.3.0# renovate: depName=golangci/golangci-lint datasource=github-releases GOLANGCI_LINT_VERSION=2.3.1# renovate: depName=golangci/golangci-lint datasource=github-releases
# check if opentofu is installed and use it if it is, # check if opentofu is installed and use it if it is,
# otherwise use terraform # otherwise use terraform

View File

@ -3,21 +3,21 @@ layout: page
page_title: "Clone a VM" page_title: "Clone a VM"
subcategory: Guides subcategory: Guides
description: |- description: |-
This guide explains how to create a VM template and then clone it to another VM. This guide explains how to create a VM template and clone it to a new VM.
--- ---
# Clone a VM # Clone a VM
## Create a VM template ## Create a VM template
VM templates in Proxmox provide an efficient way to create multiple identical VMs. Templates act as a base image that can be cloned to create new VMs, ensuring consistency and reducing the time needed to provision new instances. When a VM is created as a template, it is read-only and can't be started, but can be cloned multiple times to create new VMs. VM templates in Proxmox provide an efficient way to create multiple identical VMs. Templates act as a base image that can be cloned to create new VMs, ensuring consistency and reducing the time needed to provision new instances. When a VM is created as a template, it is read-only and cannot be started, but can be cloned multiple times to create new VMs.
You can create a template directly in Proxmox by setting the `template` attribute to `true` when creating the VM resource: You can create a template with Terraform by setting the `template` attribute to `true` when creating the VM resource:
```terraform ```terraform
resource "proxmox_virtual_environment_vm" "ubuntu_template" { resource "proxmox_virtual_environment_vm" "ubuntu_template" {
name = "ubuntu-template" name = "ubuntu-template"
node_name = "pve" node_name = var.virtual_environment_node_name
template = true template = true
started = false started = false
@ -35,12 +35,12 @@ resource "proxmox_virtual_environment_vm" "ubuntu_template" {
} }
efi_disk { efi_disk {
datastore_id = "local" datastore_id = var.datastore_id
type = "4m" type = "4m"
} }
disk { disk {
datastore_id = "local-lvm" datastore_id = var.datastore_id
file_id = proxmox_virtual_environment_download_file.ubuntu_cloud_image.id file_id = proxmox_virtual_environment_download_file.ubuntu_cloud_image.id
interface = "virtio0" interface = "virtio0"
iothread = true iothread = true
@ -67,18 +67,18 @@ resource "proxmox_virtual_environment_vm" "ubuntu_template" {
resource "proxmox_virtual_environment_download_file" "ubuntu_cloud_image" { resource "proxmox_virtual_environment_download_file" "ubuntu_cloud_image" {
content_type = "iso" content_type = "iso"
datastore_id = "local" datastore_id = "local"
node_name = "pve" node_name = var.virtual_environment_node_name
url = "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img" url = "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img"
} }
``` ```
Once you have a template, you can clone it to create new VMs. The cloned VMs will inherit all the configuration from the template but can be customized further as needed. Once you have a template, you can clone it to create new VMs. The cloned VMs will inherit all configuration from the template but can be customized further as needed.
```terraform ```terraform
resource "proxmox_virtual_environment_vm" "ubuntu_clone" { resource "proxmox_virtual_environment_vm" "ubuntu_clone" {
name = "ubuntu-clone" name = "ubuntu-clone"
node_name = "pve" node_name = var.virtual_environment_node_name
clone { clone {
vm_id = proxmox_virtual_environment_vm.ubuntu_template.id vm_id = proxmox_virtual_environment_vm.ubuntu_template.id
@ -113,3 +113,5 @@ output "vm_ipv4_address" {
value = proxmox_virtual_environment_vm.ubuntu_clone.ipv4_addresses[1][0] value = proxmox_virtual_environment_vm.ubuntu_clone.ipv4_addresses[1][0]
} }
``` ```
Full example is available in the [examples/guides/clone-vm](https://github.com/bpg/terraform-provider-proxmox/tree/main/examples/guides/clone-vm) directory.

View File

@ -1,6 +1,6 @@
resource "proxmox_virtual_environment_vm" "ubuntu_clone" { resource "proxmox_virtual_environment_vm" "ubuntu_clone" {
name = "ubuntu-clone" name = "ubuntu-clone"
node_name = "pve" node_name = var.virtual_environment_node_name
clone { clone {
vm_id = proxmox_virtual_environment_vm.ubuntu_template.id vm_id = proxmox_virtual_environment_vm.ubuntu_template.id

View File

@ -5,7 +5,7 @@ data "local_file" "ssh_public_key" {
resource "proxmox_virtual_environment_file" "user_data_cloud_config" { resource "proxmox_virtual_environment_file" "user_data_cloud_config" {
content_type = "snippets" content_type = "snippets"
datastore_id = "local" datastore_id = "local"
node_name = "pve" node_name = var.virtual_environment_node_name
source_raw { source_raw {
data = <<-EOF data = <<-EOF

View File

@ -1,6 +1,6 @@
resource "proxmox_virtual_environment_vm" "ubuntu_template" { resource "proxmox_virtual_environment_vm" "ubuntu_template" {
name = "ubuntu-template" name = "ubuntu-template"
node_name = "pve" node_name = var.virtual_environment_node_name
template = true template = true
started = false started = false
@ -18,12 +18,12 @@ resource "proxmox_virtual_environment_vm" "ubuntu_template" {
} }
efi_disk { efi_disk {
datastore_id = "local" datastore_id = var.datastore_id
type = "4m" type = "4m"
} }
disk { disk {
datastore_id = "local-lvm" datastore_id = var.datastore_id
file_id = proxmox_virtual_environment_download_file.ubuntu_cloud_image.id file_id = proxmox_virtual_environment_download_file.ubuntu_cloud_image.id
interface = "virtio0" interface = "virtio0"
iothread = true iothread = true
@ -50,7 +50,7 @@ resource "proxmox_virtual_environment_vm" "ubuntu_template" {
resource "proxmox_virtual_environment_download_file" "ubuntu_cloud_image" { resource "proxmox_virtual_environment_download_file" "ubuntu_cloud_image" {
content_type = "iso" content_type = "iso"
datastore_id = "local" datastore_id = "local"
node_name = "pve" node_name = var.virtual_environment_node_name
url = "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img" url = "https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img"
} }

View File

@ -8,3 +8,15 @@ variable "virtual_environment_token" {
description = "The token for the Proxmox Virtual Environment API" description = "The token for the Proxmox Virtual Environment API"
sensitive = true sensitive = true
} }
variable "virtual_environment_node_name" {
type = string
description = "The node name for the Proxmox Virtual Environment API"
default = "pve"
}
variable "datastore_id" {
type = string
description = "Datastore for VM disks"
default = "local-lvm"
}

12
go.mod
View File

@ -25,8 +25,8 @@ require (
github.com/rogpeppe/go-internal v1.14.1 github.com/rogpeppe/go-internal v1.14.1
github.com/skeema/knownhosts v1.3.1 github.com/skeema/knownhosts v1.3.1
github.com/stretchr/testify v1.10.0 github.com/stretchr/testify v1.10.0
golang.org/x/crypto v0.40.0 golang.org/x/crypto v0.41.0
golang.org/x/net v0.42.0 golang.org/x/net v0.43.0
) )
require ( require (
@ -89,11 +89,11 @@ require (
github.com/zclconf/go-cty v1.16.3 // indirect github.com/zclconf/go-cty v1.16.3 // indirect
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
golang.org/x/mod v0.25.0 // indirect golang.org/x/mod v0.26.0 // indirect
golang.org/x/sync v0.16.0 // indirect golang.org/x/sync v0.16.0 // indirect
golang.org/x/sys v0.34.0 // indirect golang.org/x/sys v0.35.0 // indirect
golang.org/x/text v0.27.0 // indirect golang.org/x/text v0.28.0 // indirect
golang.org/x/tools v0.34.0 // indirect golang.org/x/tools v0.35.0 // indirect
google.golang.org/appengine v1.6.8 // indirect google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20250218202821-56aae31c358a // indirect
google.golang.org/grpc v1.72.1 // indirect google.golang.org/grpc v1.72.1 // indirect

28
go.sum
View File

@ -256,8 +256,8 @@ golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliY
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4=
golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc=
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk=
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
@ -265,8 +265,8 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w= golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg=
golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
@ -277,8 +277,8 @@ golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@ -307,8 +307,8 @@ golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
@ -319,8 +319,8 @@ golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM=
golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= golang.org/x/term v0.34.0 h1:O/2T7POpk0ZZ7MAzMeWFSg6S5IpWd/RXDlM9hgM3DR4=
golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= golang.org/x/term v0.34.0/go.mod h1:5jC53AEywhIVebHgPVeg0mj8OD3VO9OzclacVrqpaAw=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
@ -332,16 +332,16 @@ golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo= golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0=
golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=

View File

@ -1,23 +0,0 @@
data "proxmox_virtual_environment_sdn_zone_evpn" "example" {
id = "evpn1"
}
output "data_proxmox_virtual_environment_sdn_zone_evpn" {
value = {
id = data.proxmox_virtual_environment_sdn_zone_evpn.example.id
nodes = data.proxmox_virtual_environment_sdn_zone_evpn.example.nodes
controller = data.proxmox_virtual_environment_sdn_zone_evpn.example.controller
vrf_vxlan = data.proxmox_virtual_environment_sdn_zone_evpn.example.vrf_vxlan
advertise_subnets = data.proxmox_virtual_environment_sdn_zone_evpn.example.advertise_subnets
disable_arp_nd_suppression = data.proxmox_virtual_environment_sdn_zone_evpn.example.disable_arp_nd_suppression
exit_nodes = data.proxmox_virtual_environment_sdn_zone_evpn.example.exit_nodes
exit_nodes_local_routing = data.proxmox_virtual_environment_sdn_zone_evpn.example.exit_nodes_local_routing
primary_exit_node = data.proxmox_virtual_environment_sdn_zone_evpn.example.primary_exit_node
rt_import = data.proxmox_virtual_environment_sdn_zone_evpn.example.rt_import
mtu = data.proxmox_virtual_environment_sdn_zone_evpn.example.mtu
dns = data.proxmox_virtual_environment_sdn_zone_evpn.example.dns
dns_zone = data.proxmox_virtual_environment_sdn_zone_evpn.example.dns_zone
ipam = data.proxmox_virtual_environment_sdn_zone_evpn.example.ipam
reverse_dns = data.proxmox_virtual_environment_sdn_zone_evpn.example.reverse_dns
}
}

View File

@ -1,18 +0,0 @@
data "proxmox_virtual_environment_sdn_zone_qinq" "example" {
id = "qinq1"
}
output "data_proxmox_virtual_environment_sdn_zone_qinq" {
value = {
id = data.proxmox_virtual_environment_sdn_zone_qinq.example.id
nodes = data.proxmox_virtual_environment_sdn_zone_qinq.example.nodes
bridge = data.proxmox_virtual_environment_sdn_zone_qinq.example.bridge
service_vlan = data.proxmox_virtual_environment_sdn_zone_qinq.example.service_vlan
service_vlan_protocol = data.proxmox_virtual_environment_sdn_zone_qinq.example.service_vlan_protocol
mtu = data.proxmox_virtual_environment_sdn_zone_qinq.example.mtu
dns = data.proxmox_virtual_environment_sdn_zone_qinq.example.dns
dns_zone = data.proxmox_virtual_environment_sdn_zone_qinq.example.dns_zone
ipam = data.proxmox_virtual_environment_sdn_zone_qinq.example.ipam
reverse_dns = data.proxmox_virtual_environment_sdn_zone_qinq.example.reverse_dns
}
}

View File

@ -1,15 +0,0 @@
data "proxmox_virtual_environment_sdn_zone_simple" "example" {
id = "simple1"
}
output "data_proxmox_virtual_environment_sdn_zone_simple" {
value = {
id = data.proxmox_virtual_environment_sdn_zone_simple.example.id
nodes = data.proxmox_virtual_environment_sdn_zone_simple.example.nodes
mtu = data.proxmox_virtual_environment_sdn_zone_simple.example.mtu
dns = data.proxmox_virtual_environment_sdn_zone_simple.example.dns
dns_zone = data.proxmox_virtual_environment_sdn_zone_simple.example.dns_zone
ipam = data.proxmox_virtual_environment_sdn_zone_simple.example.ipam
reverse_dns = data.proxmox_virtual_environment_sdn_zone_simple.example.reverse_dns
}
}

View File

@ -1,16 +0,0 @@
data "proxmox_virtual_environment_sdn_zone_vlan" "example" {
id = "vlan1"
}
output "data_proxmox_virtual_environment_sdn_zone_vlan" {
value = {
id = data.proxmox_virtual_environment_sdn_zone_vlan.example.id
nodes = data.proxmox_virtual_environment_sdn_zone_vlan.example.nodes
bridge = data.proxmox_virtual_environment_sdn_zone_vlan.example.bridge
mtu = data.proxmox_virtual_environment_sdn_zone_vlan.example.mtu
dns = data.proxmox_virtual_environment_sdn_zone_vlan.example.dns
dns_zone = data.proxmox_virtual_environment_sdn_zone_vlan.example.dns_zone
ipam = data.proxmox_virtual_environment_sdn_zone_vlan.example.ipam
reverse_dns = data.proxmox_virtual_environment_sdn_zone_vlan.example.reverse_dns
}
}

View File

@ -1,16 +0,0 @@
data "proxmox_virtual_environment_sdn_zone_vxlan" "example" {
id = "vxlan1"
}
output "data_proxmox_virtual_environment_sdn_zone_vxlan" {
value = {
id = data.proxmox_virtual_environment_sdn_zone_vxlan.example.id
nodes = data.proxmox_virtual_environment_sdn_zone_vxlan.example.nodes
peers = data.proxmox_virtual_environment_sdn_zone_vxlan.example.peers
mtu = data.proxmox_virtual_environment_sdn_zone_vxlan.example.mtu
dns = data.proxmox_virtual_environment_sdn_zone_vxlan.example.dns
dns_zone = data.proxmox_virtual_environment_sdn_zone_vxlan.example.dns_zone
ipam = data.proxmox_virtual_environment_sdn_zone_vxlan.example.ipam
reverse_dns = data.proxmox_virtual_environment_sdn_zone_vxlan.example.reverse_dns
}
}

View File

@ -1,25 +0,0 @@
# List all SDN zones
data "proxmox_virtual_environment_sdn_zones" "all" {}
# List only EVPN zones
data "proxmox_virtual_environment_sdn_zones" "evpn_only" {
type = "evpn"
}
# List only Simple zones
data "proxmox_virtual_environment_sdn_zones" "simple_only" {
type = "simple"
}
output "data_proxmox_virtual_environment_sdn_zones_all" {
value = {
zones = data.proxmox_virtual_environment_sdn_zones.all.zones
}
}
output "data_proxmox_virtual_environment_sdn_zones_filtered" {
value = {
evpn_zones = data.proxmox_virtual_environment_sdn_zones.evpn_only.zones
simple_zones = data.proxmox_virtual_environment_sdn_zones.simple_only.zones
}
}

View File

@ -560,7 +560,7 @@ func Container() *schema.Resource {
}, },
}, },
}, },
MaxItems: 8, MaxItems: maxNetworkInterfaces,
MinItems: 0, MinItems: 0,
}, },
mkInitializationUserAccount: { mkInitializationUserAccount: {

View File

@ -3,19 +3,21 @@ layout: page
page_title: "Clone a VM" page_title: "Clone a VM"
subcategory: Guides subcategory: Guides
description: |- description: |-
This guide explains how to create a VM template and then clone it to another VM. This guide explains how to create a VM template and clone it to a new VM.
--- ---
# Clone a VM # Clone a VM
## Create a VM template ## Create a VM template
VM templates in Proxmox provide an efficient way to create multiple identical VMs. Templates act as a base image that can be cloned to create new VMs, ensuring consistency and reducing the time needed to provision new instances. When a VM is created as a template, it is read-only and can't be started, but can be cloned multiple times to create new VMs. VM templates in Proxmox provide an efficient way to create multiple identical VMs. Templates act as a base image that can be cloned to create new VMs, ensuring consistency and reducing the time needed to provision new instances. When a VM is created as a template, it is read-only and cannot be started, but can be cloned multiple times to create new VMs.
You can create a template directly in Proxmox by setting the `template` attribute to `true` when creating the VM resource: You can create a template with Terraform by setting the `template` attribute to `true` when creating the VM resource:
{{ codefile "terraform" "examples/guides/clone-vm/template.tf" }} {{ codefile "terraform" "examples/guides/clone-vm/template.tf" }}
Once you have a template, you can clone it to create new VMs. The cloned VMs will inherit all the configuration from the template but can be customized further as needed. Once you have a template, you can clone it to create new VMs. The cloned VMs will inherit all configuration from the template but can be customized further as needed.
{{ codefile "terraform" "examples/guides/clone-vm/clone.tf" }} {{ codefile "terraform" "examples/guides/clone-vm/clone.tf" }}
Full example is available in the [examples/guides/clone-vm](https://github.com/bpg/terraform-provider-proxmox/tree/main/examples/guides/clone-vm) directory.