I decided to spice up my Proxmox VE host by setting the Fish Shell as the default shell for the root user. Fish is known for its user-friendly features like autosuggestions and syntax highlighting, and I thought it would make my command-line experience more enjoyable. Little did I know, this seemingly harmless change would lead to a cascade of problems, particularly when using the bpg/terraform-provider-proxmox provider with Terraform or OpenTofu.
The process started innocently enough. I logged into my Proxmox host (running version 8.3.4) and installed Fish Shell.
Then, I changed the default shell for the root user with chsh -s /usr/bin/fish. Everything seemed fine at first—Fish
worked great, and I was enjoying the colorful prompts and tab completions. I went about my usual tasks, including
managing resources with Terraform.
That's when things went south. I was using the proxmox_virtual_environment_file resource to upload a snippet to my
Proxmox node. My configuration looked something like this:
resource "proxmox_virtual_environment_file" "test_snippet" {
node_name = "pve"
datastore_id = "local"
content_type = "snippets"
source_raw {
data = "test"
file_name = "test.txt"
}
}
I ran terraform apply (using Terraform v1.10.5), expecting the snippet to upload smoothly. Instead, I got a cryptic
error: "Root object was present, but now absent." Digging into the debug logs (TF_LOG=DEBUG), I saw warnings about
the provider producing an invalid plan, specifically for the proxmox_virtual_environment_file.test_snippet resource.
The logs mentioned issues with non-computed attributes like overwrite, timeout_upload, and source_raw[0].resize.
It was a mess, and the snippet never made it to the Proxmox datastore.
After hours of troubleshooting, I stumbled across GitHub issue
#1799, which described the exact problem. The
source_raw property of the proxmox_virtual_environment_file resource was failing, and the issue was linked to the
Proxmox API's expectations. But what did this have to do with Fish?
It turns out that the bpg/terraform-provider-proxmox relies on SSH access for certain operations, particularly when
interacting with the Proxmox API for file uploads. Proxmox requires a root PAM account for some tasks, like managing
hardware mappings or uploading snippets to the local datastore. The provider was configured to use SSH with the root
user (terraform in my case), but Fish, as the default shell, was causing the SSH session to behave unexpectedly.
Fish doesn't fully comply with POSIX standards, unlike Bash or Zsh. The Terraform provider's SSH client was expecting a POSIX-compliant shell to execute commands, but Fish's unique syntax and behavior were causing the session to fail silently. This led to the provider being unable to upload the file, resulting in the "Root object was present, but now absent" error. The non-computed attributes in the logs were a red herring—the real issue was the shell mismatch.
To fix it, I reverted the default shell to Bash using chsh -s /bin/bash. I also updated my Terraform configuration to
ensure the provider used a POSIX-compliant shell explicitly by setting the ssh block in the provider configuration:
provider "proxmox" {
endpoint = "https://pve.example.com:8006/"
username = "root@pam"
password = "your-password"
ssh {
username = "terraform"
shell = "/bin/bash"
}
}
After making these changes and re-running tofu apply, the snippet uploaded successfully. The lesson? Fish is great
for interactive use, but it can wreak havoc when scripts or tools like Terraform expect a POSIX-compliant shell. If
you're managing a Proxmox host, stick to Bash or Zsh for the root user to avoid these headaches. The GitHub issue
helped point me in the right direction, but it was a stark reminder to test shell changes thoroughly, especially in a
production-like environment.