ConnectivityTest

class ConnectivityTest : KotlinCustomResource

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:

Example Usage

Network Management Connectivity Test Instances

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.Network;
import com.pulumi.gcp.compute.ComputeFunctions;
import com.pulumi.gcp.compute.inputs.GetImageArgs;
import com.pulumi.gcp.compute.Instance;
import com.pulumi.gcp.compute.InstanceArgs;
import com.pulumi.gcp.compute.inputs.InstanceBootDiskArgs;
import com.pulumi.gcp.compute.inputs.InstanceBootDiskInitializeParamsArgs;
import com.pulumi.gcp.compute.inputs.InstanceNetworkInterfaceArgs;
import com.pulumi.gcp.networkmanagement.ConnectivityTest;
import com.pulumi.gcp.networkmanagement.ConnectivityTestArgs;
import com.pulumi.gcp.networkmanagement.inputs.ConnectivityTestSourceArgs;
import com.pulumi.gcp.networkmanagement.inputs.ConnectivityTestDestinationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var vpc = new Network("vpc");
final var debian9 = ComputeFunctions.getImage(GetImageArgs.builder()
.family("debian-11")
.project("debian-cloud")
.build());
var source = new Instance("source", InstanceArgs.builder()
.machineType("e2-medium")
.bootDisk(InstanceBootDiskArgs.builder()
.initializeParams(InstanceBootDiskInitializeParamsArgs.builder()
.image(debian9.applyValue(getImageResult -> getImageResult.id()))
.build())
.build())
.networkInterfaces(InstanceNetworkInterfaceArgs.builder()
.network(vpc.id())
.accessConfigs()
.build())
.build());
var destination = new Instance("destination", InstanceArgs.builder()
.machineType("e2-medium")
.bootDisk(InstanceBootDiskArgs.builder()
.initializeParams(InstanceBootDiskInitializeParamsArgs.builder()
.image(debian9.applyValue(getImageResult -> getImageResult.id()))
.build())
.build())
.networkInterfaces(InstanceNetworkInterfaceArgs.builder()
.network(vpc.id())
.accessConfigs()
.build())
.build());
var instance_test = new ConnectivityTest("instance-test", ConnectivityTestArgs.builder()
.source(ConnectivityTestSourceArgs.builder()
.instance(source.id())
.build())
.destination(ConnectivityTestDestinationArgs.builder()
.instance(destination.id())
.build())
.protocol("TCP")
.build());
}
}

Network Management Connectivity Test Addresses

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.Network;
import com.pulumi.gcp.compute.Subnetwork;
import com.pulumi.gcp.compute.SubnetworkArgs;
import com.pulumi.gcp.compute.Address;
import com.pulumi.gcp.compute.AddressArgs;
import com.pulumi.gcp.networkmanagement.ConnectivityTest;
import com.pulumi.gcp.networkmanagement.ConnectivityTestArgs;
import com.pulumi.gcp.networkmanagement.inputs.ConnectivityTestSourceArgs;
import com.pulumi.gcp.networkmanagement.inputs.ConnectivityTestDestinationArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var vpc = new Network("vpc");
var subnet = new Subnetwork("subnet", SubnetworkArgs.builder()
.ipCidrRange("10.0.0.0/16")
.region("us-central1")
.network(vpc.id())
.build());
var source_addr = new Address("source-addr", AddressArgs.builder()
.subnetwork(subnet.id())
.addressType("INTERNAL")
.address("10.0.42.42")
.region("us-central1")
.build());
var dest_addr = new Address("dest-addr", AddressArgs.builder()
.subnetwork(subnet.id())
.addressType("INTERNAL")
.address("10.0.43.43")
.region("us-central1")
.build());
var address_test = new ConnectivityTest("address-test", ConnectivityTestArgs.builder()
.source(ConnectivityTestSourceArgs.builder()
.ipAddress(source_addr.address())
.projectId(source_addr.project())
.network(vpc.id())
.networkType("GCP_NETWORK")
.build())
.destination(ConnectivityTestDestinationArgs.builder()
.ipAddress(dest_addr.address())
.projectId(dest_addr.project())
.network(vpc.id())
.build())
.protocol("UDP")
.build());
}
}

Import

ConnectivityTest can be imported using any of these accepted formats

$ pulumi import gcp:networkmanagement/connectivityTest:ConnectivityTest default projects/{{project}}/locations/global/connectivityTests/{{name}}
$ pulumi import gcp:networkmanagement/connectivityTest:ConnectivityTest default {{project}}/{{name}}
$ pulumi import gcp:networkmanagement/connectivityTest:ConnectivityTest default {{name}}

Properties

Link copied to clipboard
val description: Output<String>?

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

Link copied to clipboard

Required. Destination specification of the Connectivity Test. You can use a combination of destination IP address, Compute Engine VM instance, or VPC network to uniquely identify the destination location. Even if the destination IP address is not unique, the source IP location is unique. Usually, the analysis can infer the destination endpoint from route information. If the destination you specify is a VM instance and the instance has multiple network interfaces, then you must also specify either a destination IP address or VPC network to identify the destination interface. A reachability analysis proceeds even if the destination location is ambiguous. However, the result can include endpoints that you don't intend to test. Structure is documented below.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val labels: Output<Map<String, String>>?

Resource labels to represent user-provided metadata.

Link copied to clipboard
val name: Output<String>

Unique name for the connectivity test.

Link copied to clipboard
val project: Output<String>

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Link copied to clipboard
val protocol: Output<String>?

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

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val relatedProjects: Output<List<String>>?

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

Link copied to clipboard

Required. Source specification of the Connectivity Test. You can use a combination of source IP address, virtual machine (VM) instance, or Compute Engine network to uniquely identify the source location. Examples: If the source IP address is an internal IP address within a Google Cloud Virtual Private Cloud (VPC) network, then you must also specify the VPC network. Otherwise, specify the VM instance, which already contains its internal IP address and VPC network information. If the source of the test is within an on-premises network, then you must provide the destination VPC network. If the source endpoint is a Compute Engine VM instance with multiple network interfaces, the instance itself is not sufficient to identify the endpoint. So, you must also specify the source IP address or VPC network. A reachability analysis proceeds even if the source location is ambiguous. However, the test result may include endpoints that you don't intend to test. Structure is documented below.

Link copied to clipboard
val urn: Output<String>