Skip to content

[Bug]: hcloud_ssh_key uses string as id field, but API reports int64 #1163

@simonostendorf

Description

@simonostendorf

What happened?

I am developing a crossplane provider for Hetzner Cloud using upjet code generation. Upjet uses the terraform-provider to generate the controller code. The hcloud terraform-provider reports the hcloud_ssh_key.id field as string, but the api docs say its an int64.

When I try to create the resource in my crossplane provider I always get the error cannot run refresh: refresh failed: Could not parse resource ID: strconv.ParseInt: parsing "": invalid syntax. I guess this is caused by the data type missmatch.

Ive added hcloud_floating_ip to my crossplane provider and its working perfectly, so I guess its not the crossplane provider.

What did you expect to happen?

I expect the id field of the hcloud_ssh_key resource to be an int64 as it is in all other resources (e.g. floating_ip).

Please provide a minimal working example

Strange is, that this returns both strings:

floating_ip_id = "96703327"
ssh_key_id = "100613930"
terraform {
  required_providers {
    hcloud = {
      source  = "hetznercloud/hcloud"
    }
  }
}

provider "hcloud" {
  token = var.hcloud_token
}

variable "hcloud_token" {
  type      = string
  sensitive = true
}

resource "hcloud_ssh_key" "test" {
  name       = "test"
  public_key = "ssh-ed25519 ..."
}

output "ssh_key_id" {
  value = hcloud_ssh_key.test.id
}

resource "hcloud_floating_ip" "test" {
  type          = "ipv4"
  name          = "test"
  home_location = "fsn1"
}

output "floating_ip_id" {
  value = hcloud_floating_ip.test.id
}

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