Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] Example "Backup and restore cluster" gives error when no snapshot name is provided: invalid empty string in 'scripts' #1676

Open
ToshY opened this issue Mar 25, 2025 · 0 comments

Comments

@ToshY
Copy link

ToshY commented Mar 25, 2025

Problem

I've tried using the snippet in the Examples section about "Backup and restore a cluster". But when executing a terraform apply -auto-approve, it shows an error at the end.

module.kube-hetzner.null_resource.agent_config["0-0-agent-nbg1-1"]: Creation complete after 3s [id=...]
╷
│ Error: remote-exec provisioner error
│
│   with module.kube-hetzner.null_resource.first_control_plane,
│   on .terraform/modules/kube-hetzner/init.tf line 70, in resource "null_resource" "first_control_plane":
│   70:   provisioner "remote-exec" {
│
│ invalid empty string in 'scripts'

I have not provided the etcd_snapshot_name, and looking at the code, it should not be needed if I do not want to perform a restore. But seems that it cannot handle empty string values in the list of the postinstall_exec command.

If I use compact to strip empty strings it seems to work.

-  postinstall_exec = [
+  postinstall_exec = compact([
    (
      local.etcd_snapshot_name == "" ? "" :
      <<-EOF
      # ...
    )
+  ])

Please let me know if I was using it (in)correctly. If so, maybe the docs can be updated to fix this minor inconvenience (I'm willing to create the PR).

p.s.

I'm new to the world of Terraform with only basic knowledge of Kubernetes. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant