get Router
Get a router within GCE from its name and VPC.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const my-router = gcp.compute.getRouter({
name: "myrouter-us-east1",
network: "my-network",
});
Content copied to clipboard
import pulumi
import pulumi_gcp as gcp
my_router = gcp.compute.get_router(name="myrouter-us-east1",
network="my-network")
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var my_router = Gcp.Compute.GetRouter.Invoke(new()
{
Name = "myrouter-us-east1",
Network = "my-network",
});
});
Content copied to clipboard
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.LookupRouter(ctx, &compute.LookupRouterArgs{
Name: "myrouter-us-east1",
Network: "my-network",
}, nil)
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
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.GetRouterArgs;
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-router = ComputeFunctions.getRouter(GetRouterArgs.builder()
.name("myrouter-us-east1")
.network("my-network")
.build());
}
}
Content copied to clipboard
variables:
my-router:
fn::invoke:
Function: gcp:compute:getRouter
Arguments:
name: myrouter-us-east1
network: my-network
Content copied to clipboard
Return
A collection of values returned by getRouter.
Parameters
argument
A collection of arguments for invoking getRouter.
suspend fun getRouter(name: String, network: String, project: String? = null, region: String? = null): GetRouterResult
Return
A collection of values returned by getRouter.
Parameters
name
The name of the router.
network
The VPC network on which this router lives.
project
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
region
The region this router has been created in. If unspecified, this defaults to the region configured in the provider.
See also
Return
A collection of values returned by getRouter.
Parameters
argument
Builder for com.pulumi.gcp.compute.kotlin.inputs.GetRouterPlainArgs.