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

[Bug]: Null value found in ssh_keys list from hcloud_server resource #1084

Open
zvonimir907 opened this issue Feb 11, 2025 · 1 comment
Open
Labels

Comments

@zvonimir907
Copy link

zvonimir907 commented Feb 11, 2025

What happened?

Since the release of version 1.49.1, resource hcloud_server throws the following error, on terraform plan, when trying to fetch the id form hcloud_ssh_key data source:

╷
│ Error: Null value found in list
│ 
│   with module.hetzner_empty_instance[0].hcloud_server.server[0],
│   on ../../modules/hetzner/server/servers.tf line 15, in resource "hcloud_server" "server":
│   15:   ssh_keys     = [data.hcloud_ssh_key.provider_ssh_key.id]
│ 
│ Null values are not allowed for this attribute value.
╵

What did you expect to happen?

The last working version of provider was 1.49.0. Where the id from the data source could be fetched by name.

I've hard coded the version of the provider to 1.49.0. Where things work as expected.

Please provide a minimal working example

data "hcloud_ssh_key" "provider_ssh_key" {
  name = var.provider_ssh_key_name
}

resource "hcloud_server" "server" {
  name        = var.server_name
  server_type = var.server_type
  image       = var.server_image
  ssh_keys    = [data.hcloud_ssh_key.provider_ssh_key.id]
}
@jooola
Copy link
Member

jooola commented Feb 13, 2025

@zvonimir907 I am not able to reproduce your issue, could you maybe add the following to your config:

output "debug" {
  value = data.hcloud_ssh_key.provider_ssh_key
}

And provide the debug logs when running terraform plan:

TF_LOG=DEBUG TF_LOG_PATH=debug.log terraform plan

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

No branches or pull requests

2 participants