Error invalid instance URLs

Error invalid instance URLs: resource “google_compute_instance_group” “t-compute-instance-group”

Goal : Create a compute instance and add it to an unmanaged instance group in GCP using terraform.

Issue : A compute instance and an unmanaged instance group are being created successfully, but the instance is not being added to the group and giving: Error invalid instance URLs: resource “google_compute_instance_group” "t-compute-instance-group"

Able to add the instance to the group manually after running the terraform configuration though.

Service account key has Project Editor permission assigned.


Same question on stack overflow: