GithubHelp home page GithubHelp logo

proxmox-cluster-example's Introduction

Prerequisites

  • Block of MAC addresses with static IP assignments
  • Access to a Proxmox host
  • Terraform installed locally (will try to make everything else happen on the proxmox host)

Creating a Terraform user in Proxmox

From the Proxmox provider docs: https://registry.terraform.io/providers/Telmate/proxmox/latest/docs

Commands:

Run these commands in the Proxmox shell to generate a user for Terraform to use when provisioning resources. See the docs above to learn more about creating the user. Ideally this is handled automagically by Ansible. Basically its the following:

  • Create a new role, TerraformProv, for the future terraform user.
  • Create the user terraform-prov@pve
  • Add the TerraformProv role to the terraform-prov user
  • Create an API token for the terraform-prov@pve
pveum role add TerraformProv -privs "VM.Allocate VM.Clone VM.Config.CDROM VM.Config.CPU VM.Config.Cloudinit VM.Config.Disk VM.Config.HWType VM.Config.Memory VM.Config.Network VM.Config.Options VM.Monitor VM.Audit VM.PowerMgmt Datastore.AllocateSpace Datastore.Audit"
pveum user add terraform-prov@pve
pveum aclmod / -user terraform-prov@pve -role TerraformProv
pveum user token add terraform-prov@pve terraform-provisioner --privsep 0

Result of the commands:

The last command will output a table similar to the one below. It will contain the API token secret value which will be different from the one below. The values returned here should ideally be saved somewhere like Vault to ensure secure access later when managing resources in Proxmox.

name value provider config value
full-tokenid terraform-prov@pve!terraform-provisioner pm_api_token_id
info {"privsep":0} N/A
value e5d09f8d-XXXX-XXXX-XXXX-a098ddcfd54a pm_api_token_secret

Installing Terraform

Following the instructions here: https://learn.hashicorp.com/tutorials/terraform/install-cli

Run the following command block to install the Terraform cli tool on Debian systems.

sudo apt-get update && sudo apt-get install -y gnupg software-properties-common curl ; \
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add - ; \
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main" ; \
sudo apt-get update && sudo apt-get install terraform ;

proxmox-cluster-example's People

Contributors

chippawah avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

proxmox-cluster-example's Issues

Running from Mac

Hi,

I got this, while trying to run it from my mac against our proxmox cluster.

module.talos.proxmox_vm_qemu.talos-control-plane-node[1]: Creating...
module.talos.proxmox_vm_qemu.talos-worker-node[2]: Creating...
module.talos.proxmox_vm_qemu.talos-control-plane-node[2]: Creating...
module.talos.proxmox_vm_qemu.talos-worker-node[0]: Creating...
module.talos.proxmox_vm_qemu.talos-control-plane-node[0]: Creating...
module.talos.proxmox_vm_qemu.talos-worker-node[3]: Creating...
module.talos.proxmox_vm_qemu.talos-worker-node[4]: Creating...
module.talos.proxmox_vm_qemu.talos-worker-node[1]: Creating...
module.talos.proxmox_vm_qemu.talos-worker-node[2]: Still creating... [10s elapsed]
module.talos.proxmox_vm_qemu.talos-control-plane-node[1]: Still creating... [10s elapsed]
module.talos.proxmox_vm_qemu.talos-control-plane-node[2]: Still creating... [10s elapsed]
module.talos.proxmox_vm_qemu.talos-worker-node[0]: Still creating... [10s elapsed]
module.talos.proxmox_vm_qemu.talos-control-plane-node[0]: Still creating... [10s elapsed]
module.talos.proxmox_vm_qemu.talos-worker-node[3]: Still creating... [10s elapsed]
module.talos.proxmox_vm_qemu.talos-worker-node[4]: Still creating... [10s elapsed]
module.talos.proxmox_vm_qemu.talos-worker-node[1]: Still creating... [10s elapsed]
╷
│ Error: Plugin did not respond
│ 
│   with module.talos.proxmox_vm_qemu.talos-control-plane-node[0],
│   on talos/control_plane_node.tf line 1, in resource "proxmox_vm_qemu" "talos-control-plane-node":
│    1: resource "proxmox_vm_qemu" "talos-control-plane-node" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
╷
│ Error: Plugin did not respond
│ 
│   with module.talos.proxmox_vm_qemu.talos-control-plane-node[1],
│   on talos/control_plane_node.tf line 1, in resource "proxmox_vm_qemu" "talos-control-plane-node":
│    1: resource "proxmox_vm_qemu" "talos-control-plane-node" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
╷
│ Error: Plugin did not respond
│ 
│   with module.talos.proxmox_vm_qemu.talos-control-plane-node[2],
│   on talos/control_plane_node.tf line 1, in resource "proxmox_vm_qemu" "talos-control-plane-node":
│    1: resource "proxmox_vm_qemu" "talos-control-plane-node" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
╷
│ Error: Plugin did not respond
│ 
│   with module.talos.proxmox_vm_qemu.talos-worker-node[4],
│   on talos/worker_node.tf line 1, in resource "proxmox_vm_qemu" "talos-worker-node":
│    1: resource "proxmox_vm_qemu" "talos-worker-node" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
╷
│ Error: Plugin did not respond
│ 
│   with module.talos.proxmox_vm_qemu.talos-worker-node[3],
│   on talos/worker_node.tf line 1, in resource "proxmox_vm_qemu" "talos-worker-node":
│    1: resource "proxmox_vm_qemu" "talos-worker-node" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
╷
│ Error: Plugin did not respond
│ 
│   with module.talos.proxmox_vm_qemu.talos-worker-node[2],
│   on talos/worker_node.tf line 1, in resource "proxmox_vm_qemu" "talos-worker-node":
│    1: resource "proxmox_vm_qemu" "talos-worker-node" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵
╷
│ Error: Plugin did not respond
│ 
│   with module.talos.proxmox_vm_qemu.talos-worker-node[1],
│   on talos/worker_node.tf line 1, in resource "proxmox_vm_qemu" "talos-worker-node":
│    1: resource "proxmox_vm_qemu" "talos-worker-node" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵

Stack trace from the terraform-provider-proxmox_v2.9.3 plugin:

panic: interface conversion: interface {} is nil, not []interface {}

goroutine 148 [running]:
github.com/Telmate/proxmox-api-go/proxmox.(*Client).GetVmRefsByName(0xc00055e640, 0xc000540150, 0x15, 0x1, 0x1, 0x0, 0x0, 0xc000234400)
	github.com/Telmate/[email protected]/proxmox/client.go:190 +0x845
github.com/Telmate/proxmox-api-go/proxmox.(*Client).GetVmRefByName(...)
	github.com/Telmate/[email protected]/proxmox/client.go:180
github.com/Telmate/terraform-provider-proxmox/proxmox.resourceVmQemuCreate(0xc0001f9e80, 0x17c53c0, 0xc0004b20f0, 0x9, 0xffffffffffffffff)
	github.com/Telmate/terraform-provider-proxmox/proxmox/resource_vm_qemu.go:738 +0x1886
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).create(0xc000448460, 0x1a0b1b8, 0xc000796440, 0xc0001f9e80, 0x17c53c0, 0xc0004b20f0, 0x0, 0x0, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:329 +0x1ee
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).Apply(0xc000448460, 0x1a0b1b8, 0xc000796440, 0xc0005ae270, 0xc0001f9a80, 0x17c53c0, 0xc0004b20f0, 0x0, 0x0, 0x0, ...)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:467 +0x67b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).ApplyResourceChange(0xc0000c60c0, 0x1a0b1b8, 0xc000796440, 0xc000198230, 0xc000796440, 0x18d06a0, 0xc000890100)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:977 +0xacf
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).ApplyResourceChange(0xc000388bc0, 0x1a0b260, 0xc000796440, 0xc00054c000, 0xc000388bc0, 0xc000511ba0, 0x106c287)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:332 +0xb5
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_ApplyResourceChange_Handler(0x18d06a0, 0xc000388bc0, 0x1a0b260, 0xc000890180, 0xc0000cad20, 0x0, 0x1a0b260, 0xc000890180, 0xc0005cec80, 0xc10)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:380 +0x214
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0000e2540, 0x1a12c18, 0xc00008bb00, 0xc00058c5a0, 0xc0003827b0, 0x1e55f40, 0x0, 0x0, 0x0)
	google.golang.org/[email protected]/server.go:1282 +0x52b
google.golang.org/grpc.(*Server).handleStream(0xc0000e2540, 0x1a12c18, 0xc00008bb00, 0xc00058c5a0, 0x0)
	google.golang.org/[email protected]/server.go:1616 +0xd0c
google.golang.org/grpc.(*Server).serveStreams.func1.2(0xc0000341c0, 0xc0000e2540, 0x1a12c18, 0xc00008bb00, 0xc00058c5a0)
	google.golang.org/[email protected]/server.go:921 +0xab
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/[email protected]/server.go:919 +0x1fd

Error: The terraform-provider-proxmox_v2.9.3 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.
╷
│ Error: Plugin did not respond
│ 
│   with module.talos.proxmox_vm_qemu.talos-worker-node[0],
│   on talos/worker_node.tf line 1, in resource "proxmox_vm_qemu" "talos-worker-node":
│    1: resource "proxmox_vm_qemu" "talos-worker-node" {
│ 
│ The plugin encountered an error, and failed to respond to the plugin.(*GRPCProvider).ApplyResourceChange call. The plugin logs may contain more details.
╵

cosmic@Revenger proxmox-cluster %      
```                                                                                                                    [10:27PM]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.