hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.29k stars 1.72k forks source link

Compute instance groups plural datasource #18941

Open roaks3 opened 1 month ago

roaks3 commented 1 month ago

Community Note

Description

Copied from https://github.com/hashicorp/terraform-provider-google/issues/9712

Create a datasource for instance groups to retrieve multiple instance groups with filters, such as AWS ASG

This will allow an easier management of MIGs especially when integrating with Google Load Balancer ( google_compute_backend_service ) while having different MIGs created

New or Affected Resource(s)

Potential Terraform Configuration

data "google_compute_instance_groups" "groups" {
  filter {
    name   = "key"
    values = ["Team"]
  }

  filter {
    name   = "value"
    values = ["Pets"]
  }
}

References

No response

b/356847050

roaks3 commented 1 month ago

This is a case of a plural datasource. See https://github.com/hashicorp/terraform-provider-google/issues/8255 for more info and some light guidelines for implementation.