terraform-provider-google icon indicating copy to clipboard operation
terraform-provider-google copied to clipboard

compute_instance: Could not find image or family debian-cloud/debian-9

Open msampathkumar opened this issue 2 years ago • 1 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

Affected Resource(s)

  • google_compute_instance

Terraform Configuration Files

Terraform Code Sample - https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance

resource "google_compute_instance" "host_vm" {
  project      = var.myprojects["hp"]
  name         = "test"
  machine_type = "e2-medium"
  zone         = "us-central1-a"

  tags = ["foo", "bar"]

  boot_disk {
    initialize_params {
      image = "debian-cloud/debian-9"
    }
  }

  network_interface {
    network = "default"
  }

}

Debug Output

Panic Output

Expected Behaviour, Actual Behaviour, Steps to Reproduce

Provided code sample in Terraform docs did not run as expected. Two issues

Error: Error resolving image name 'debian-cloud/debian-9': Could not find image or family debian-cloud/debian-9

  1. Test Case1: When I created a VM as shown the TF sample, using debian-9 then Terraform immediate throw error stating that image is not available.

  2. Test Case2: After I created a VM with debian-11, I update the image to be debian-9 and applied Terraform apply.

Issue I noticed there is that Google Terraform API's takes lot of time (~2 mins)

google_compute_instance.host_sp01: Destroying... [id=projects/my-service-project-01-358212/zones/us-central1-a/instances/test]
google_compute_instance.host_sp01: Still destroying... [id=projects/my-service-project-01-358212/zones/us-central1-a/instances/test, 10s elapsed]
google_compute_instance.host_sp01: Still destroying... [id=projects/my-service-project-01-358212/zones/us-central1-a/instances/test, 20s elapsed]
google_compute_instance.host_sp01: Still destroying... [id=projects/my-service-project-01-358212/zones/us-central1-a/instances/test, 30s elapsed]


google_compute_instance.host_sp01: Still destroying... [id=projects/my-service-project-01-358212/zones/us-central1-a/instances/test, 40s elapsed]
google_compute_instance.host_sp01: Still destroying... [id=projects/my-service-project-01-358212/zones/us-central1-a/instances/test, 50s elapsed]
google_compute_instance.host_sp01: Still destroying... [id=projects/my-service-project-01-358212/zones/us-central1-a/instances/test, 1m0s elapsed]
google_compute_instance.host_sp01: Still destroying... [id=projects/my-service-project-01-358212/zones/us-central1-a/instances/test, 1m10s elapsed]
google_compute_instance.host_sp01: Still destroying... [id=projects/my-service-project-01-358212/zones/us-central1-a/instances/test, 1m20s elapsed]
google_compute_instance.host_sp01: Still destroying... [id=projects/my-service-project-01-358212/zones/us-central1-a/instances/test, 1m30s elapsed]
google_compute_instance.host_sp01: Still destroying... [id=projects/my-service-project-01-358212/zones/us-central1-a/instances/test, 1m40s elapsed]
google_compute_instance.host_sp01: Still destroying... [id=projects/my-service-project-01-358212/zones/us-central1-a/instances/test, 1m50s elapsed]
google_compute_instance.host_sp01: Destruction complete after 1m53s
google_compute_instance.host_sp01: Creating...
╷
│ Error: Error resolving image name 'debian-cloud/debian-9': Could not find image or family debian-cloud/debian-9
│
│   with google_compute_instance.host_sp01,
│   on test_vm.tf line 21, in resource "google_compute_instance" "host_sp01":
│   21: resource "google_compute_instance" "host_sp01" {
│

Kindly please update the code sample image & check if this delay in checking image is acceptable. Many thanks.

msampathkumar avatar Aug 02 '22 14:08 msampathkumar

@msampathkumar you may run below command to see if the image is available. The error indicates the image might not available. It is not something the terraform can control. Does this make sense?

gcloud compute images list | grep debian

Below is the result from the command. It shows debian-9 is no longer available

debian-10-buster-v20220719                            debian-cloud         debian-10                                      READY
debian-11-bullseye-arm64-v20220719                    debian-cloud         debian-11-arm64                                READY
debian-11-bullseye-v20220719                          debian-cloud         debian-11                                      READY

edwardmedia avatar Aug 02 '22 14:08 edwardmedia

@msampathkumar I am closing this now. I believe the issue is the image is just no longer available.

edwardmedia avatar Aug 11 '22 17:08 edwardmedia

The default example repo hasn't been updated to reflect debian 10 or 11, so though they're available, there isn't any instruction for making this update in this article here https://cloud.google.com/architecture/managing-infrastructure-as-code

naterkane avatar Sep 02 '22 19:09 naterkane

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

github-actions[bot] avatar Oct 04 '22 02:10 github-actions[bot]