| --- |
| # ---------------------------------------------------------------------------- |
| # |
| # *** AUTO GENERATED CODE *** Type: MMv1 *** |
| # |
| # ---------------------------------------------------------------------------- |
| # |
| # This file is automatically generated by Magic Modules and manual |
| # changes will be clobbered when the file is regenerated. |
| # |
| # Please read more about how to change this file in |
| # .github/CONTRIBUTING.md. |
| # |
| # ---------------------------------------------------------------------------- |
| subcategory: "Service Directory" |
| description: |- |
| An individual endpoint that provides a service. |
| --- |
| |
| # google\_service\_directory\_endpoint |
| |
| 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](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources. |
| |
| To get more information about Endpoint, see: |
| |
| * [API documentation](https://cloud.google.com/service-directory/docs/reference/rest/v1beta1/projects.locations.namespaces.services.endpoints) |
| * How-to Guides |
| * [Configuring an endpoint](https://cloud.google.com/service-directory/docs/configuring-service-directory#configuring_an_endpoint) |
| |
| <div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=service_directory_endpoint_basic&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank"> |
| <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| </a> |
| </div> |
| ## Example Usage - Service Directory Endpoint Basic |
| |
| |
| ```hcl |
| 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 |
| } |
| ``` |
| <div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=service_directory_endpoint_with_network&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank"> |
| <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| </a> |
| </div> |
| ## Example Usage - Service Directory Endpoint With Network |
| |
| |
| ```hcl |
| 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: |
| |
| |
| * `service` - |
| (Required) |
| The resource name of the service that this endpoint provides. |
| |
| * `endpoint_id` - |
| (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](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-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: |
| |
| * `projects/{{project}}/locations/{{location}}/namespaces/{{namespace_id}}/services/{{service_id}}/endpoints/{{endpoint_id}}` |
| * `{{project}}/{{location}}/{{namespace_id}}/{{service_id}}/{{endpoint_id}}` |
| * `{{location}}/{{namespace_id}}/{{service_id}}/{{endpoint_id}}` |
| |
| |
| In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Endpoint using one of the formats above. For example: |
| |
| ```tf |
| 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](https://developer.hashicorp.com/terraform/cli/commands/import), 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}} |
| ``` |