mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-07-04 21:14:05 +00:00
103 lines
3.8 KiB
Markdown
103 lines
3.8 KiB
Markdown
---
|
|
layout: home
|
|
title: Introduction
|
|
nav_order: 1
|
|
---
|
|
|
|
# Proxmox Provider
|
|
|
|
This provider for [Terraform](https://www.terraform.io/) is used to interact with resources supported by [Proxmox](https://www.proxmox.com/en/). The provider needs to be configured with the proper endpoints and credentials before it can be used.
|
|
|
|
Use the navigation to the left to read about the available resources.
|
|
|
|
## Example Usage
|
|
|
|
```
|
|
provider "proxmox" {
|
|
virtual_environment {
|
|
endpoint = "https://10.0.0.2"
|
|
username = "root@pam"
|
|
password = "the-password-set-during-installation-of-proxmox-ve"
|
|
insecure = true
|
|
}
|
|
}
|
|
```
|
|
|
|
## Installation
|
|
|
|
You can install a specific version of the provider on Windows using Git Bash:
|
|
|
|
```sh
|
|
$ export PLUGINS_PATH="$(cygpath "$APPDATA")/terraform.d/plugins"
|
|
$ export PROVIDER_VERSION="0.2.0"
|
|
$ mkdir -p "$PLUGINS_PATH"
|
|
$ curl -o "${PLUGINS_PATH}/terraform-provider-proxmox.zip" -sL https://github.com/danitso/terraform-provider-proxmox/releases/download/${PROVIDER_VERSION}/terraform-provider-proxmox_v${PROVIDER_VERSION}-custom_windows_amd64.zip
|
|
$ unzip -o -d "$PLUGINS_PATH" "${PLUGINS_PATH}/terraform-provider-proxmox.zip"
|
|
$ rm "${PLUGINS_PATH}/terraform-provider-proxmox.zip"
|
|
```
|
|
|
|
On all other platforms, you should be able to install it using Bash:
|
|
|
|
```sh
|
|
$ export PLUGINS_PATH="${HOME}/.terraform.d/plugins"
|
|
$ export PROVIDER_VERSION="0.2.0"
|
|
$ mkdir -p "$PLUGINS_PATH"
|
|
$ curl -o "${PLUGINS_PATH}/terraform-provider-proxmox.zip" -sL https://github.com/danitso/terraform-provider-proxmox/releases/download/${PROVIDER_VERSION}/terraform-provider-proxmox_v${PROVIDER_VERSION}-custom_windows_amd64.zip
|
|
$ unzip -o -d "$PLUGINS_PATH" "${PLUGINS_PATH}/terraform-provider-proxmox.zip"
|
|
$ rm "${PLUGINS_PATH}/terraform-provider-proxmox.zip"
|
|
```
|
|
|
|
## Authentication
|
|
|
|
The Proxmox provider offers a flexible means of providing credentials for authentication. The following methods are supported, in this order, and explained below:
|
|
|
|
* Static credentials
|
|
* Environment variables
|
|
|
|
### Static credentials
|
|
|
|
Warning: Hard-coding credentials into any Terraform configuration is not recommended, and risks secret leakage should this file ever be committed to a public version control system.
|
|
{: .label .label-red }
|
|
|
|
Static credentials can be provided by adding a `username` and `password` in-line in the Proxmox provider block:
|
|
|
|
```
|
|
provider "proxmox" {
|
|
virtual_environment {
|
|
username = "username@realm"
|
|
password = "a-strong-password"
|
|
}
|
|
}
|
|
```
|
|
|
|
### Environment variables
|
|
|
|
You can provide your credentials via the `PROXMOX_VE_USERNAME` and `PROXMOX_VE_PASSWORD`, environment variables, representing your Proxmox username, realm and password, respectively:
|
|
|
|
```
|
|
provider "proxmox" {
|
|
virtual_environment {}
|
|
}
|
|
```
|
|
|
|
Usage:
|
|
|
|
```sh
|
|
$ export PROXMOX_VE_USERNAME="username@realm"
|
|
$ export PROXMOX_VE_PASSWORD="a-strong-password"
|
|
$ terraform plan
|
|
```
|
|
|
|
## Arguments Reference
|
|
|
|
In addition to [generic provider arguments](https://www.terraform.io/docs/configuration/providers.html) (e.g. `alias` and `version`), the following arguments are supported in the Proxmox `provider` block:
|
|
|
|
* `virtual_environment` - (Optional) A `virtual_environment` block (documented below). Only one `virtual_environment` block may be in the configuration.
|
|
|
|
The nested `virtual_environment` block supports the following:
|
|
|
|
* `endpoint` - (Required) The endpoint for the Proxmox Virtual Environment API (can also be sourced from `PROXMOX_VE_ENDPOINT`).
|
|
* `insecure` - (Optional) Whether to skip the TLS verification step (can also be sourced from `PROXMOX_VE_INSECURE`). If omitted, defaults to `false`.
|
|
* `password` - (Required) The password for the Proxmox Virtual Environment API (can also be sourced from `PROXMOX_VE_PASSWORD`).
|
|
* `username` - (Required) The username and realm for the Proxmox Virtual Environment API (can also be sourced from `PROXMOX_VE_USERNAME`).
|