Skip to content

Adding private endpoint to AstraDB in GCP #416

Open
@mandar-s95

Description

@mandar-s95

The astra tf module documentation for PL endpoint for GCP, has the following :

# The endpoint ID (PSC Connection ID) is not currently accessible from the google_compute_forwarding_rule terraform object.
# It must be retrieved via the GCP UI (https://console.cloud.google.com/net-services/psc/list) or via the gcloud CLI:
#    gcloud compute forwarding-rules describe psc-endpoint --region=us-east1

However, I think now you can do the above natively via TF:

resource "google_compute_forwarding_rule" "endpoint" {
  name                  = "psc-endpoint-${formatdate("YYYYMMDDhhmmss", timestamp())}"
  target                = "https://www.googleapis.com/compute/v1/${astra_private_link.main.service_name}"
  project               = var.project_id
  ip_address            = google_compute_address.endpoint.id
  network               = google_compute_network.main.id
  region                = local.region
  load_balancing_scheme = ""
  lifecycle {
    ignore_changes = [name]
  }
}
data "google_compute_forwarding_rule" "endpoint_data" {
  name    = google_compute_forwarding_rule.endpoint.name
  project = var.project_id
  region  = local.region
}

resource "astra_private_link_endpoint" "endpoint" {
  database_id   = local.database_id
  datacenter_id = local.datacenter_id
  endpoint_id   = data.google_compute_forwarding_rule.endpoint_data.psc_connection_id 
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions