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.32k stars 1.72k forks source link

Add support for PSC in google_dataproc_metastore_service #10568

Closed brokenjacobs closed 1 year ago

brokenjacobs commented 2 years ago

Community Note

Description

google_dataproc_metastore_service now supports private service connect to connect to a VPC without peering. This support just entered pre-GA and is documented here: https://cloud.google.com/dataproc-metastore/docs/psc-ilb

This is a great feature because otherwise dataproc metastore service provides no way to configure IP address ranges, and constantly configures ranges that conflict with on-premise networks. This leads to very bad terraform...

New or Affected Resource(s)

Potential Terraform Configuration

Assuming the appropriate IAM:

# Propose what you think the configuration to take advantage of this feature should look like.
# We may not use it verbatim, but it's helpful in understanding your intent.
resource "google_project_service" "servicenetworking" {
  service = "servicenetworking.googleapis.com"
  disable_on_destroy = false
}

resource "google_compute_network" "network" {
  name                    = "my-network"
  auto_create_subnetworks = false
  depends_on = [google_project_service.servicenetworking]
}

resource "google_compute_subnetwork" "subnet" {
  name          = "metastore-subnet"
  ip_cidr_range = "10.2.0.0/16"
  region        = "us-central1"
  network       = google_compute_network.network.id
}

resource "google_dataproc_metastore_service" "default" {
  provider   = google-beta
  service_id = "metastore-srv"
  location   = "us-central1"
  port       = 9080
  tier       = "DEVELOPER"

  maintenance_window {
    hour_of_day = 2
    day_of_week = "SUNDAY"
  }

  hive_metastore_config {
    version = "2.3.6"
  }
  network_config {
    subnetwork = google_compute_subnetwork.subnet.id
  }
}

References

brokenjacobs commented 2 years ago

Looks like my sample is wrong, this uses a loadbalancers ILB and doesn't require a peering subnetwork. --consumer-subnetworks is the gcloud cli option.

DrFaust92 commented 2 years ago

Ill take a look at this

zli82016 commented 1 year ago

@brokenjacobs , do you have another sample? Thanks.

brokenjacobs commented 1 year ago

I mean I could make something up, but wouldn’t this depend on the api?

zli82016 commented 1 year ago

I talked with API team and I am good, thanks.

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.