Launch GCP GSLB using Terraform

Hi,

terraform --version
Terraform v1.2.7
on darwin_arm64
+ provider registry.terraform.io/hashicorp/google v4.25.0
+ provider registry.terraform.io/hashicorp/random v3.3.1

I am finding it difficult to launch a GCP GSLB using Terraform. Currently I am using the tf file which i have attached in this topic.

gslb.txt (2.2 KB)

 terraform validate
╷
│ Error: Reference to undeclared resource
│
│   on gslb.tf line 34, in resource "google_compute_instance_group" "web_private_group":
│   34:     google_compute_instance.web_private_1.self_link,
│
│ A managed resource "google_compute_instance" "web_private_1" has not been
│ declared in the root module.
╵
╷
│ Error: Reference to undeclared resource
│
│   on gslb.tf line 35, in resource "google_compute_instance_group" "web_private_group":
│   35:     google_compute_instance.web_private_2.self_link
│
│ A managed resource "google_compute_instance" "web_private_2" has not been
│ declared in the root module.

Anything I am missing? Please guide with examples. Thanks in advance.

Best Regards,

Kaushal