Google Cloud (GCP) Classic

Pulumi Official
Package maintained by Pulumi
v6.24.0 published on Tuesday, May 17, 2022 by Pulumi

getNetwork

Get a network within GCE from its name.

Example Usage

using Pulumi;
using Gcp = Pulumi.Gcp;

class MyStack : Stack
{
    public MyStack()
    {
        var my_network = Output.Create(Gcp.Compute.GetNetwork.InvokeAsync(new Gcp.Compute.GetNetworkArgs
        {
            Name = "default-us-east1",
        }));
    }

}
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := compute.LookupNetwork(ctx, &compute.LookupNetworkArgs{
			Name: "default-us-east1",
		}, nil)
		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) {
        final var my-network = Output.of(ComputeFunctions.getNetwork(GetNetworkArgs.builder()
            .name("default-us-east1")
            .build()));

        }
}
import pulumi
import pulumi_gcp as gcp

my_network = gcp.compute.get_network(name="default-us-east1")
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const my_network = pulumi.output(gcp.compute.getNetwork({
    name: "default-us-east1",
}));
variables:
  my-network:
    Fn::Invoke:
      Function: gcp:compute:getNetwork
      Arguments:
        name: default-us-east1

Using getNetwork

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 getNetwork(args: GetNetworkArgs, opts?: InvokeOptions): Promise<GetNetworkResult>
function getNetworkOutput(args: GetNetworkOutputArgs, opts?: InvokeOptions): Output<GetNetworkResult>
def get_network(name: Optional[str] = None,
                project: Optional[str] = None,
                opts: Optional[InvokeOptions] = None) -> GetNetworkResult
def get_network_output(name: Optional[pulumi.Input[str]] = None,
                project: Optional[pulumi.Input[str]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetNetworkResult]
func LookupNetwork(ctx *Context, args *LookupNetworkArgs, opts ...InvokeOption) (*LookupNetworkResult, error)
func LookupNetworkOutput(ctx *Context, args *LookupNetworkOutputArgs, opts ...InvokeOption) LookupNetworkResultOutput

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

public static class GetNetwork 
{
    public static Task<GetNetworkResult> InvokeAsync(GetNetworkArgs args, InvokeOptions? opts = null)
    public static Output<GetNetworkResult> Invoke(GetNetworkInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetNetworkResult> getNetwork(GetNetworkArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: gcp:compute/getNetwork:getNetwork
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Name string

The name of the network.

Project string

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

Name string

The name of the network.

Project string

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

name String

The name of the network.

project String

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

name string

The name of the network.

project string

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

name str

The name of the network.

project str

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

name String

The name of the network.

project String

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

getNetwork Result

The following output properties are available:

Description string

Description of this network.

GatewayIpv4 string

The IP address of the gateway.

Id string

The provider-assigned unique ID for this managed resource.

Name string
SelfLink string

The URI of the resource.

SubnetworksSelfLinks List<string>

the list of subnetworks which belong to the network

Project string
Description string

Description of this network.

GatewayIpv4 string

The IP address of the gateway.

Id string

The provider-assigned unique ID for this managed resource.

Name string
SelfLink string

The URI of the resource.

SubnetworksSelfLinks []string

the list of subnetworks which belong to the network

Project string
description String

Description of this network.

gatewayIpv4 String

The IP address of the gateway.

id String

The provider-assigned unique ID for this managed resource.

name String
selfLink String

The URI of the resource.

subnetworksSelfLinks List

the list of subnetworks which belong to the network

project String
description string

Description of this network.

gatewayIpv4 string

The IP address of the gateway.

id string

The provider-assigned unique ID for this managed resource.

name string
selfLink string

The URI of the resource.

subnetworksSelfLinks string[]

the list of subnetworks which belong to the network

project string
description str

Description of this network.

gateway_ipv4 str

The IP address of the gateway.

id str

The provider-assigned unique ID for this managed resource.

name str
self_link str

The URI of the resource.

subnetworks_self_links Sequence[str]

the list of subnetworks which belong to the network

project str
description String

Description of this network.

gatewayIpv4 String

The IP address of the gateway.

id String

The provider-assigned unique ID for this managed resource.

name String
selfLink String

The URI of the resource.

subnetworksSelfLinks List

the list of subnetworks which belong to the network

project String

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.