Skip to content

Can't execute examples: SSH doesn't work without password specified #2578

Description

@TobiPeterG

Describe the bug
Hi,
I setup a test proxmox instance to execute the "example" commands. Unfortunately, it told me that SSH connection was not possible, even though I setup the .tfvars file as shown in the how-to guide. The solution was to add the "password" key in the provider config in main.tf and set it to the root password already specified.
The docs however say: Optional) The password to use for the SSH connection. Defaults to the password used for the Proxmox API connection. Can also be sourced from PROXMOX_VE_SSH_PASSWORD.
So I guess this should have worked from the beginning? My main.tf in example now looks like this:

provider "proxmox" {
  endpoint  = var.virtual_environment_endpoint
  api_token = var.virtual_environment_api_token
  insecure  = true
  ssh {
    agent    = true
    username = var.virtual_environment_ssh_username
    password = var.virtual_environment_root_password
  }
}

provider "proxmox" {
  alias    = "root"
  endpoint = var.virtual_environment_endpoint
  username = "root@pam"
  password = var.virtual_environment_root_password
  insecure = true
}

Can someone confirm this?

PS: It would be nice if the tutorial also mentions that the proxmox node needs to have the hostname "pve", this is only listed in the README itself.

To Reproduce
Steps to reproduce the behavior:

  1. Setup proxmox test instance as described
  2. Setup tfvars file as described
  3. Run "make example"
  4. See error

Please also provide a minimal Terraform configuration that reproduces the issue.

# >>> put your example here <<< #

and the output of terraform|tofu apply.

╷
│ Error: failed to open SSH client: unable to authenticate user "root" over SSH to "10.127.214.132:22". Please verify that ssh-agent is correctly loaded with an authorized key via 'ssh-add -L' (NOTE: configurations in ~/.ssh/config are not considered by the provider): failed to dial 10.127.214.132:22: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
│ 
│   with proxmox_virtual_environment_file.user_config,
│   on resource_virtual_environment_file.tf line 5, in resource "proxmox_virtual_environment_file" "user_config":
│    5: resource "proxmox_virtual_environment_file" "user_config" {
│ 
╵
╷
│ Error: failed to open SSH client: unable to authenticate user "root" over SSH to "10.127.214.132:22". Please verify that ssh-agent is correctly loaded with an authorized key via 'ssh-add -L' (NOTE: configurations in ~/.ssh/config are not considered by the provider): failed to dial 10.127.214.132:22: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
│ 
│   with proxmox_virtual_environment_file.vendor_config,
│   on resource_virtual_environment_file.tf line 32, in resource "proxmox_virtual_environment_file" "vendor_config":
│   32: resource "proxmox_virtual_environment_file" "vendor_config" {
│ 
╵
╷
│ Error: failed to open SSH client: unable to authenticate user "root" over SSH to "10.127.214.132:22". Please verify that ssh-agent is correctly loaded with an authorized key via 'ssh-add -L' (NOTE: configurations in ~/.ssh/config are not considered by the provider): failed to dial 10.127.214.132:22: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none password], no supported methods remain
│ 
│   with proxmox_virtual_environment_file.meta_config,
│   on resource_virtual_environment_file.tf line 53, in resource "proxmox_virtual_environment_file" "meta_config":
│   53: resource "proxmox_virtual_environment_file" "meta_config" {
│ 
╵
╷
│ Error: error retrieving firewall rules: received an HTTP 500 response - Reason: hostname lookup 'pve' failed - failed to get address info for: pve: Name or service not known
│ 
│   with proxmox_virtual_environment_firewall_rules.node_rules,
│   on resource_virtual_environment_firewall_rules.tf line 84, in resource "proxmox_virtual_environment_firewall_rules" "node_rules":
│   84: resource "proxmox_virtual_environment_firewall_rules" "node_rules" {
│ 
╵
╷
│ Error: failed to update node time: received an HTTP 400 response - Reason: Parameter verification failed. (timezone: No such timezone)
│ 
│   with proxmox_virtual_environment_time.example,
│   on resource_virtual_environment_time.tf line 1, in resource "proxmox_virtual_environment_time" "example":
│    1: resource "proxmox_virtual_environment_time" "example" {
│ 

Expected behavior
SSH authentication works without adding the "password" key

Additional context
Add any other context about the problem here.

  • Single or clustered Proxmox: single
  • Proxmox version: 9.1.1
  • Provider version (ideally it should be the latest version): fix(vm): set power state of VM centrally #2508
  • Terraform/OpenTofu version: v1.10.6
  • OS (where you run Terraform/OpenTofu from): openSUSE Tumbleweed
  • Debug logs (TF_LOG=DEBUG terraform apply):

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions