I’m able to create an image successfully with Packer Registry but could not spin machine referring to that machine through Terraform code.
provider "hcp" {}
provider "google" {
project = "mt5-loadtesting"
region = "asia-south1"
}
// hcp-packer-iteration data source - retrieves information about an iteration in HCP Packer registry.
data "hcp_packer_iteration" "windows" {
bucket_name = "Images"
channel = "Dev"
}
// hcp-packer-image data source - retrieves information about a specific image created in the HCP Packer registry.
data "hcp_packer_image" "windows-asia-south1" {
bucket_name = "Images"
cloud_provider = "gce"
iteration_id = data.hcp_packer_iteration.windows.ulid
region = "asia-south1"
}
resource "google_compute_instance" "this" {
name = "test-01"
zone = "asia-south1-a"
machine_type = "n1-standard-2"
boot_disk {
initialize_params {
image = "windows-cloud/windows-2019"
size = 50
type = "pd-balanced"
labels = {
"name" = "mt5-disk"
}
}
}
network_interface {
access_config {
//nothing
}
}
}
Error when I run terraform apply
as below.
╷
│ Error: Unable to load image with region asia-south1 and cloud gce for iteration 01FS4W98KYY9D7VSH4SQ9682Z8


.
│
│ with data.hcp_packer_image.windows-asia-south1,
│ on main.tf line 15, in data "hcp_packer_image" "windows-asia-south1":
│ 15: data "hcp_packer_image" "windows-asia-south1" {
│
╵
Please help on the issue.