Skip to content

[Bug]: image not found #1255

@klemmchr

Description

@klemmchr

What happened?

I am trying to deploy a server from a snapshot. While the plan succeeds the apply fails with the error message image not found. I have double checked that the snapshot does exist and that the id matches.

I am using hetznercloud/hcloud v1.54.0 and OpenTofu v1.10.7 alongside with CDKTF.

Plan

OpenTofu will perform the following actions:

  # hcloud_server.hcloud-server-cluster-bastion-001 will be created
  + resource "hcloud_server" "hcloud-server-cluster-bastion-001" {
      + allow_deprecated_images    = false
      + backup_window              = (known after apply)
      + backups                    = false
      + datacenter                 = "nbg1-dc3"
      + delete_protection          = true
      + firewall_ids               = [
          + 10153874,
        ]
      + id                         = (known after apply)
      + ignore_remote_firewall_ids = false
      + image                      = "331978327"
      + ipv4_address               = (known after apply)
      + ipv6_address               = (known after apply)
      + ipv6_network               = (known after apply)
      + keep_disk                  = true
      + labels                     = {
          + "managed-by" = "iac"
        }
      + location                   = (known after apply)
      + name                       = "cluster-bastion-001"
      + placement_group_id         = 1257447
      + primary_disk_size          = (known after apply)
      + rebuild_protection         = true
      + server_type                = "cx33"
      + shutdown_before_deletion   = true
      + ssh_keys                   = [
          + "Ansible",
        ]
      + status                     = (known after apply)

      + public_net {
          + ipv4         = 106919815
          + ipv4_enabled = true
          + ipv6         = 106919812
          + ipv6_enabled = true
        }
    }

  # hcloud_server.hcloud-server-cluster-bastion-002 will be created
  + resource "hcloud_server" "hcloud-server-cluster-bastion-002" {
      + allow_deprecated_images    = false
      + backup_window              = (known after apply)
      + backups                    = false
      + datacenter                 = "nbg1-dc3"
      + delete_protection          = true
      + firewall_ids               = [
          + 10153874,
        ]
      + id                         = (known after apply)
      + ignore_remote_firewall_ids = false
      + image                      = "331978327"
      + ipv4_address               = (known after apply)
      + ipv6_address               = (known after apply)
      + ipv6_network               = (known after apply)
      + keep_disk                  = true
      + labels                     = {
          + "managed-by" = "iac"
        }
      + location                   = (known after apply)
      + name                       = "cluster-bastion-002"
      + placement_group_id         = 1257447
      + primary_disk_size          = (known after apply)
      + rebuild_protection         = true
      + server_type                = "cx33"
      + shutdown_before_deletion   = true
      + ssh_keys                   = [
          + "Ansible",
        ]
      + status                     = (known after apply)

      + public_net {
          + ipv4         = 106919814
          + ipv4_enabled = true
          + ipv6         = 106919813
          + ipv6_enabled = true
        }
    }

Apply

Error: image not found (invalid_input, ea6205563b2d8d4ad84cc525753e5aa3): []

  with hcloud_server.hcloud-server-cluster-bastion-001,
  on cdk.tf.json line 213, in resource.hcloud_server.hcloud-server-cluster-bastion-001:
 213:       },

Error: image not found (invalid_input, f748dd7cfff6ab13dbfde7f63c5f52e6): []

  with hcloud_server.hcloud-server-cluster-bastion-002,
  on cdk.tf.json line 253, in resource.hcloud_server.hcloud-server-cluster-bastion-002:
 253:       }

What did you expect to happen?

The servers are deployed using the defined snapshot.

Please provide a minimal working example

This is a minimal cdktf json representation of what I want to deploy. I can't share the underlying source code that generates this output.

{
  "//": {
    "metadata": {
      "backend": "azurerm",
      "stackName": "cluster",
      "version": "0.21.0"
    },
    "outputs": {
    }
  },
  "data": {
    "hcloud_image": {
      "hcloud-image-arm-microos-snapshotyes": {
        "//": {
          "metadata": {
            "path": "cluster/hcloud-image-arm-microos-snapshot=yes",
            "uniqueId": "hcloud-image-arm-microos-snapshotyes"
          }
        },
        "most_recent": true,
        "with_architecture": "arm",
        "with_selector": "microos-snapshot=yes"
      }
    }
  },
  "provider": {
    "hcloud": [
      {
        "token": "<dummy>"
      }
    ]
  },
  "resource": {
    "hcloud_primary_ip": {
      "hcloud-primary-ip-cluster-bastion-001-ipv4": {
        "//": {
          "metadata": {
            "path": "cluster/hcloud-primary-ip-cluster-bastion-001-ipv4",
            "uniqueId": "hcloud-primary-ip-cluster-bastion-001-ipv4"
          }
        },
        "assignee_type": "server",
        "auto_delete": false,
        "datacenter": "nbg1-dc3",
        "labels": {
          "managed-by": "iac"
        },
        "name": "cluster-bastion-001-ipv4",
        "type": "ipv4"
      },
      "hcloud-primary-ip-cluster-bastion-001-ipv6": {
        "//": {
          "metadata": {
            "path": "cluster/hcloud-primary-ip-cluster-bastion-001-ipv6",
            "uniqueId": "hcloud-primary-ip-cluster-bastion-001-ipv6"
          }
        },
        "assignee_type": "server",
        "auto_delete": false,
        "datacenter": "nbg1-dc3",
        "labels": {
          "managed-by": "iac"
        },
        "name": "cluster-bastion-001-ipv6",
        "type": "ipv6"
      },
      "hcloud-primary-ip-cluster-bastion-002-ipv4": {
        "//": {
          "metadata": {
            "path": "cluster/hcloud-primary-ip-cluster-bastion-002-ipv4",
            "uniqueId": "hcloud-primary-ip-cluster-bastion-002-ipv4"
          }
        },
        "assignee_type": "server",
        "auto_delete": false,
        "datacenter": "nbg1-dc3",
        "labels": {
          "managed-by": "iac"
        },
        "name": "cluster-bastion-002-ipv4",
        "type": "ipv4"
      },
      "hcloud-primary-ip-cluster-bastion-002-ipv6": {
        "//": {
          "metadata": {
            "path": "cluster/hcloud-primary-ip-cluster-bastion-002-ipv6",
            "uniqueId": "hcloud-primary-ip-cluster-bastion-002-ipv6"
          }
        },
        "assignee_type": "server",
        "auto_delete": false,
        "datacenter": "nbg1-dc3",
        "labels": {
          "managed-by": "iac"
        },
        "name": "cluster-bastion-002-ipv6",
        "type": "ipv6"
      }
    },
    "hcloud_server": {
      "hcloud-server-cluster-bastion-001": {
        "//": {
          "metadata": {
            "path": "cluster/hcloud-server-cluster-bastion-001",
            "uniqueId": "hcloud-server-cluster-bastion-001"
          }
        },
        "backups": false,
        "datacenter": "nbg1-dc3",
        "delete_protection": true,
        "image": "${data.hcloud_image.hcloud-image-arm-microos-snapshotyes.id}",
        "keep_disk": true,
        "labels": {
          "managed-by": "iac"
        },
        "lifecycle": {
          "ignore_changes": [
            "ssh_keys"
          ]
        },
        "name": "cluster-bastion-001",
        "public_net": [
          {
            "ipv4": "${tonumber(hcloud_primary_ip.hcloud-primary-ip-cluster-bastion-001-ipv4.id)}",
            "ipv4_enabled": true,
            "ipv6": "${tonumber(hcloud_primary_ip.hcloud-primary-ip-cluster-bastion-001-ipv6.id)}",
            "ipv6_enabled": true
          }
        ],
        "rebuild_protection": true,
        "server_type": "cx33",
        "shutdown_before_deletion": true
      },
      "hcloud-server-cluster-bastion-002": {
        "//": {
          "metadata": {
            "path": "cluster/hcloud-server-cluster-bastion-002",
            "uniqueId": "hcloud-server-cluster-bastion-002"
          }
        },
        "backups": false,
        "datacenter": "nbg1-dc3",
        "delete_protection": true,
        "image": "${data.hcloud_image.hcloud-image-arm-microos-snapshotyes.id}",
        "keep_disk": true,
        "labels": {
          "managed-by": "iac"
        },
        "lifecycle": {
          "ignore_changes": [
            "ssh_keys"
          ]
        },
        "name": "cluster-bastion-002",
        "public_net": [
          {
            "ipv4": "${tonumber(hcloud_primary_ip.hcloud-primary-ip-cluster-bastion-002-ipv4.id)}",
            "ipv4_enabled": true,
            "ipv6": "${tonumber(hcloud_primary_ip.hcloud-primary-ip-cluster-bastion-002-ipv6.id)}",
            "ipv6_enabled": true
          }
        ],
        "rebuild_protection": true,
        "server_type": "cx33",
        "shutdown_before_deletion": true
      }
    }
  },
  "terraform": {
    "backend": {
    },
    "required_providers": {
      "hcloud": {
        "source": "hetznercloud/hcloud",
        "version": "1.54.0"
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions