google_service_directory_endpoint

An individual endpoint that provides a service.

To get more information about Endpoint, see:

Open in Cloud Shell

Example Usage - Service Directory Endpoint Basic

resource "google_service_directory_namespace" "example" {
  provider     = google-beta
  namespace_id = "example-namespace"
  location     = "us-central1"
}

resource "google_service_directory_service" "example" {
  provider   = google-beta
  service_id = "example-service"
  namespace  = google_service_directory_namespace.example.id
}

resource "google_service_directory_endpoint" "example" {
  provider    = google-beta
  endpoint_id = "example-endpoint"
  service     = google_service_directory_service.example.id

  metadata = {
    stage  = "prod"
    region = "us-central1"
  }

  address = "1.2.3.4"
  port    = 5353
}
Open in Cloud Shell

Example Usage - Service Directory Endpoint With Network

data "google_project" "project" {
  provider  = google-beta
}

resource "google_compute_network" "example" {
  provider  = google-beta
  name      = "example-network"
}

resource "google_service_directory_namespace" "example" {
  provider     = google-beta
  namespace_id = "example-namespace"
  location     = "us-central1"
}

resource "google_service_directory_service" "example" {
  provider   = google-beta
  service_id = "example-service"
  namespace  = google_service_directory_namespace.example.id
}

resource "google_service_directory_endpoint" "example" {
  provider    = google-beta
  endpoint_id = "example-endpoint"
  service     = google_service_directory_service.example.id

  metadata = {
    stage  = "prod"
    region = "us-central1"
  }

  network = "projects/${data.google_project.project.number}/locations/global/networks/${google_compute_network.example.name}"
  address = "1.2.3.4"
  port    = 5353
}

Argument Reference

The following arguments are supported:


Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

Timeouts

This resource provides the following Timeouts configuration options:

Import

Endpoint can be imported using any of these accepted formats:

In Terraform v1.5.0 and later, use an import block to import Endpoint using one of the formats above. For example:

import {
  id = "projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}/services/{{service_id}}/endpoints/{{endpoint_id}}"
  to = google_service_directory_endpoint.default
}

When using the terraform import command, Endpoint can be imported using one of the formats above. For example:

$ terraform import google_service_directory_endpoint.default projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}/services/{{service_id}}/endpoints/{{endpoint_id}}
$ terraform import google_service_directory_endpoint.default {{project}}/{{location}}/{{namespace_id}}/{{service_id}}/{{endpoint_id}}
$ terraform import google_service_directory_endpoint.default {{location}}/{{namespace_id}}/{{service_id}}/{{endpoint_id}}