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.25k stars 1.7k forks source link

Compute Instance Groups & Node Pool Datasources #9712

Open brianmori opened 2 years ago

brianmori commented 2 years ago

Community Note

Description

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"]
  }
}

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

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

References

ScottSuarez commented 2 years ago

note: existing feature in AWS parity match request

rileykarson commented 2 years ago

See https://github.com/hashicorp/terraform-provider-google/issues/8255, the general issue for plural datasource support