hetznercloud / terraform-provider-hcloud

Terraform Hetzner Cloud provider
https://registry.terraform.io/providers/hetznercloud/hcloud/latest
Mozilla Public License 2.0
495 stars 72 forks source link

Make snapshot images selectable by description field #89

Closed maikschneider closed 5 years ago

maikschneider commented 5 years ago

It should be possible to select created snapshots not only by ID, but by DESCRIPTION (there is no name given for snapshots created with packer.io). Maybe this could be done improving the existing "with_selector", e.g.:

data "hcloud_image" "custom_image" {
  with_selector = "description=my-snapshotname"
  most_recent = true
}
LKaemmerling commented 5 years ago

Hey,

the with_selector can only be used with the labels. You can create a snapshot with a label and then use the with_selector property on the hcloud_image datasource.

Sample: If the image has a label key=value, you can use the label selector like this:

data "hcloud_image" "custom_image" {
  with_selector = "key=value"
  most_recent = true
}

Using the description for this doesn't make so much sense, because the description is only a human-readable "name" for the snapshot.