0
0
mirror of https://github.com/bpg/terraform-provider-proxmox.git synced 2025-06-29 18:21:10 +00:00
Terraform / OpenTofu Provider for Proxmox VE
Go to file
Pavel Boldyrev 914631f58b
fix(build): Fix make example-init for TF 1.4 (#262)
* fix(build): Fix make example-init for TF 1.4

* add 1.4.2 to versions list
2023-03-16 22:09:41 -04:00
.github fix(build): Fix make example-init for TF 1.4 (#262) 2023-03-16 22:09:41 -04:00
docs add missing custom CPU model documentation 2023-03-12 21:07:51 -04:00
example fix(build): Fix make example-init for TF 1.4 (#262) 2023-03-16 22:09:41 -04:00
proxmox fix(vm): Fix file_format setting for new empty disks (#259) 2023-03-13 23:45:08 -04:00
proxmoxtf fix(vm): Fix file_format setting for new empty disks (#259) 2023-03-13 23:45:08 -04:00
tools chore(deps): bump github.com/goreleaser/goreleaser from 1.15.2 to 1.16.1 in /tools (#258) 2023-03-14 03:47:23 +00:00
.github_changelog_generator move release branch param to action 2022-03-21 21:28:21 -04:00
.gitignore chore: tweak codeql action (#145) 2022-10-17 01:42:10 -04:00
.go-version chore: use automatic versioning in Makefile 2022-10-16 21:40:19 -04:00
.golangci.yml chore: lint and reformat the code (#204) 2023-01-16 18:07:30 -05:00
.goreleaser.yml chore: new release workflow (#135) 2022-10-16 20:25:31 -04:00
.mergify.yml chore(mergify): update config (#166) 2022-11-17 20:38:49 -05:00
CHANGELOG.md chore(main): release 0.14.0 (#252) 2023-03-13 23:54:43 -04:00
CODE_OF_CONDUCT.md Update project to use bpg/terraform-provider-proxmox 2021-09-09 12:20:19 -04:00
commitlint.config.js chore: lint and reformat the code (#204) 2023-01-16 18:07:30 -05:00
CONTRIBUTING.md chore: add stale items check CI workflow (#183) 2022-12-11 17:00:32 -05:00
example.tfrc fix(build): Fix make example-init for TF 1.4 (#262) 2023-03-16 22:09:41 -04:00
go.mod chore(deps): bump golang.org/x/crypto from 0.6.0 to 0.7.0 (#248) 2023-03-06 23:09:56 -05:00
go.sum chore(deps): bump golang.org/x/crypto from 0.6.0 to 0.7.0 (#248) 2023-03-06 23:09:56 -05:00
HISTORY.md tweak changelog generation 2021-09-09 07:25:06 -04:00
LICENSE Initial work 2019-12-07 19:58:29 +01:00
main.go fix(vm): Make so that on_boot can be changed with update (#199) 2023-01-02 15:40:52 -05:00
Makefile fix(build): Fix make example-init for TF 1.4 (#262) 2023-03-16 22:09:41 -04:00
README.md chore(deps): bump dependencies (#216) 2023-01-24 02:03:51 +00:00

Terraform Provider for Proxmox

Go Report Card codecov GoDoc GitHub release (latest by date) GitHub Release Date GitHub stars Conventional Commits Buy Me A Coffee

A Terraform Provider which adds support for Proxmox solutions.

This repository is a fork of https://github.com/danitso/terraform-provider-proxmox with several critical fixes to unblock VM deployment in Proxmox v7.0, and several other enhancements.

Compatibility Matrix

Proxmox version Provider version
6.x <= 0.4.4
7.x >= 0.4.5

Requirements

  • Terraform 1.1+
  • Go 1.18+ (to build the provider plugin)
  • GoReleaser v1.10+ (to build the provider plugin)

Table of Contents

Building the provider

  • Clone the repository to $GOPATH/src/github.com/bpg/terraform-provider-proxmox:

    mkdir -p "${GOPATH}/src/github.com/bpg"
    cd "${GOPATH}/src/github.com/bpg"
    git clone git@github.com:bpg/terraform-provider-proxmox
    
  • Enter the provider directory and build it:

    cd "${GOPATH}/src/github.com/bpg/terraform-provider-proxmox"
    make build
    

Using the provider

You can find the latest release and its documentation in the Terraform Registry.

Testing the provider

In order to test the provider, you can simply run make test.

make test

Tests are limited to regression tests, ensuring backwards compatibility.

Deploying the example resources

There are number of TF examples in the examples directory, which can be used to deploy a Container, VM, or other Proxmox resources on your test Proxmox cluster. The following assumptions are made about the test Proxmox cluster:

  • It has one node named pve
  • The node has local storages named local and local-lvm

Create examples/terraform.tfvars with the following variables:

virtual_environment_username = "root@pam"
virtual_environment_password = "put-your-password-here"
virtual_environment_endpoint = "https://<your-cluster-endpoint>:8006/"

Then run make example to deploy the example resources.

Known issues

Disk images cannot be imported by non-PAM accounts

Due to limitations in the Proxmox VE API, certain actions need to be performed using SSH. This requires the use of a PAM account (standard Linux account).

Disk images from VMware cannot be uploaded or imported

Proxmox VE is not currently supporting VMware disk images directly. However, you can still use them as disk images by using this workaround:

resource "proxmox_virtual_environment_file" "vmdk_disk_image" {
  content_type = "iso"
  datastore_id = "datastore-id"
  node_name    = "node-name"

  source_file {
    # We must override the file extension to bypass the validation code
    # in the Proxmox VE API.
    file_name = "vmdk-file-name.img"
    path      = "path-to-vmdk-file"
  }
}

resource "proxmox_virtual_environment_vm" "example" {
  //...

  disk {
    datastore_id = "datastore-id"
    # We must tell the provider that the file format is vmdk instead of qcow2.
    file_format  = "vmdk"
    file_id      = "${proxmox_virtual_environment_file.vmdk_disk_image.id}"
  }

  //...
}

Snippets cannot be uploaded by non-PAM accounts

Due to limitations in the Proxmox VE API, certain files need to be uploaded using SFTP. This requires the use of a PAM account (standard Linux account).