An open API service indexing awesome lists of open source software.

https://github.com/lkummer/terraform-proxmox


https://github.com/lkummer/terraform-proxmox

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

          

# Terraform Proxmox Module

Terraform modules for working with Proxmox.

Currently contains the `machine` module and an example of it.
Provisioning a virtual machine in Proxmox with autogenerated user name and password.

**IMPORTANT** this repository is push mirrored from my private GitLab.
Changes on the mirror will be discarded.

## Usage

See the `examples` folder for full examples.

See variable descriptions for more information on specific variables.

Note you must have a Proxmox template with Cloud Init to use the `machine` module.

## Development

### Running Tests

Set `PM_API_TOKEN_ID` and `PM_API_TOKEN_SECRET` environment variables with your Proxmox token ID and secret token.
Note the token ID _must_ contain the username and realm, for example `root@pam!token`.

To run tests:

```
cd test
go test .
```

Note it takes a while as it provisions real resources.

### Managing Credentials

[See Proxmox Terraform provider documentation](https://registry.terraform.io/providers/Telmate/proxmox/latest/docs#creating-the-proxmox-user-and-role-for-terraform) on creating a role with privileges for Terraform.

For instructions on creating a role with correct privileges and creating an API token, [check out this guide on the wiki](https://homelab.pages.houseofkummer.com/wiki/administrate/proxmox-api-tokens/).

It is recommended to use a `.env` file to manage credentials.
For example:

```bash
# Inside .env
export PROXMOX_VE_API_TOKEN='user@pve!token=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
```

### Linting

The repository is linted in CI.
Make sure to lint before pushing.

```
tflint --module modules/machine
tflint examples/alpine-machine
tflint examples/debian-machine
```

### Formatting

Formatting is checked in CI.
Make sure to format code before pushing.

```
terraform fmt -recursive .
```

### Linting the Tests

The tests are linted in CI.
Make sure to lint before pushing.

```
cd test
golangci-lint run
```

### Formatting the Tests

Test formatting is checked in CI.
Make sure to format the tests before pushing.

```
cd test
gofmt -w .
```

## Contribution

This repository is built for my own needs, not for generic use.
Adding features for public consumption will make it needlessly complex.
Please learn from it and make your own modules instead of contributing new features.

Please open an issue before working on pull requests.

This repository is mirroring a private repository, changes to the mirror will be overridden.