Unable to load image with region asia-south1 and cloud gce for iteration 01FS4W98KYY9D7

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
![channel|526x271](upload://iwv7tiHcH6k4VUIqwSWjWtDBPaf.jpeg)

![packer_registry|690x319](upload://dZobGFRHZivT53udgWmiit0G5av.jpeg)
.
│
│   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.

Looking at the gce zone here Regions and zones  |  Compute Engine Documentation  |  Google Cloud I see that the asia-south1 regions as an extra suffix a|b|c|d. I believe you’re missing one of these.

thanks for the quick reply @sylviamoss , but Google documentation says them as zones and in Packer documentation says with GCE as region.

Got it! What do you see in the HCP Packer UI? The region there will be the one you should use in this case.
The datasource region attribute is generic across the cloud platforms. You might need to add the zone there instead depending on the platform and the metadata that the packer builder pushes to HCP Packer. I’m quite sure that in the case of gce the region zone is what HCP Packer knows.

I have tried it with zone and instead of region for GCP, this worked out and able to create images.

Thanks @sylviamoss