1

Here is a tf script I am running for my template that I pruned down in order to help debug:

# Credentials
provider "google" {
  credentials = "${var.credentials}"
  project = "${var.project}"
  region  = "${var.region}"
}

# Regional MIG
resource "google_compute_instance_group_manager" "rmig" {
  name               = "${var.rmig_name}"
  instance_template  = "${google_compute_instance_template.cit.self_link}"
  base_instance_name = "${var.base_instance_name}"
  #region             = "${var.region}"
  zone               = "${var.zone}"
  target_size        = 7
}

# Template creation
resource "google_compute_instance_template" "cit" {
  name_prefix = "${var.prefix}"
  description = "${var.desc}"
  project = "${var.project}"
  region  = "${var.region}"
  tags = "${var.tags}"
  instance_description = "${var.desc_inst}"
  machine_type = "${var.machine_type}"
  can_ip_forward = false // Whether to allow sending and receiving of packets with non-matching source or destination IPs. This defaults to false.

  // Create a new boot disk from an image (Lets use one created by Packer)
  disk {
    source_image = "${var.source_image}"
    auto_delete  = true
    boot = true
  }

  network_interface {
    network = "${var.network}"
    # Give a Public IP to instance(s)
    access_config {
      // Ephemeral IP
    }
  }

I specify 7 virtual machines to be created from my template. In GCP it actually does create 7 virtual machines which is correct, but 4 of them are switched-off, then a few minutes later it deletes the switched-off vms and so I am only left with 3 switched-on vms.

If I try to start a switched-off vm via the GCP UI I get the error:

"Starting VM instance 'apache-d2dv' failed. Error: Google Compute Engine is not ready for use yet in the project. It may take several minutes if Google Compute Engine has just been enabled, or if this is the first time you have used Google Compute Engine in the project."

Is this a problem with GCP (in which case I must switch providers), or with my tf code?

[picture attached]

enter image description here

1

I have looked into other cases with the same error message (“Error: Google Compute Engine is not ready …”) and they point to an issue with billing in your GCP project. You may want to look at that first. (Have you recently upgraded from a free account?)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.