getNetwork

Get a network within GCE from its name.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const my_network = gcp.compute.getNetwork({
name: "default-us-east1",
});
import pulumi
import pulumi_gcp as gcp
my_network = gcp.compute.get_network(name="default-us-east1")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var my_network = Gcp.Compute.GetNetwork.Invoke(new()
{
Name = "default-us-east1",
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/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 com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.ComputeFunctions;
import com.pulumi.gcp.compute.inputs.GetNetworkArgs;
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) {
final var my-network = ComputeFunctions.getNetwork(GetNetworkArgs.builder()
.name("default-us-east1")
.build());
}
}
variables:
my-network:
fn::invoke:
function: gcp:compute:getNetwork
arguments:
name: default-us-east1

Return

A collection of values returned by getNetwork.

Parameters

argument

A collection of arguments for invoking getNetwork.


suspend fun getNetwork(name: String, networkProfile: String? = null, project: String? = null): GetNetworkResult

Return

A collection of values returned by getNetwork.

Parameters

name

The name of the network.

networkProfile

A full or partial URL of the network profile to apply to this network.

project

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

See also


suspend fun getNetwork(argument: suspend GetNetworkPlainArgsBuilder.() -> Unit): GetNetworkResult

Return

A collection of values returned by getNetwork.

Parameters

argument

Builder for com.pulumi.gcp.compute.kotlin.inputs.GetNetworkPlainArgs.

See also