@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
221 lines (220 loc) • 8.57 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* A set of network endpoints belonging to a network endpoint group (NEG). A
* single network endpoint represents a IP address and port combination that is
* part of a specific network endpoint group (NEG). NEGs are zonal collections
* of these endpoints for GCP resources within a single subnet. **NOTE**:
* Network endpoints cannot be created outside of a network endpoint group.
*
* This resource is authoritative for a single NEG. Any endpoints not specified
* by this resource will be deleted when the resource configuration is applied.
*
* > **NOTE** In case the Endpoint's Instance is recreated, it's needed to
* perform `apply` twice. To avoid situations like this, please use this resource
* with the lifecycle `replaceTriggeredBy` method, with the passed Instance's ID.
*
* To get more information about NetworkEndpoints, see:
*
* * [API documentation](https://cloud.google.com/compute/docs/reference/rest/beta/networkEndpointGroups)
* * How-to Guides
* * [Official Documentation](https://cloud.google.com/load-balancing/docs/negs/)
*
* ## Example Usage
*
* ### Network Endpoints
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const myImage = gcp.compute.getImage({
* family: "debian-11",
* project: "debian-cloud",
* });
* const _default = new gcp.compute.Network("default", {
* name: "neg-network",
* autoCreateSubnetworks: false,
* });
* const defaultSubnetwork = new gcp.compute.Subnetwork("default", {
* name: "neg-subnetwork",
* ipCidrRange: "10.0.0.1/16",
* region: "us-central1",
* network: _default.id,
* });
* const endpoint_instance1 = new gcp.compute.Instance("endpoint-instance1", {
* networkInterfaces: [{
* accessConfigs: [{}],
* subnetwork: defaultSubnetwork.id,
* }],
* name: "endpoint-instance1",
* machineType: "e2-medium",
* bootDisk: {
* initializeParams: {
* image: myImage.then(myImage => myImage.selfLink),
* },
* },
* });
* const endpoint_instance2 = new gcp.compute.Instance("endpoint-instance2", {
* networkInterfaces: [{
* accessConfigs: [{}],
* subnetwork: defaultSubnetwork.id,
* }],
* name: "endpoint-instance2",
* machineType: "e2-medium",
* bootDisk: {
* initializeParams: {
* image: myImage.then(myImage => myImage.selfLink),
* },
* },
* });
* const default_endpoints = new gcp.compute.NetworkEndpointList("default-endpoints", {
* networkEndpointGroup: neg.name,
* networkEndpoints: [
* {
* instance: endpoint_instance1.name,
* port: neg.defaultPort,
* ipAddress: endpoint_instance1.networkInterfaces.apply(networkInterfaces => networkInterfaces[0].networkIp),
* },
* {
* instance: endpoint_instance2.name,
* port: neg.defaultPort,
* ipAddress: endpoint_instance2.networkInterfaces.apply(networkInterfaces => networkInterfaces[0].networkIp),
* },
* ],
* });
* const group = new gcp.compute.NetworkEndpointGroup("group", {
* name: "my-lb-neg",
* network: _default.id,
* subnetwork: defaultSubnetwork.id,
* defaultPort: 90,
* zone: "us-central1-a",
* });
* ```
*
* ## Import
*
* NetworkEndpoints can be imported using any of these accepted formats:
*
* * `projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{network_endpoint_group}}`
*
* * `{{project}}/{{zone}}/{{network_endpoint_group}}`
*
* * `{{zone}}/{{network_endpoint_group}}`
*
* * `{{network_endpoint_group}}`
*
* When using the `pulumi import` command, NetworkEndpoints can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:compute/networkEndpointList:NetworkEndpointList default projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{network_endpoint_group}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/networkEndpointList:NetworkEndpointList default {{project}}/{{zone}}/{{network_endpoint_group}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/networkEndpointList:NetworkEndpointList default {{zone}}/{{network_endpoint_group}}
* ```
*
* ```sh
* $ pulumi import gcp:compute/networkEndpointList:NetworkEndpointList default {{network_endpoint_group}}
* ```
*/
export declare class NetworkEndpointList extends pulumi.CustomResource {
/**
* Get an existing NetworkEndpointList resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: NetworkEndpointListState, opts?: pulumi.CustomResourceOptions): NetworkEndpointList;
/**
* Returns true if the given object is an instance of NetworkEndpointList. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is NetworkEndpointList;
/**
* The network endpoint group these endpoints are part of.
*/
readonly networkEndpointGroup: pulumi.Output<string>;
/**
* The network endpoints to be added to the enclosing network endpoint group
* (NEG). Each endpoint specifies an IP address and port, along with
* additional information depending on the NEG type.
* Structure is documented below.
*/
readonly networkEndpoints: pulumi.Output<outputs.compute.NetworkEndpointListNetworkEndpoint[] | undefined>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
readonly project: pulumi.Output<string>;
/**
* Zone where the containing network endpoint group is located.
*/
readonly zone: pulumi.Output<string>;
/**
* Create a NetworkEndpointList resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: NetworkEndpointListArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering NetworkEndpointList resources.
*/
export interface NetworkEndpointListState {
/**
* The network endpoint group these endpoints are part of.
*/
networkEndpointGroup?: pulumi.Input<string>;
/**
* The network endpoints to be added to the enclosing network endpoint group
* (NEG). Each endpoint specifies an IP address and port, along with
* additional information depending on the NEG type.
* Structure is documented below.
*/
networkEndpoints?: pulumi.Input<pulumi.Input<inputs.compute.NetworkEndpointListNetworkEndpoint>[]>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string>;
/**
* Zone where the containing network endpoint group is located.
*/
zone?: pulumi.Input<string>;
}
/**
* The set of arguments for constructing a NetworkEndpointList resource.
*/
export interface NetworkEndpointListArgs {
/**
* The network endpoint group these endpoints are part of.
*/
networkEndpointGroup: pulumi.Input<string>;
/**
* The network endpoints to be added to the enclosing network endpoint group
* (NEG). Each endpoint specifies an IP address and port, along with
* additional information depending on the NEG type.
* Structure is documented below.
*/
networkEndpoints?: pulumi.Input<pulumi.Input<inputs.compute.NetworkEndpointListNetworkEndpoint>[]>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string>;
/**
* Zone where the containing network endpoint group is located.
*/
zone?: pulumi.Input<string>;
}