Google NetworkManagement Connectivity Test

This page shows how to write Terraform for NetworkManagement Connectivity Test and write them securely.

google_network_management_connectivity_test (Terraform)

The Connectivity Test in NetworkManagement can be configured in Terraform with the resource name google_network_management_connectivity_test. The following sections describe 4 examples of how to use the resource and its parameters.

Example Usage from GitHub

main.tf#L146
resource "google_network_management_connectivity_test" "r4-1-4" {
  name = "r4-1-4-ba-CANNOT-ping-aa"
  source {
      instance = "projects/principal-truck-309700/zones/us-east1-b/instances/vm-ba"
  }

main.tf#L111
resource "google_network_management_connectivity_test" "r4-1-3" {
  name = "r4-1-3-aa-can-ping-ba"
  source {
      instance = "projects/org-a-309016/zones/us-east1-b/instances/vm-aa"
  }

main.tf#L1
resource "google_network_management_connectivity_test" "instance-test" {
  name = "conn-test-instances"
  source {
    instance = google_compute_instance.source.id
  }

main.tf#L7
resource "google_network_management_connectivity_test" "this" {
  description      = var.description
  labels           = var.labels
  name             = var.name
  project          = var.project
  protocol         = var.protocol

Review your Terraform file for Google best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

The user-supplied description of the Connectivity Test. Maximum of 512 characters.

  • id optional computed - string
  • labels optional - map from string to string

Resource labels to represent user-provided metadata.

Unique name for the connectivity test.

IP Protocol of the test. When not provided, "TCP" is assumed.

Other projects that may be relevant for reachability analysis. This is applicable to scenarios where a test can cross project boundaries.

  • destination list block

    A Compute Engine instance URI.

    The IP address of the endpoint, which can be an external or internal IP. An IPv6 address is only allowed when the test's destination is a global load balancer VIP.

    A Compute Engine network URI.

    The IP protocol port of the endpoint. Only applicable when protocol is TCP or UDP.

    Project ID where the endpoint is located. The Project ID can be derived from the URI if you provide a VM instance or network URI. The following are two cases where you must provide the project ID: 1. Only the IP address is specified, and the IP address is within a GCP project. 2. When you are using Shared VPC and the IP address that you provide is from the service project. In this case, the network that the IP address resides in is defined in the host project.

  • source list block

    A Compute Engine instance URI.

    The IP address of the endpoint, which can be an external or internal IP. An IPv6 address is only allowed when the test's destination is a global load balancer VIP.

    A Compute Engine network URI.

    Type of the network where the endpoint is located. Possible values: ["GCP_NETWORK", "NON_GCP_NETWORK"]

    The IP protocol port of the endpoint. Only applicable when protocol is TCP or UDP.

    Project ID where the endpoint is located. The Project ID can be derived from the URI if you provide a VM instance or network URI. The following are two cases where you must provide the project ID: 1. Only the IP address is specified, and the IP address is within a GCP project. 2. When you are using Shared VPC and the IP address that you provide is from the service project. In this case, the network that the IP address resides in is defined in the host project.

  • timeouts single block

Explanation in Terraform Registry

A connectivity test are a static analysis of your resource configurations that enables you to evaluate connectivity to and from Google Cloud resources in your Virtual Private Cloud (VPC) network. To get more information about ConnectivityTest, see:

Frequently asked questions

What is Google NetworkManagement Connectivity Test?

Google NetworkManagement Connectivity Test is a resource for NetworkManagement of Google Cloud Platform. Settings can be wrote in Terraform.

Where can I find the example code for the Google NetworkManagement Connectivity Test?

For Terraform, the sohnya/cloud-project, sohnya/cloud-project and tier940/gke-test source code examples are useful. See the Terraform Example section for further details.

security-icon

Automate config file reviews on your commits

Fix issues in your infrastructure as code with auto-generated patches.