google_network_services_endpoint_policy

EndpointPolicy is a resource that helps apply desired configuration on the endpoints that match specific criteria.

To get more information about EndpointPolicy, see:

Open in Cloud Shell

Example Usage - Network Services Endpoint Policy Basic

resource "google_network_services_endpoint_policy" "default" {
  provider               = google-beta
  name                   = "my-endpoint-policy"
  labels                 = {
    foo = "bar"
  }
  description            = "my description"
  type                   = "SIDECAR_PROXY"
  traffic_port_selector {
    ports = ["8081"]
  }
  endpoint_matcher {
    metadata_label_matcher {
      metadata_label_match_criteria = "MATCH_ANY"
      metadata_labels {
        label_name = "foo"
        label_value = "bar"
      }
    }
  }
}
Open in Cloud Shell

Example Usage - Network Services Endpoint Policy Empty Match

resource "google_network_services_endpoint_policy" "default" {
  provider               = google-beta
  name                   = "my-endpoint-policy"
  labels                 = {
    foo = "bar"
  }
  description            = "my description"
  type                   = "SIDECAR_PROXY"
  traffic_port_selector {
    ports = ["8081"]
  }
  endpoint_matcher {
    metadata_label_matcher {
      metadata_label_match_criteria = "MATCH_ANY"
    }
  }
}

Argument Reference

The following arguments are supported:

The endpoint_matcher block supports:

The metadata_label_matcher block supports:

The metadata_labels block supports:


The traffic_port_selector block supports:

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

EndpointPolicy can be imported using any of these accepted formats:

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

import {
  id = "projects/{{project}}/locations/global/endpointPolicies/{{name}}"
  to = google_network_services_endpoint_policy.default
}

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

$ terraform import google_network_services_endpoint_policy.default projects/{{project}}/locations/global/endpointPolicies/{{name}}
$ terraform import google_network_services_endpoint_policy.default {{project}}/{{name}}
$ terraform import google_network_services_endpoint_policy.default {{name}}

User Project Overrides

This resource supports User Project Overrides.