1. Packages
  2. Nsxt Provider
  3. API Docs
  4. getVpcNat
nsxt 3.9.0 published on Friday, Jun 20, 2025 by vmware

nsxt.getVpcNat

Explore with Pulumi AI

nsxt logo
nsxt 3.9.0 published on Friday, Jun 20, 2025 by vmware

    This data source provides information about an NAT section configured under VPC on NSX.

    This data source is applicable to NSX Policy Manager.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as nsxt from "@pulumi/nsxt";
    
    const proj = nsxt.getPolicyProject({
        displayName: "demoproj",
    });
    const vpc1 = proj.then(proj => nsxt.getVpc({
        context: {
            projectId: proj.id,
        },
        displayName: "vpc1",
    }));
    const test = Promise.all([proj, vpc1]).then(([proj, vpc1]) => nsxt.getVpcNat({
        context: {
            projectId: proj.id,
            vpcId: vpc1.id,
        },
        natType: "USER",
    }));
    
    import pulumi
    import pulumi_nsxt as nsxt
    
    proj = nsxt.get_policy_project(display_name="demoproj")
    vpc1 = nsxt.get_vpc(context={
            "project_id": proj.id,
        },
        display_name="vpc1")
    test = nsxt.get_vpc_nat(context={
            "project_id": proj.id,
            "vpc_id": vpc1.id,
        },
        nat_type="USER")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/nsxt/v3/nsxt"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		proj, err := nsxt.LookupPolicyProject(ctx, &nsxt.LookupPolicyProjectArgs{
    			DisplayName: pulumi.StringRef("demoproj"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		vpc1, err := nsxt.LookupVpc(ctx, &nsxt.LookupVpcArgs{
    			Context: nsxt.GetVpcContext{
    				ProjectId: proj.Id,
    			},
    			DisplayName: pulumi.StringRef("vpc1"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = nsxt.GetVpcNat(ctx, &nsxt.GetVpcNatArgs{
    			Context: nsxt.GetVpcNatContext{
    				ProjectId: proj.Id,
    				VpcId:     vpc1.Id,
    			},
    			NatType: "USER",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Nsxt = Pulumi.Nsxt;
    
    return await Deployment.RunAsync(() => 
    {
        var proj = Nsxt.GetPolicyProject.Invoke(new()
        {
            DisplayName = "demoproj",
        });
    
        var vpc1 = Nsxt.GetVpc.Invoke(new()
        {
            Context = new Nsxt.Inputs.GetVpcContextInputArgs
            {
                ProjectId = proj.Apply(getPolicyProjectResult => getPolicyProjectResult.Id),
            },
            DisplayName = "vpc1",
        });
    
        var test = Nsxt.GetVpcNat.Invoke(new()
        {
            Context = new Nsxt.Inputs.GetVpcNatContextInputArgs
            {
                ProjectId = proj.Apply(getPolicyProjectResult => getPolicyProjectResult.Id),
                VpcId = vpc1.Apply(getVpcResult => getVpcResult.Id),
            },
            NatType = "USER",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.nsxt.NsxtFunctions;
    import com.pulumi.nsxt.inputs.GetPolicyProjectArgs;
    import com.pulumi.nsxt.inputs.GetVpcArgs;
    import com.pulumi.nsxt.inputs.GetVpcContextArgs;
    import com.pulumi.nsxt.inputs.GetVpcNatArgs;
    import com.pulumi.nsxt.inputs.GetVpcNatContextArgs;
    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 proj = NsxtFunctions.getPolicyProject(GetPolicyProjectArgs.builder()
                .displayName("demoproj")
                .build());
    
            final var vpc1 = NsxtFunctions.getVpc(GetVpcArgs.builder()
                .context(GetVpcContextArgs.builder()
                    .projectId(proj.applyValue(getPolicyProjectResult -> getPolicyProjectResult.id()))
                    .build())
                .displayName("vpc1")
                .build());
    
            final var test = NsxtFunctions.getVpcNat(GetVpcNatArgs.builder()
                .context(GetVpcNatContextArgs.builder()
                    .projectId(proj.applyValue(getPolicyProjectResult -> getPolicyProjectResult.id()))
                    .vpcId(vpc1.applyValue(getVpcResult -> getVpcResult.id()))
                    .build())
                .natType("USER")
                .build());
    
        }
    }
    
    variables:
      proj:
        fn::invoke:
          function: nsxt:getPolicyProject
          arguments:
            displayName: demoproj
      vpc1:
        fn::invoke:
          function: nsxt:getVpc
          arguments:
            context:
              projectId: ${proj.id}
            displayName: vpc1
      test:
        fn::invoke:
          function: nsxt:getVpcNat
          arguments:
            context:
              projectId: ${proj.id}
              vpcId: ${vpc1.id}
            natType: USER
    

    Using getVpcNat

    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 getVpcNat(args: GetVpcNatArgs, opts?: InvokeOptions): Promise<GetVpcNatResult>
    function getVpcNatOutput(args: GetVpcNatOutputArgs, opts?: InvokeOptions): Output<GetVpcNatResult>
    def get_vpc_nat(context: Optional[GetVpcNatContext] = None,
                    description: Optional[str] = None,
                    display_name: Optional[str] = None,
                    id: Optional[str] = None,
                    nat_type: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetVpcNatResult
    def get_vpc_nat_output(context: Optional[pulumi.Input[GetVpcNatContextArgs]] = None,
                    description: Optional[pulumi.Input[str]] = None,
                    display_name: Optional[pulumi.Input[str]] = None,
                    id: Optional[pulumi.Input[str]] = None,
                    nat_type: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetVpcNatResult]
    func GetVpcNat(ctx *Context, args *GetVpcNatArgs, opts ...InvokeOption) (*GetVpcNatResult, error)
    func GetVpcNatOutput(ctx *Context, args *GetVpcNatOutputArgs, opts ...InvokeOption) GetVpcNatResultOutput

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

    public static class GetVpcNat 
    {
        public static Task<GetVpcNatResult> InvokeAsync(GetVpcNatArgs args, InvokeOptions? opts = null)
        public static Output<GetVpcNatResult> Invoke(GetVpcNatInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetVpcNatResult> getVpcNat(GetVpcNatArgs args, InvokeOptions options)
    public static Output<GetVpcNatResult> getVpcNat(GetVpcNatArgs args, InvokeOptions options)
    
    fn::invoke:
      function: nsxt:index/getVpcNat:getVpcNat
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Context GetVpcNatContext
    The context which the object belongs to
    NatType string
    Type of NAT, one of USER, INTERNAL, DEFAULT or NAT64.
    Description string
    The description of the resource.
    DisplayName string
    (Optional) Display Name of the resource.
    Id string
    (Optional) The ID of the resource.
    Context GetVpcNatContext
    The context which the object belongs to
    NatType string
    Type of NAT, one of USER, INTERNAL, DEFAULT or NAT64.
    Description string
    The description of the resource.
    DisplayName string
    (Optional) Display Name of the resource.
    Id string
    (Optional) The ID of the resource.
    context GetVpcNatContext
    The context which the object belongs to
    natType String
    Type of NAT, one of USER, INTERNAL, DEFAULT or NAT64.
    description String
    The description of the resource.
    displayName String
    (Optional) Display Name of the resource.
    id String
    (Optional) The ID of the resource.
    context GetVpcNatContext
    The context which the object belongs to
    natType string
    Type of NAT, one of USER, INTERNAL, DEFAULT or NAT64.
    description string
    The description of the resource.
    displayName string
    (Optional) Display Name of the resource.
    id string
    (Optional) The ID of the resource.
    context GetVpcNatContext
    The context which the object belongs to
    nat_type str
    Type of NAT, one of USER, INTERNAL, DEFAULT or NAT64.
    description str
    The description of the resource.
    display_name str
    (Optional) Display Name of the resource.
    id str
    (Optional) The ID of the resource.
    context Property Map
    The context which the object belongs to
    natType String
    Type of NAT, one of USER, INTERNAL, DEFAULT or NAT64.
    description String
    The description of the resource.
    displayName String
    (Optional) Display Name of the resource.
    id String
    (Optional) The ID of the resource.

    getVpcNat Result

    The following output properties are available:

    Context GetVpcNatContext
    Description string
    The description of the resource.
    DisplayName string
    (Optional) Display Name of the resource.
    Id string
    (Optional) The ID of the resource.
    NatType string
    Path string
    The NSX path of the policy resource.
    Context GetVpcNatContext
    Description string
    The description of the resource.
    DisplayName string
    (Optional) Display Name of the resource.
    Id string
    (Optional) The ID of the resource.
    NatType string
    Path string
    The NSX path of the policy resource.
    context GetVpcNatContext
    description String
    The description of the resource.
    displayName String
    (Optional) Display Name of the resource.
    id String
    (Optional) The ID of the resource.
    natType String
    path String
    The NSX path of the policy resource.
    context GetVpcNatContext
    description string
    The description of the resource.
    displayName string
    (Optional) Display Name of the resource.
    id string
    (Optional) The ID of the resource.
    natType string
    path string
    The NSX path of the policy resource.
    context GetVpcNatContext
    description str
    The description of the resource.
    display_name str
    (Optional) Display Name of the resource.
    id str
    (Optional) The ID of the resource.
    nat_type str
    path str
    The NSX path of the policy resource.
    context Property Map
    description String
    The description of the resource.
    displayName String
    (Optional) Display Name of the resource.
    id String
    (Optional) The ID of the resource.
    natType String
    path String
    The NSX path of the policy resource.

    Supporting Types

    GetVpcNatContext

    ProjectId string
    The ID of the project which the object belongs to
    VpcId string
    The ID of the VPC which the object belongs to
    ProjectId string
    The ID of the project which the object belongs to
    VpcId string
    The ID of the VPC which the object belongs to
    projectId String
    The ID of the project which the object belongs to
    vpcId String
    The ID of the VPC which the object belongs to
    projectId string
    The ID of the project which the object belongs to
    vpcId string
    The ID of the VPC which the object belongs to
    project_id str
    The ID of the project which the object belongs to
    vpc_id str
    The ID of the VPC which the object belongs to
    projectId String
    The ID of the project which the object belongs to
    vpcId String
    The ID of the VPC which the object belongs to

    Package Details

    Repository
    nsxt vmware/terraform-provider-nsxt
    License
    Notes
    This Pulumi package is based on the nsxt Terraform Provider.
    nsxt logo
    nsxt 3.9.0 published on Friday, Jun 20, 2025 by vmware