1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. getRouters
Google Cloud v9.10.0 published on Friday, Jan 16, 2026 by Pulumi
gcp logo
Google Cloud v9.10.0 published on Friday, Jan 16, 2026 by Pulumi

    Get a list of routers. For more information see the official API documentation.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const all = gcp.compute.getRouters({
        project: foobar.project,
        region: foobar.region,
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    all = gcp.compute.get_routers(project=foobar["project"],
        region=foobar["region"])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := compute.GetRouters(ctx, &compute.GetRoutersArgs{
    			Project: pulumi.StringRef(foobar.Project),
    			Region:  pulumi.StringRef(foobar.Region),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var all = Gcp.Compute.GetRouters.Invoke(new()
        {
            Project = foobar.Project,
            Region = foobar.Region,
        });
    
    });
    
    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.GetRoutersArgs;
    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 all = ComputeFunctions.getRouters(GetRoutersArgs.builder()
                .project(foobar.project())
                .region(foobar.region())
                .build());
    
        }
    }
    
    variables:
      all:
        fn::invoke:
          function: gcp:compute:getRouters
          arguments:
            project: ${foobar.project}
            region: ${foobar.region}
    

    Using getRouters

    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 getRouters(args: GetRoutersArgs, opts?: InvokeOptions): Promise<GetRoutersResult>
    function getRoutersOutput(args: GetRoutersOutputArgs, opts?: InvokeOptions): Output<GetRoutersResult>
    def get_routers(project: Optional[str] = None,
                    region: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetRoutersResult
    def get_routers_output(project: Optional[pulumi.Input[str]] = None,
                    region: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetRoutersResult]
    func GetRouters(ctx *Context, args *GetRoutersArgs, opts ...InvokeOption) (*GetRoutersResult, error)
    func GetRoutersOutput(ctx *Context, args *GetRoutersOutputArgs, opts ...InvokeOption) GetRoutersResultOutput

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

    public static class GetRouters 
    {
        public static Task<GetRoutersResult> InvokeAsync(GetRoutersArgs args, InvokeOptions? opts = null)
        public static Output<GetRoutersResult> Invoke(GetRoutersInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetRoutersResult> getRouters(GetRoutersArgs args, InvokeOptions options)
    public static Output<GetRoutersResult> getRouters(GetRoutersArgs args, InvokeOptions options)
    
    fn::invoke:
      function: gcp:compute/getRouters:getRouters
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Project string
    The project in which the resource belongs. If it is not provided, the provider project is used.
    Region string
    If provided, only resources from the given regions are queried.
    Project string
    The project in which the resource belongs. If it is not provided, the provider project is used.
    Region string
    If provided, only resources from the given regions are queried.
    project String
    The project in which the resource belongs. If it is not provided, the provider project is used.
    region String
    If provided, only resources from the given regions are queried.
    project string
    The project in which the resource belongs. If it is not provided, the provider project is used.
    region string
    If provided, only resources from the given regions are queried.
    project str
    The project in which the resource belongs. If it is not provided, the provider project is used.
    region str
    If provided, only resources from the given regions are queried.
    project String
    The project in which the resource belongs. If it is not provided, the provider project is used.
    region String
    If provided, only resources from the given regions are queried.

    getRouters Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Project string
    Region string
    Routers List<GetRoutersRouter>
    Id string
    The provider-assigned unique ID for this managed resource.
    Project string
    Region string
    Routers []GetRoutersRouter
    id String
    The provider-assigned unique ID for this managed resource.
    project String
    region String
    routers List<GetRoutersRouter>
    id string
    The provider-assigned unique ID for this managed resource.
    project string
    region string
    routers GetRoutersRouter[]
    id str
    The provider-assigned unique ID for this managed resource.
    project str
    region str
    routers Sequence[GetRoutersRouter]
    id String
    The provider-assigned unique ID for this managed resource.
    project String
    region String
    routers List<Property Map>

    Supporting Types

    GetRoutersRouter

    GetRoutersRouterBgp

    GetRoutersRouterBgpAdvertisedIpRange

    Description string
    Range string
    Description string
    Range string
    description String
    range String
    description string
    range string
    description String
    range String

    GetRoutersRouterBgpPeer

    GetRoutersRouterInterface

    GetRoutersRouterMd5AuthenticationKey

    Key string
    Name string
    Key string
    Name string
    key String
    name String
    key string
    name string
    key str
    name str
    key String
    name String

    GetRoutersRouterNat

    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 v9.10.0 published on Friday, Jan 16, 2026 by Pulumi
      Meet Neo: Your AI Platform Teammate