Google Cloud (GCP) Classic

Pulumi Official
Package maintained by Pulumi
v6.25.0 published on Wednesday, May 25, 2022 by Pulumi

Connection

Manages a private VPC connection with a GCP service provider. For more information see the official documentation and API.

Example Usage

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
    public MyStack()
    {
        var peeringNetwork = new Gcp.Compute.Network("peeringNetwork", new Gcp.Compute.NetworkArgs
        {
        });
        var privateIpAlloc = new Gcp.Compute.GlobalAddress("privateIpAlloc", new Gcp.Compute.GlobalAddressArgs
        {
            Purpose = "VPC_PEERING",
            AddressType = "INTERNAL",
            PrefixLength = 16,
            Network = peeringNetwork.Id,
        });
        var foobar = new Gcp.ServiceNetworking.Connection("foobar", new Gcp.ServiceNetworking.ConnectionArgs
        {
            Network = peeringNetwork.Id,
            Service = "servicenetworking.googleapis.com",
            ReservedPeeringRanges = 
            {
                privateIpAlloc.Name,
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/compute"
	"github.com/pulumi/pulumi-gcp/sdk/v6/go/gcp/servicenetworking"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		peeringNetwork, err := compute.NewNetwork(ctx, "peeringNetwork", nil)
		if err != nil {
			return err
		}
		privateIpAlloc, err := compute.NewGlobalAddress(ctx, "privateIpAlloc", &compute.GlobalAddressArgs{
			Purpose:      pulumi.String("VPC_PEERING"),
			AddressType:  pulumi.String("INTERNAL"),
			PrefixLength: pulumi.Int(16),
			Network:      peeringNetwork.ID(),
		})
		if err != nil {
			return err
		}
		_, err = servicenetworking.NewConnection(ctx, "foobar", &servicenetworking.ConnectionArgs{
			Network: peeringNetwork.ID(),
			Service: pulumi.String("servicenetworking.googleapis.com"),
			ReservedPeeringRanges: pulumi.StringArray{
				privateIpAlloc.Name,
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var peeringNetwork = new Network("peeringNetwork");

        var privateIpAlloc = new GlobalAddress("privateIpAlloc", GlobalAddressArgs.builder()        
            .purpose("VPC_PEERING")
            .addressType("INTERNAL")
            .prefixLength(16)
            .network(peeringNetwork.id())
            .build());

        var foobar = new Connection("foobar", ConnectionArgs.builder()        
            .network(peeringNetwork.id())
            .service("servicenetworking.googleapis.com")
            .reservedPeeringRanges(privateIpAlloc.name())
            .build());

    }
}
import pulumi
import pulumi_gcp as gcp

peering_network = gcp.compute.Network("peeringNetwork")
private_ip_alloc = gcp.compute.GlobalAddress("privateIpAlloc",
    purpose="VPC_PEERING",
    address_type="INTERNAL",
    prefix_length=16,
    network=peering_network.id)
foobar = gcp.servicenetworking.Connection("foobar",
    network=peering_network.id,
    service="servicenetworking.googleapis.com",
    reserved_peering_ranges=[private_ip_alloc.name])
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const peeringNetwork = new gcp.compute.Network("peeringNetwork", {});
const privateIpAlloc = new gcp.compute.GlobalAddress("privateIpAlloc", {
    purpose: "VPC_PEERING",
    addressType: "INTERNAL",
    prefixLength: 16,
    network: peeringNetwork.id,
});
const foobar = new gcp.servicenetworking.Connection("foobar", {
    network: peeringNetwork.id,
    service: "servicenetworking.googleapis.com",
    reservedPeeringRanges: [privateIpAlloc.name],
});
resources:
  peeringNetwork:
    type: gcp:compute:Network
  privateIpAlloc:
    type: gcp:compute:GlobalAddress
    properties:
      purpose: VPC_PEERING
      addressType: INTERNAL
      prefixLength: 16
      network: ${peeringNetwork.id}
  foobar:
    type: gcp:servicenetworking:Connection
    properties:
      network: ${peeringNetwork.id}
      service: servicenetworking.googleapis.com
      reservedPeeringRanges:
        - ${privateIpAlloc.name}

Create a Connection Resource

new Connection(name: string, args: ConnectionArgs, opts?: CustomResourceOptions);
@overload
def Connection(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               network: Optional[str] = None,
               reserved_peering_ranges: Optional[Sequence[str]] = None,
               service: Optional[str] = None)
@overload
def Connection(resource_name: str,
               args: ConnectionArgs,
               opts: Optional[ResourceOptions] = None)
func NewConnection(ctx *Context, name string, args ConnectionArgs, opts ...ResourceOption) (*Connection, error)
public Connection(string name, ConnectionArgs args, CustomResourceOptions? opts = null)
public Connection(String name, ConnectionArgs args)
public Connection(String name, ConnectionArgs args, CustomResourceOptions options)
type: gcp:servicenetworking:Connection
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args ConnectionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args ConnectionArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args ConnectionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args ConnectionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args ConnectionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Connection Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The Connection resource accepts the following input properties:

Network string

Name of VPC network connected with service producers using VPC peering.

ReservedPeeringRanges List<string>

Named IP address range(s) of PEERING type reserved for this service provider. Note that invoking this method with a different range when connection is already established will not reallocate already provisioned service producer subnetworks.

Service string

Provider peering service that is managing peering connectivity for a service provider organization. For Google services that support this functionality it is 'servicenetworking.googleapis.com'.

Network string

Name of VPC network connected with service producers using VPC peering.

ReservedPeeringRanges []string

Named IP address range(s) of PEERING type reserved for this service provider. Note that invoking this method with a different range when connection is already established will not reallocate already provisioned service producer subnetworks.

Service string

Provider peering service that is managing peering connectivity for a service provider organization. For Google services that support this functionality it is 'servicenetworking.googleapis.com'.

network String

Name of VPC network connected with service producers using VPC peering.

reservedPeeringRanges List<String>

Named IP address range(s) of PEERING type reserved for this service provider. Note that invoking this method with a different range when connection is already established will not reallocate already provisioned service producer subnetworks.

service String

Provider peering service that is managing peering connectivity for a service provider organization. For Google services that support this functionality it is 'servicenetworking.googleapis.com'.

network string

Name of VPC network connected with service producers using VPC peering.

reservedPeeringRanges string[]

Named IP address range(s) of PEERING type reserved for this service provider. Note that invoking this method with a different range when connection is already established will not reallocate already provisioned service producer subnetworks.

service string

Provider peering service that is managing peering connectivity for a service provider organization. For Google services that support this functionality it is 'servicenetworking.googleapis.com'.

network str

Name of VPC network connected with service producers using VPC peering.

reserved_peering_ranges Sequence[str]

Named IP address range(s) of PEERING type reserved for this service provider. Note that invoking this method with a different range when connection is already established will not reallocate already provisioned service producer subnetworks.

service str

Provider peering service that is managing peering connectivity for a service provider organization. For Google services that support this functionality it is 'servicenetworking.googleapis.com'.

network String

Name of VPC network connected with service producers using VPC peering.

reservedPeeringRanges List<String>

Named IP address range(s) of PEERING type reserved for this service provider. Note that invoking this method with a different range when connection is already established will not reallocate already provisioned service producer subnetworks.

service String

Provider peering service that is managing peering connectivity for a service provider organization. For Google services that support this functionality it is 'servicenetworking.googleapis.com'.

Outputs

All input properties are implicitly available as output properties. Additionally, the Connection resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

Peering string

(Computed) The name of the VPC Network Peering connection that was created by the service producer.

Id string

The provider-assigned unique ID for this managed resource.

Peering string

(Computed) The name of the VPC Network Peering connection that was created by the service producer.

id String

The provider-assigned unique ID for this managed resource.

peering String

(Computed) The name of the VPC Network Peering connection that was created by the service producer.

id string

The provider-assigned unique ID for this managed resource.

peering string

(Computed) The name of the VPC Network Peering connection that was created by the service producer.

id str

The provider-assigned unique ID for this managed resource.

peering str

(Computed) The name of the VPC Network Peering connection that was created by the service producer.

id String

The provider-assigned unique ID for this managed resource.

peering String

(Computed) The name of the VPC Network Peering connection that was created by the service producer.

Look up an Existing Connection Resource

Get an existing Connection resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ConnectionState, opts?: CustomResourceOptions): Connection
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        network: Optional[str] = None,
        peering: Optional[str] = None,
        reserved_peering_ranges: Optional[Sequence[str]] = None,
        service: Optional[str] = None) -> Connection
func GetConnection(ctx *Context, name string, id IDInput, state *ConnectionState, opts ...ResourceOption) (*Connection, error)
public static Connection Get(string name, Input<string> id, ConnectionState? state, CustomResourceOptions? opts = null)
public static Connection get(String name, Output<String> id, ConnectionState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Network string

Name of VPC network connected with service producers using VPC peering.

Peering string

(Computed) The name of the VPC Network Peering connection that was created by the service producer.

ReservedPeeringRanges List<string>

Named IP address range(s) of PEERING type reserved for this service provider. Note that invoking this method with a different range when connection is already established will not reallocate already provisioned service producer subnetworks.

Service string

Provider peering service that is managing peering connectivity for a service provider organization. For Google services that support this functionality it is 'servicenetworking.googleapis.com'.

Network string

Name of VPC network connected with service producers using VPC peering.

Peering string

(Computed) The name of the VPC Network Peering connection that was created by the service producer.

ReservedPeeringRanges []string

Named IP address range(s) of PEERING type reserved for this service provider. Note that invoking this method with a different range when connection is already established will not reallocate already provisioned service producer subnetworks.

Service string

Provider peering service that is managing peering connectivity for a service provider organization. For Google services that support this functionality it is 'servicenetworking.googleapis.com'.

network String

Name of VPC network connected with service producers using VPC peering.

peering String

(Computed) The name of the VPC Network Peering connection that was created by the service producer.

reservedPeeringRanges List<String>

Named IP address range(s) of PEERING type reserved for this service provider. Note that invoking this method with a different range when connection is already established will not reallocate already provisioned service producer subnetworks.

service String

Provider peering service that is managing peering connectivity for a service provider organization. For Google services that support this functionality it is 'servicenetworking.googleapis.com'.

network string

Name of VPC network connected with service producers using VPC peering.

peering string

(Computed) The name of the VPC Network Peering connection that was created by the service producer.

reservedPeeringRanges string[]

Named IP address range(s) of PEERING type reserved for this service provider. Note that invoking this method with a different range when connection is already established will not reallocate already provisioned service producer subnetworks.

service string

Provider peering service that is managing peering connectivity for a service provider organization. For Google services that support this functionality it is 'servicenetworking.googleapis.com'.

network str

Name of VPC network connected with service producers using VPC peering.

peering str

(Computed) The name of the VPC Network Peering connection that was created by the service producer.

reserved_peering_ranges Sequence[str]

Named IP address range(s) of PEERING type reserved for this service provider. Note that invoking this method with a different range when connection is already established will not reallocate already provisioned service producer subnetworks.

service str

Provider peering service that is managing peering connectivity for a service provider organization. For Google services that support this functionality it is 'servicenetworking.googleapis.com'.

network String

Name of VPC network connected with service producers using VPC peering.

peering String

(Computed) The name of the VPC Network Peering connection that was created by the service producer.

reservedPeeringRanges List<String>

Named IP address range(s) of PEERING type reserved for this service provider. Note that invoking this method with a different range when connection is already established will not reallocate already provisioned service producer subnetworks.

service String

Provider peering service that is managing peering connectivity for a service provider organization. For Google services that support this functionality it is 'servicenetworking.googleapis.com'.

Import

ServiceNetworkingConnection can be imported using any of these accepted formats

 $ pulumi import gcp:servicenetworking/connection:Connection peering_connection {{peering-network}}:{{service}}
 $ pulumi import gcp:servicenetworking/connection:Connection peering_connection /projects/{{project}}/global/networks/{{peering-network}}:{{service}}

Package Details

Repository
https://github.com/pulumi/pulumi-gcp
License
Apache-2.0
Notes

This Pulumi package is based on the google-beta Terraform Provider.