Skip to content

Conversation

Jalle19
Copy link

@Jalle19 Jalle19 commented Nov 8, 2024

Fixes #68

Example usage:

# Use filters to find an image
data "tencentcloud-image" "test-image" {
  filters = {
    image-type = "PUBLIC_IMAGE"
    platform = "Rocky Linux"
    image-name = "Rocky Linux 9.4 64bit"
  }
  most_recent = true
}

# Use image family to find an image
data "tencentcloud-image" "test-image2" {
  image_family = "custom-image-x86"
}

locals {
  id = data.tencentcloud-image.test-image.id
  name = data.tencentcloud-image.test-image.name
}

source "null" "basic-example" {
  communicator = "none"
}

build {
  sources = [
    "source.null.basic-example"
  ]

  provisioner "shell-local" {
    inline = [
      "echo id: ${local.id}",
      "echo name: ${local.name}",
    ]
  }
}

@Jalle19 Jalle19 requested a review from a team as a code owner November 8, 2024 14:03
The value is "<unknown>" when running "packer validate" with a datasource
@ext-samstenvall-sc
Copy link

This needs some additional refactoring to get rid of the currently required (but unused) zone configuration value from the data source

Zone is only needed by the builder, not by the data source
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

Successfully merging this pull request may close these issues.

Find source image by filters
2 participants