Skip to content

googleServiceDirectoryEndpoint

An individual endpoint that provides a service.

\~> Warning: This resource is in beta, and should be used with the terraform-provider-google-beta provider. See Provider Versions for more details on beta resources.

To get more information about Endpoint, see:

Example Usage - Service Directory Endpoint Basic

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleServiceDirectoryNamespaceExample =
  new google.serviceDirectoryNamespace.ServiceDirectoryNamespace(
    this,
    "example",
    {
      location: "us-central1",
      namespace_id: "example-namespace",
      provider: "${google-beta}",
    }
  );
const googleServiceDirectoryServiceExample =
  new google.serviceDirectoryService.ServiceDirectoryService(
    this,
    "example_1",
    {
      namespace: googleServiceDirectoryNamespaceExample.id,
      provider: "${google-beta}",
      service_id: "example-service",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
googleServiceDirectoryServiceExample.overrideLogicalId("example");
const googleServiceDirectoryEndpointExample =
  new google.serviceDirectoryEndpoint.ServiceDirectoryEndpoint(
    this,
    "example_2",
    {
      address: "1.2.3.4",
      endpoint_id: "example-endpoint",
      metadata: [
        {
          region: "us-central1",
          stage: "prod",
        },
      ],
      port: 5353,
      provider: "${google-beta}",
      service: googleServiceDirectoryServiceExample.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
googleServiceDirectoryEndpointExample.overrideLogicalId("example");

Example Usage - Service Directory Endpoint With Network

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleComputeNetworkExample = new google.computeNetwork.ComputeNetwork(
  this,
  "example",
  {
    name: "example-network",
    provider: "${google-beta}",
  }
);
const googleServiceDirectoryNamespaceExample =
  new google.serviceDirectoryNamespace.ServiceDirectoryNamespace(
    this,
    "example_1",
    {
      location: "us-central1",
      namespace_id: "example-namespace",
      provider: "${google-beta}",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
googleServiceDirectoryNamespaceExample.overrideLogicalId("example");
const googleServiceDirectoryServiceExample =
  new google.serviceDirectoryService.ServiceDirectoryService(
    this,
    "example_2",
    {
      namespace: googleServiceDirectoryNamespaceExample.id,
      provider: "${google-beta}",
      service_id: "example-service",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
googleServiceDirectoryServiceExample.overrideLogicalId("example");
const dataGoogleProjectProject = new google.dataGoogleProject.DataGoogleProject(
  this,
  "project",
  {
    provider: "${google-beta}",
  }
);
const googleServiceDirectoryEndpointExample =
  new google.serviceDirectoryEndpoint.ServiceDirectoryEndpoint(
    this,
    "example_4",
    {
      address: "1.2.3.4",
      endpoint_id: "example-endpoint",
      metadata: [
        {
          region: "us-central1",
          stage: "prod",
        },
      ],
      network: `projects/\${${dataGoogleProjectProject.number}}/locations/global/networks/\${${googleComputeNetworkExample.name}}`,
      port: 5353,
      provider: "${google-beta}",
      service: googleServiceDirectoryServiceExample.id,
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
googleServiceDirectoryEndpointExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • service - (Required) The resource name of the service that this endpoint provides.

  • endpointId - (Required) The Resource ID must be 1-63 characters long, including digits, lowercase letters or the hyphen character.


  • address - (Optional) IPv4 or IPv6 address of the endpoint.

  • port - (Optional) Port that the endpoint is running on, must be in the range of [0, 65535]. If unspecified, the default is 0.

  • metadata - (Optional) Metadata for the endpoint. This data can be consumed by service clients. The entire metadata dictionary may contain up to 512 characters, spread across all key-value pairs. Metadata that goes beyond any these limits will be rejected.

  • network - (Optional) The URL to the network, such as projects/PROJECT_NUMBER/locations/global/networks/NETWORK_NAME.

Attributes Reference

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

  • id - an identifier for the resource with format {{name}}

  • name - The resource name for the endpoint in the format projects/*/locations/*/namespaces/*/services/*/endpoints/*.

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 20 minutes.
  • update - Default is 20 minutes.
  • delete - Default is 20 minutes.

Import

Endpoint can be imported using any of these accepted formats:

$ 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}}