GoogleCloudPlatform / terraform-google-managed-instance-group

Modular Google Compute Engine managed instance group for Terraform.
Apache License 2.0
63 stars 139 forks source link

terraform apply error #15

Open darkslategrey opened 6 years ago

darkslategrey commented 6 years ago

Hi,

after doing a terraform init

version           = "1.1.7"
Error: Error applying plan:

1 error(s) occurred:

* module.gce-lb-http.google_compute_backend_service.default: 1 error(s) occurred:

* google_compute_backend_service.default: Error creating backend service: googleapi: Error 400: Invalid value for field 'resource.backends[0].group': ''. Only Instance Group URLs are allowed., invalid

Terraform does not automatically rollback in the face of errors.
Instead, your Terraform state file has been partially updated with
any resources that successfully completed. Please address the error
above and apply again to incrementally change your infrastructure.

Here my main.tf :

/*
 * Copyright 2017 Google Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

variable region {
  default = "europe-west1"
}

provider google {
  region = "${var.region}"
}

module "gce-lb-http" {
  source      = "github.com/GoogleCloudPlatform/terraform-google-lb-http"
  version     = "1.0.5"
  name        = "http-lb"
  target_tags = ["${module.mig1.target_tags}", "${module.mig2.target_tags}"]

  backends = {
    "0" = [
      {
        group = "${module.mig1.instance_group}"
        # group = "https://www.googleapis.com/compute/v1/projects/courseur-staging/zones/us-central1-b/instanceGroups/gke-examplecluster-hdja738s-group"
      },
      {
        group = "${module.mig2.instance_group}"
      },
    ]
  }

  backend_params = [
    // health check path, port name, port number, timeout seconds.
    "/,http,80,10",
  ]
}

my instance manager conf :

variable group1_size {
  default = "2"
}

variable group2_size {
  default = "2"
}

variable subnetwork {
  default = "pub"
}

variable network {
  default = "nomad"
}

variable update_strategy {
  # default = "ROLLING_UPDATE"
  default = "NONE"
}

data "template_file" "group-startup-script" {
  template = "${file("${format("%s/gceme.sh.tpl", path.module)}")}"

  vars {
    PROXY_PATH = ""
  }
}

module "mig1" {
  source            = "github.com/GoogleCloudPlatform/terraform-google-managed-instance-group"
  version           = "1.1.7"
  region            = "europe-west1"
  zonal             = false
  zone              = "us-west1-b"
  network           = "${var.network}"
  subnetwork        = "${var.subnetwork}"
  name              = "traefik-group-1"
  size              = "${var.group1_size}"
  target_tags       = ["allow-traefik-group-1"]
  service_port      = 80
  service_port_name = "http"
  update_strategy   = "${var.update_strategy}"
  startup_script    = "${data.template_file.group-startup-script.rendered}"
}

module "mig2" {
  source            = "github.com/GoogleCloudPlatform/terraform-google-managed-instance-group"
  version           = "1.1.7"
  region            = "europe-west1"
  zonal             = false
  zone              = "us-east1-b"
  network           = "${var.network}"
  subnetwork        = "${var.subnetwork}"
  name              = "traefik-group-2"
  size              = "${var.group2_size}"
  target_tags       = ["allow-traefik-group-2"]
  service_port      = 80
  service_port_name = "http"
  update_strategy   = "${var.update_strategy}"
  startup_script    = "${data.template_file.group-startup-script.rendered}"
}
danisla commented 6 years ago

@darkslategrey are you still having issues with the latest version?