1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. getNetworkPeering
Google Cloud Classic v7.27.0 published on Thursday, Jun 13, 2024 by Pulumi

gcp.compute.getNetworkPeering

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.27.0 published on Thursday, Jun 13, 2024 by Pulumi

    Get information of a specified compute network peering. For more information see the official documentation and API.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const _default = new gcp.compute.Network("default", {
        name: "foobar",
        autoCreateSubnetworks: false,
    });
    const other = new gcp.compute.Network("other", {
        name: "other",
        autoCreateSubnetworks: false,
    });
    const peering1 = new gcp.compute.NetworkPeering("peering1", {
        name: "peering1",
        network: _default.selfLink,
        peerNetwork: other.selfLink,
    });
    const peering2 = new gcp.compute.NetworkPeering("peering2", {
        name: "peering2",
        network: other.selfLink,
        peerNetwork: _default.selfLink,
    });
    const peering1Ds = gcp.compute.getNetworkPeeringOutput({
        name: peering1.name,
        network: peering1.network,
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    default = gcp.compute.Network("default",
        name="foobar",
        auto_create_subnetworks=False)
    other = gcp.compute.Network("other",
        name="other",
        auto_create_subnetworks=False)
    peering1 = gcp.compute.NetworkPeering("peering1",
        name="peering1",
        network=default.self_link,
        peer_network=other.self_link)
    peering2 = gcp.compute.NetworkPeering("peering2",
        name="peering2",
        network=other.self_link,
        peer_network=default.self_link)
    peering1_ds = gcp.compute.get_network_peering_output(name=peering1.name,
        network=peering1.network)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
    			Name:                  pulumi.String("foobar"),
    			AutoCreateSubnetworks: pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		other, err := compute.NewNetwork(ctx, "other", &compute.NetworkArgs{
    			Name:                  pulumi.String("other"),
    			AutoCreateSubnetworks: pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		peering1, err := compute.NewNetworkPeering(ctx, "peering1", &compute.NetworkPeeringArgs{
    			Name:        pulumi.String("peering1"),
    			Network:     _default.SelfLink,
    			PeerNetwork: other.SelfLink,
    		})
    		if err != nil {
    			return err
    		}
    		_, err = compute.NewNetworkPeering(ctx, "peering2", &compute.NetworkPeeringArgs{
    			Name:        pulumi.String("peering2"),
    			Network:     other.SelfLink,
    			PeerNetwork: _default.SelfLink,
    		})
    		if err != nil {
    			return err
    		}
    		_ = compute.LookupNetworkPeeringOutput(ctx, compute.GetNetworkPeeringOutputArgs{
    			Name:    peering1.Name,
    			Network: peering1.Network,
    		}, nil)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = new Gcp.Compute.Network("default", new()
        {
            Name = "foobar",
            AutoCreateSubnetworks = false,
        });
    
        var other = new Gcp.Compute.Network("other", new()
        {
            Name = "other",
            AutoCreateSubnetworks = false,
        });
    
        var peering1 = new Gcp.Compute.NetworkPeering("peering1", new()
        {
            Name = "peering1",
            Network = @default.SelfLink,
            PeerNetwork = other.SelfLink,
        });
    
        var peering2 = new Gcp.Compute.NetworkPeering("peering2", new()
        {
            Name = "peering2",
            Network = other.SelfLink,
            PeerNetwork = @default.SelfLink,
        });
    
        var peering1Ds = Gcp.Compute.GetNetworkPeering.Invoke(new()
        {
            Name = peering1.Name,
            Network = peering1.Network,
        });
    
    });
    
    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.NetworkArgs;
    import com.pulumi.gcp.compute.NetworkPeering;
    import com.pulumi.gcp.compute.NetworkPeeringArgs;
    import com.pulumi.gcp.compute.ComputeFunctions;
    import com.pulumi.gcp.compute.inputs.GetNetworkPeeringArgs;
    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 default_ = new Network("default", NetworkArgs.builder()
                .name("foobar")
                .autoCreateSubnetworks("false")
                .build());
    
            var other = new Network("other", NetworkArgs.builder()
                .name("other")
                .autoCreateSubnetworks("false")
                .build());
    
            var peering1 = new NetworkPeering("peering1", NetworkPeeringArgs.builder()
                .name("peering1")
                .network(default_.selfLink())
                .peerNetwork(other.selfLink())
                .build());
    
            var peering2 = new NetworkPeering("peering2", NetworkPeeringArgs.builder()
                .name("peering2")
                .network(other.selfLink())
                .peerNetwork(default_.selfLink())
                .build());
    
            final var peering1Ds = ComputeFunctions.getNetworkPeering(GetNetworkPeeringArgs.builder()
                .name(peering1.name())
                .network(peering1.network())
                .build());
    
        }
    }
    
    resources:
      peering1:
        type: gcp:compute:NetworkPeering
        properties:
          name: peering1
          network: ${default.selfLink}
          peerNetwork: ${other.selfLink}
      peering2:
        type: gcp:compute:NetworkPeering
        properties:
          name: peering2
          network: ${other.selfLink}
          peerNetwork: ${default.selfLink}
      default:
        type: gcp:compute:Network
        properties:
          name: foobar
          autoCreateSubnetworks: 'false'
      other:
        type: gcp:compute:Network
        properties:
          name: other
          autoCreateSubnetworks: 'false'
    variables:
      peering1Ds:
        fn::invoke:
          Function: gcp:compute:getNetworkPeering
          Arguments:
            name: ${peering1.name}
            network: ${peering1.network}
    

    Using getNetworkPeering

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getNetworkPeering(args: GetNetworkPeeringArgs, opts?: InvokeOptions): Promise<GetNetworkPeeringResult>
    function getNetworkPeeringOutput(args: GetNetworkPeeringOutputArgs, opts?: InvokeOptions): Output<GetNetworkPeeringResult>
    def get_network_peering(name: Optional[str] = None,
                            network: Optional[str] = None,
                            opts: Optional[InvokeOptions] = None) -> GetNetworkPeeringResult
    def get_network_peering_output(name: Optional[pulumi.Input[str]] = None,
                            network: Optional[pulumi.Input[str]] = None,
                            opts: Optional[InvokeOptions] = None) -> Output[GetNetworkPeeringResult]
    func LookupNetworkPeering(ctx *Context, args *LookupNetworkPeeringArgs, opts ...InvokeOption) (*LookupNetworkPeeringResult, error)
    func LookupNetworkPeeringOutput(ctx *Context, args *LookupNetworkPeeringOutputArgs, opts ...InvokeOption) LookupNetworkPeeringResultOutput

    > Note: This function is named LookupNetworkPeering in the Go SDK.

    public static class GetNetworkPeering 
    {
        public static Task<GetNetworkPeeringResult> InvokeAsync(GetNetworkPeeringArgs args, InvokeOptions? opts = null)
        public static Output<GetNetworkPeeringResult> Invoke(GetNetworkPeeringInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetNetworkPeeringResult> getNetworkPeering(GetNetworkPeeringArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: gcp:compute/getNetworkPeering:getNetworkPeering
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Name string
    Name of the peering.
    Network string
    The primary network of the peering.
    Name string
    Name of the peering.
    Network string
    The primary network of the peering.
    name String
    Name of the peering.
    network String
    The primary network of the peering.
    name string
    Name of the peering.
    network string
    The primary network of the peering.
    name str
    Name of the peering.
    network str
    The primary network of the peering.
    name String
    Name of the peering.
    network String
    The primary network of the peering.

    getNetworkPeering Result

    The following output properties are available:

    ExportCustomRoutes bool
    ExportSubnetRoutesWithPublicIp bool
    Id string
    The provider-assigned unique ID for this managed resource.
    ImportCustomRoutes bool
    ImportSubnetRoutesWithPublicIp bool
    Name string
    Network string
    PeerNetwork string
    StackType string
    State string
    StateDetails string
    ExportCustomRoutes bool
    ExportSubnetRoutesWithPublicIp bool
    Id string
    The provider-assigned unique ID for this managed resource.
    ImportCustomRoutes bool
    ImportSubnetRoutesWithPublicIp bool
    Name string
    Network string
    PeerNetwork string
    StackType string
    State string
    StateDetails string
    exportCustomRoutes Boolean
    exportSubnetRoutesWithPublicIp Boolean
    id String
    The provider-assigned unique ID for this managed resource.
    importCustomRoutes Boolean
    importSubnetRoutesWithPublicIp Boolean
    name String
    network String
    peerNetwork String
    stackType String
    state String
    stateDetails String
    exportCustomRoutes boolean
    exportSubnetRoutesWithPublicIp boolean
    id string
    The provider-assigned unique ID for this managed resource.
    importCustomRoutes boolean
    importSubnetRoutesWithPublicIp boolean
    name string
    network string
    peerNetwork string
    stackType string
    state string
    stateDetails string
    exportCustomRoutes Boolean
    exportSubnetRoutesWithPublicIp Boolean
    id String
    The provider-assigned unique ID for this managed resource.
    importCustomRoutes Boolean
    importSubnetRoutesWithPublicIp Boolean
    name String
    network String
    peerNetwork String
    stackType String
    state String
    stateDetails String

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v7.27.0 published on Thursday, Jun 13, 2024 by Pulumi