1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. getRouterNat
Google Cloud v8.23.0 published on Monday, Mar 24, 2025 by Pulumi

gcp.compute.getRouterNat

Explore with Pulumi AI

Google Cloud v8.23.0 published on Monday, Mar 24, 2025 by Pulumi

To get more information about Snapshot, see:

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const foo = gcp.compute.getRouterNat({
    name: "my-nat",
    router: "my-router",
});
Copy
import pulumi
import pulumi_gcp as gcp

foo = gcp.compute.get_router_nat(name="my-nat",
    router="my-router")
Copy
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.LookupRouterNat(ctx, &compute.LookupRouterNatArgs{
			Name:   "my-nat",
			Router: "my-router",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var foo = Gcp.Compute.GetRouterNat.Invoke(new()
    {
        Name = "my-nat",
        Router = "my-router",
    });

});
Copy
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.GetRouterNatArgs;
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 foo = ComputeFunctions.getRouterNat(GetRouterNatArgs.builder()
            .name("my-nat")
            .router("my-router")
            .build());

    }
}
Copy
variables:
  foo:
    fn::invoke:
      function: gcp:compute:getRouterNat
      arguments:
        name: my-nat
        router: my-router
Copy

Using getRouterNat

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 getRouterNat(args: GetRouterNatArgs, opts?: InvokeOptions): Promise<GetRouterNatResult>
function getRouterNatOutput(args: GetRouterNatOutputArgs, opts?: InvokeOptions): Output<GetRouterNatResult>
Copy
def get_router_nat(name: Optional[str] = None,
                   project: Optional[str] = None,
                   region: Optional[str] = None,
                   router: Optional[str] = None,
                   opts: Optional[InvokeOptions] = None) -> GetRouterNatResult
def get_router_nat_output(name: Optional[pulumi.Input[str]] = None,
                   project: Optional[pulumi.Input[str]] = None,
                   region: Optional[pulumi.Input[str]] = None,
                   router: Optional[pulumi.Input[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetRouterNatResult]
Copy
func LookupRouterNat(ctx *Context, args *LookupRouterNatArgs, opts ...InvokeOption) (*LookupRouterNatResult, error)
func LookupRouterNatOutput(ctx *Context, args *LookupRouterNatOutputArgs, opts ...InvokeOption) LookupRouterNatResultOutput
Copy

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

public static class GetRouterNat 
{
    public static Task<GetRouterNatResult> InvokeAsync(GetRouterNatArgs args, InvokeOptions? opts = null)
    public static Output<GetRouterNatResult> Invoke(GetRouterNatInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetRouterNatResult> getRouterNat(GetRouterNatArgs args, InvokeOptions options)
public static Output<GetRouterNatResult> getRouterNat(GetRouterNatArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: gcp:compute/getRouterNat:getRouterNat
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

Name This property is required. string
Name of the NAT service. The name must be 1-63 characters long and comply with RFC1035.
Router This property is required. string
The name of the Cloud Router in which this NAT will be configured.


Project string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
Region string
Region where the router and NAT reside.
Name This property is required. string
Name of the NAT service. The name must be 1-63 characters long and comply with RFC1035.
Router This property is required. string
The name of the Cloud Router in which this NAT will be configured.


Project string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
Region string
Region where the router and NAT reside.
name This property is required. String
Name of the NAT service. The name must be 1-63 characters long and comply with RFC1035.
router This property is required. String
The name of the Cloud Router in which this NAT will be configured.


project String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
region String
Region where the router and NAT reside.
name This property is required. string
Name of the NAT service. The name must be 1-63 characters long and comply with RFC1035.
router This property is required. string
The name of the Cloud Router in which this NAT will be configured.


project string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
region string
Region where the router and NAT reside.
name This property is required. str
Name of the NAT service. The name must be 1-63 characters long and comply with RFC1035.
router This property is required. str
The name of the Cloud Router in which this NAT will be configured.


project str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
region str
Region where the router and NAT reside.
name This property is required. String
Name of the NAT service. The name must be 1-63 characters long and comply with RFC1035.
router This property is required. String
The name of the Cloud Router in which this NAT will be configured.


project String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
region String
Region where the router and NAT reside.

getRouterNat Result

The following output properties are available:

Supporting Types

GetRouterNatLogConfig

Enable This property is required. bool
Indicates whether or not to export logs.
Filter This property is required. string
Specifies the desired filtering of logs on this NAT. Possible values: ["ERRORS_ONLY", "TRANSLATIONS_ONLY", "ALL"]
Enable This property is required. bool
Indicates whether or not to export logs.
Filter This property is required. string
Specifies the desired filtering of logs on this NAT. Possible values: ["ERRORS_ONLY", "TRANSLATIONS_ONLY", "ALL"]
enable This property is required. Boolean
Indicates whether or not to export logs.
filter This property is required. String
Specifies the desired filtering of logs on this NAT. Possible values: ["ERRORS_ONLY", "TRANSLATIONS_ONLY", "ALL"]
enable This property is required. boolean
Indicates whether or not to export logs.
filter This property is required. string
Specifies the desired filtering of logs on this NAT. Possible values: ["ERRORS_ONLY", "TRANSLATIONS_ONLY", "ALL"]
enable This property is required. bool
Indicates whether or not to export logs.
filter This property is required. str
Specifies the desired filtering of logs on this NAT. Possible values: ["ERRORS_ONLY", "TRANSLATIONS_ONLY", "ALL"]
enable This property is required. Boolean
Indicates whether or not to export logs.
filter This property is required. String
Specifies the desired filtering of logs on this NAT. Possible values: ["ERRORS_ONLY", "TRANSLATIONS_ONLY", "ALL"]

GetRouterNatRule

Actions This property is required. List<GetRouterNatRuleAction>
The action to be enforced for traffic that matches this rule.
Description This property is required. string
An optional description of this rule.
Match This property is required. string

CEL expression that specifies the match condition that egress traffic from a VM is evaluated against. If it evaluates to true, the corresponding action is enforced.

The following examples are valid match expressions for public NAT:

"inIpRange(destination.ip, '1.1.0.0/16') || inIpRange(destination.ip, '2.2.0.0/16')"

"destination.ip == '1.1.0.1' || destination.ip == '8.8.8.8'"

The following example is a valid match expression for private NAT:

"nexthop.hub == 'https://networkconnectivity.googleapis.com/v1alpha1/projects/my-project/global/hub/hub-1'"

RuleNumber This property is required. int
An integer uniquely identifying a rule in the list. The rule number must be a positive value between 0 and 65000, and must be unique among rules within a NAT.
Actions This property is required. []GetRouterNatRuleAction
The action to be enforced for traffic that matches this rule.
Description This property is required. string
An optional description of this rule.
Match This property is required. string

CEL expression that specifies the match condition that egress traffic from a VM is evaluated against. If it evaluates to true, the corresponding action is enforced.

The following examples are valid match expressions for public NAT:

"inIpRange(destination.ip, '1.1.0.0/16') || inIpRange(destination.ip, '2.2.0.0/16')"

"destination.ip == '1.1.0.1' || destination.ip == '8.8.8.8'"

The following example is a valid match expression for private NAT:

"nexthop.hub == 'https://networkconnectivity.googleapis.com/v1alpha1/projects/my-project/global/hub/hub-1'"

RuleNumber This property is required. int
An integer uniquely identifying a rule in the list. The rule number must be a positive value between 0 and 65000, and must be unique among rules within a NAT.
actions This property is required. List<GetRouterNatRuleAction>
The action to be enforced for traffic that matches this rule.
description This property is required. String
An optional description of this rule.
match This property is required. String

CEL expression that specifies the match condition that egress traffic from a VM is evaluated against. If it evaluates to true, the corresponding action is enforced.

The following examples are valid match expressions for public NAT:

"inIpRange(destination.ip, '1.1.0.0/16') || inIpRange(destination.ip, '2.2.0.0/16')"

"destination.ip == '1.1.0.1' || destination.ip == '8.8.8.8'"

The following example is a valid match expression for private NAT:

"nexthop.hub == 'https://networkconnectivity.googleapis.com/v1alpha1/projects/my-project/global/hub/hub-1'"

ruleNumber This property is required. Integer
An integer uniquely identifying a rule in the list. The rule number must be a positive value between 0 and 65000, and must be unique among rules within a NAT.
actions This property is required. GetRouterNatRuleAction[]
The action to be enforced for traffic that matches this rule.
description This property is required. string
An optional description of this rule.
match This property is required. string

CEL expression that specifies the match condition that egress traffic from a VM is evaluated against. If it evaluates to true, the corresponding action is enforced.

The following examples are valid match expressions for public NAT:

"inIpRange(destination.ip, '1.1.0.0/16') || inIpRange(destination.ip, '2.2.0.0/16')"

"destination.ip == '1.1.0.1' || destination.ip == '8.8.8.8'"

The following example is a valid match expression for private NAT:

"nexthop.hub == 'https://networkconnectivity.googleapis.com/v1alpha1/projects/my-project/global/hub/hub-1'"

ruleNumber This property is required. number
An integer uniquely identifying a rule in the list. The rule number must be a positive value between 0 and 65000, and must be unique among rules within a NAT.
actions This property is required. Sequence[GetRouterNatRuleAction]
The action to be enforced for traffic that matches this rule.
description This property is required. str
An optional description of this rule.
match This property is required. str

CEL expression that specifies the match condition that egress traffic from a VM is evaluated against. If it evaluates to true, the corresponding action is enforced.

The following examples are valid match expressions for public NAT:

"inIpRange(destination.ip, '1.1.0.0/16') || inIpRange(destination.ip, '2.2.0.0/16')"

"destination.ip == '1.1.0.1' || destination.ip == '8.8.8.8'"

The following example is a valid match expression for private NAT:

"nexthop.hub == 'https://networkconnectivity.googleapis.com/v1alpha1/projects/my-project/global/hub/hub-1'"

rule_number This property is required. int
An integer uniquely identifying a rule in the list. The rule number must be a positive value between 0 and 65000, and must be unique among rules within a NAT.
actions This property is required. List<Property Map>
The action to be enforced for traffic that matches this rule.
description This property is required. String
An optional description of this rule.
match This property is required. String

CEL expression that specifies the match condition that egress traffic from a VM is evaluated against. If it evaluates to true, the corresponding action is enforced.

The following examples are valid match expressions for public NAT:

"inIpRange(destination.ip, '1.1.0.0/16') || inIpRange(destination.ip, '2.2.0.0/16')"

"destination.ip == '1.1.0.1' || destination.ip == '8.8.8.8'"

The following example is a valid match expression for private NAT:

"nexthop.hub == 'https://networkconnectivity.googleapis.com/v1alpha1/projects/my-project/global/hub/hub-1'"

ruleNumber This property is required. Number
An integer uniquely identifying a rule in the list. The rule number must be a positive value between 0 and 65000, and must be unique among rules within a NAT.

GetRouterNatRuleAction

SourceNatActiveIps This property is required. List<string>
A list of URLs of the IP resources used for this NAT rule. These IP addresses must be valid static external IP addresses assigned to the project. This field is used for public NAT.
SourceNatActiveRanges This property is required. List<string>
A list of URLs of the subnetworks used as source ranges for this NAT Rule. These subnetworks must have purpose set to PRIVATE_NAT. This field is used for private NAT.
SourceNatDrainIps This property is required. List<string>
A list of URLs of the IP resources to be drained. These IPs must be valid static external IPs that have been assigned to the NAT. These IPs should be used for updating/patching a NAT rule only. This field is used for public NAT.
SourceNatDrainRanges This property is required. List<string>
A list of URLs of subnetworks representing source ranges to be drained. This is only supported on patch/update, and these subnetworks must have previously been used as active ranges in this NAT Rule. This field is used for private NAT.
SourceNatActiveIps This property is required. []string
A list of URLs of the IP resources used for this NAT rule. These IP addresses must be valid static external IP addresses assigned to the project. This field is used for public NAT.
SourceNatActiveRanges This property is required. []string
A list of URLs of the subnetworks used as source ranges for this NAT Rule. These subnetworks must have purpose set to PRIVATE_NAT. This field is used for private NAT.
SourceNatDrainIps This property is required. []string
A list of URLs of the IP resources to be drained. These IPs must be valid static external IPs that have been assigned to the NAT. These IPs should be used for updating/patching a NAT rule only. This field is used for public NAT.
SourceNatDrainRanges This property is required. []string
A list of URLs of subnetworks representing source ranges to be drained. This is only supported on patch/update, and these subnetworks must have previously been used as active ranges in this NAT Rule. This field is used for private NAT.
sourceNatActiveIps This property is required. List<String>
A list of URLs of the IP resources used for this NAT rule. These IP addresses must be valid static external IP addresses assigned to the project. This field is used for public NAT.
sourceNatActiveRanges This property is required. List<String>
A list of URLs of the subnetworks used as source ranges for this NAT Rule. These subnetworks must have purpose set to PRIVATE_NAT. This field is used for private NAT.
sourceNatDrainIps This property is required. List<String>
A list of URLs of the IP resources to be drained. These IPs must be valid static external IPs that have been assigned to the NAT. These IPs should be used for updating/patching a NAT rule only. This field is used for public NAT.
sourceNatDrainRanges This property is required. List<String>
A list of URLs of subnetworks representing source ranges to be drained. This is only supported on patch/update, and these subnetworks must have previously been used as active ranges in this NAT Rule. This field is used for private NAT.
sourceNatActiveIps This property is required. string[]
A list of URLs of the IP resources used for this NAT rule. These IP addresses must be valid static external IP addresses assigned to the project. This field is used for public NAT.
sourceNatActiveRanges This property is required. string[]
A list of URLs of the subnetworks used as source ranges for this NAT Rule. These subnetworks must have purpose set to PRIVATE_NAT. This field is used for private NAT.
sourceNatDrainIps This property is required. string[]
A list of URLs of the IP resources to be drained. These IPs must be valid static external IPs that have been assigned to the NAT. These IPs should be used for updating/patching a NAT rule only. This field is used for public NAT.
sourceNatDrainRanges This property is required. string[]
A list of URLs of subnetworks representing source ranges to be drained. This is only supported on patch/update, and these subnetworks must have previously been used as active ranges in this NAT Rule. This field is used for private NAT.
source_nat_active_ips This property is required. Sequence[str]
A list of URLs of the IP resources used for this NAT rule. These IP addresses must be valid static external IP addresses assigned to the project. This field is used for public NAT.
source_nat_active_ranges This property is required. Sequence[str]
A list of URLs of the subnetworks used as source ranges for this NAT Rule. These subnetworks must have purpose set to PRIVATE_NAT. This field is used for private NAT.
source_nat_drain_ips This property is required. Sequence[str]
A list of URLs of the IP resources to be drained. These IPs must be valid static external IPs that have been assigned to the NAT. These IPs should be used for updating/patching a NAT rule only. This field is used for public NAT.
source_nat_drain_ranges This property is required. Sequence[str]
A list of URLs of subnetworks representing source ranges to be drained. This is only supported on patch/update, and these subnetworks must have previously been used as active ranges in this NAT Rule. This field is used for private NAT.
sourceNatActiveIps This property is required. List<String>
A list of URLs of the IP resources used for this NAT rule. These IP addresses must be valid static external IP addresses assigned to the project. This field is used for public NAT.
sourceNatActiveRanges This property is required. List<String>
A list of URLs of the subnetworks used as source ranges for this NAT Rule. These subnetworks must have purpose set to PRIVATE_NAT. This field is used for private NAT.
sourceNatDrainIps This property is required. List<String>
A list of URLs of the IP resources to be drained. These IPs must be valid static external IPs that have been assigned to the NAT. These IPs should be used for updating/patching a NAT rule only. This field is used for public NAT.
sourceNatDrainRanges This property is required. List<String>
A list of URLs of subnetworks representing source ranges to be drained. This is only supported on patch/update, and these subnetworks must have previously been used as active ranges in this NAT Rule. This field is used for private NAT.

GetRouterNatSubnetwork

Name This property is required. string
Name of the NAT service. The name must be 1-63 characters long and comply with RFC1035.
SecondaryIpRangeNames This property is required. List<string>
List of the secondary ranges of the subnetwork that are allowed to use NAT. This can be populated only if 'LIST_OF_SECONDARY_IP_RANGES' is one of the values in sourceIpRangesToNat
SourceIpRangesToNats This property is required. List<string>
List of options for which source IPs in the subnetwork should have NAT enabled. Supported values include: 'ALL_IP_RANGES', 'LIST_OF_SECONDARY_IP_RANGES', 'PRIMARY_IP_RANGE'.
Name This property is required. string
Name of the NAT service. The name must be 1-63 characters long and comply with RFC1035.
SecondaryIpRangeNames This property is required. []string
List of the secondary ranges of the subnetwork that are allowed to use NAT. This can be populated only if 'LIST_OF_SECONDARY_IP_RANGES' is one of the values in sourceIpRangesToNat
SourceIpRangesToNats This property is required. []string
List of options for which source IPs in the subnetwork should have NAT enabled. Supported values include: 'ALL_IP_RANGES', 'LIST_OF_SECONDARY_IP_RANGES', 'PRIMARY_IP_RANGE'.
name This property is required. String
Name of the NAT service. The name must be 1-63 characters long and comply with RFC1035.
secondaryIpRangeNames This property is required. List<String>
List of the secondary ranges of the subnetwork that are allowed to use NAT. This can be populated only if 'LIST_OF_SECONDARY_IP_RANGES' is one of the values in sourceIpRangesToNat
sourceIpRangesToNats This property is required. List<String>
List of options for which source IPs in the subnetwork should have NAT enabled. Supported values include: 'ALL_IP_RANGES', 'LIST_OF_SECONDARY_IP_RANGES', 'PRIMARY_IP_RANGE'.
name This property is required. string
Name of the NAT service. The name must be 1-63 characters long and comply with RFC1035.
secondaryIpRangeNames This property is required. string[]
List of the secondary ranges of the subnetwork that are allowed to use NAT. This can be populated only if 'LIST_OF_SECONDARY_IP_RANGES' is one of the values in sourceIpRangesToNat
sourceIpRangesToNats This property is required. string[]
List of options for which source IPs in the subnetwork should have NAT enabled. Supported values include: 'ALL_IP_RANGES', 'LIST_OF_SECONDARY_IP_RANGES', 'PRIMARY_IP_RANGE'.
name This property is required. str
Name of the NAT service. The name must be 1-63 characters long and comply with RFC1035.
secondary_ip_range_names This property is required. Sequence[str]
List of the secondary ranges of the subnetwork that are allowed to use NAT. This can be populated only if 'LIST_OF_SECONDARY_IP_RANGES' is one of the values in sourceIpRangesToNat
source_ip_ranges_to_nats This property is required. Sequence[str]
List of options for which source IPs in the subnetwork should have NAT enabled. Supported values include: 'ALL_IP_RANGES', 'LIST_OF_SECONDARY_IP_RANGES', 'PRIMARY_IP_RANGE'.
name This property is required. String
Name of the NAT service. The name must be 1-63 characters long and comply with RFC1035.
secondaryIpRangeNames This property is required. List<String>
List of the secondary ranges of the subnetwork that are allowed to use NAT. This can be populated only if 'LIST_OF_SECONDARY_IP_RANGES' is one of the values in sourceIpRangesToNat
sourceIpRangesToNats This property is required. List<String>
List of options for which source IPs in the subnetwork should have NAT enabled. Supported values include: 'ALL_IP_RANGES', 'LIST_OF_SECONDARY_IP_RANGES', 'PRIMARY_IP_RANGE'.

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.
Google Cloud v8.23.0 published on Monday, Mar 24, 2025 by Pulumi