Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCP webserver-cluster/main.tf contains redundant resource compute_backend_service #6

Open
simonderekhughes opened this issue Oct 27, 2020 · 0 comments

Comments

@simonderekhughes
Copy link

The following main.tf in this repo:

https://github.com/mjuenema/Terraform-Up-and-Running-Code-Samples-Translated/blob/develop/gcloud/code/terraform/02-intro-to-terraform-syntax/webserver-cluster/main.tf

contains this unnecessary code:

resource "google_compute_backend_service" "example" {
  name = "example-backend-service"
  port_name = "http"
  protocol = "HTTP"
  timeout_sec = 10
  enable_cdn = false

  backend {
    group = "${google_compute_instance_group_manager.example.instance_group}"
  }

  health_checks = ["${google_compute_http_health_check.example.self_link}"]
}

It can be removed and the example still works fine. This is because the Network Load Balancer does not need a backend service. In this gcp document:

https://cloud.google.com/load-balancing/docs/backend-service

it says

"Network Load Balancing does not use a backend service."

It would be good if the example referenced this document:

https://cloud.google.com/load-balancing/docs/network/setting-up-network

which describes the setup in this file.

Also note that the code has to be changed to work with 0.12.26 e.g. some self_link dont work, and some things no longer need quoting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant