vcd.getNsxtNatRule
Explore with Pulumi AI
Supported in provider v3.3+ and VCD 10.1+ with NSX-T backed VDCs.
Provides a data source to read NSX-T NAT rules. Source NAT (SNAT) rules change the source IP address from a private to a public IP address. Destination NAT (DNAT) rules change the destination IP address from a public to a private IP address.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as vcd from "@pulumi/vcd";
const dnat_ssh = vcd.getNsxtNatRule({
    org: "my-org",
    edgeGatewayId: data.vcd_nsxt_edgegateway.existing.id,
    name: "dnat-ssh",
});
import pulumi
import pulumi_vcd as vcd
dnat_ssh = vcd.get_nsxt_nat_rule(org="my-org",
    edge_gateway_id=data["vcd_nsxt_edgegateway"]["existing"]["id"],
    name="dnat-ssh")
package main
import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/vcd/v3/vcd"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := vcd.LookupNsxtNatRule(ctx, &vcd.LookupNsxtNatRuleArgs{
			Org:           pulumi.StringRef("my-org"),
			EdgeGatewayId: data.Vcd_nsxt_edgegateway.Existing.Id,
			Name:          "dnat-ssh",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vcd = Pulumi.Vcd;
return await Deployment.RunAsync(() => 
{
    var dnat_ssh = Vcd.GetNsxtNatRule.Invoke(new()
    {
        Org = "my-org",
        EdgeGatewayId = data.Vcd_nsxt_edgegateway.Existing.Id,
        Name = "dnat-ssh",
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vcd.VcdFunctions;
import com.pulumi.vcd.inputs.GetNsxtNatRuleArgs;
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 dnat-ssh = VcdFunctions.getNsxtNatRule(GetNsxtNatRuleArgs.builder()
            .org("my-org")
            .edgeGatewayId(data.vcd_nsxt_edgegateway().existing().id())
            .name("dnat-ssh")
            .build());
    }
}
variables:
  dnat-ssh:
    fn::invoke:
      function: vcd:getNsxtNatRule
      arguments:
        org: my-org
        edgeGatewayId: ${data.vcd_nsxt_edgegateway.existing.id}
        name: dnat-ssh
Using getNsxtNatRule
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 getNsxtNatRule(args: GetNsxtNatRuleArgs, opts?: InvokeOptions): Promise<GetNsxtNatRuleResult>
function getNsxtNatRuleOutput(args: GetNsxtNatRuleOutputArgs, opts?: InvokeOptions): Output<GetNsxtNatRuleResult>def get_nsxt_nat_rule(edge_gateway_id: Optional[str] = None,
                      id: Optional[str] = None,
                      name: Optional[str] = None,
                      org: Optional[str] = None,
                      vdc: Optional[str] = None,
                      opts: Optional[InvokeOptions] = None) -> GetNsxtNatRuleResult
def get_nsxt_nat_rule_output(edge_gateway_id: Optional[pulumi.Input[str]] = None,
                      id: Optional[pulumi.Input[str]] = None,
                      name: Optional[pulumi.Input[str]] = None,
                      org: Optional[pulumi.Input[str]] = None,
                      vdc: Optional[pulumi.Input[str]] = None,
                      opts: Optional[InvokeOptions] = None) -> Output[GetNsxtNatRuleResult]func LookupNsxtNatRule(ctx *Context, args *LookupNsxtNatRuleArgs, opts ...InvokeOption) (*LookupNsxtNatRuleResult, error)
func LookupNsxtNatRuleOutput(ctx *Context, args *LookupNsxtNatRuleOutputArgs, opts ...InvokeOption) LookupNsxtNatRuleResultOutput> Note: This function is named LookupNsxtNatRule in the Go SDK.
public static class GetNsxtNatRule 
{
    public static Task<GetNsxtNatRuleResult> InvokeAsync(GetNsxtNatRuleArgs args, InvokeOptions? opts = null)
    public static Output<GetNsxtNatRuleResult> Invoke(GetNsxtNatRuleInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetNsxtNatRuleResult> getNsxtNatRule(GetNsxtNatRuleArgs args, InvokeOptions options)
public static Output<GetNsxtNatRuleResult> getNsxtNatRule(GetNsxtNatRuleArgs args, InvokeOptions options)
fn::invoke:
  function: vcd:index/getNsxtNatRule:getNsxtNatRule
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Edge
Gateway stringId  - The ID of the Edge Gateway (NSX-T only). Can be looked up using
 - Name string
 Name of existing NAT Rule.
Name uniqueness is not enforced in NSX-T NAT rules, but for this data source to work properly names should be unique so that they can be distinguished.
- Id string
 - Org string
 - The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organizations.
 - Vdc string
 
- Edge
Gateway stringId  - The ID of the Edge Gateway (NSX-T only). Can be looked up using
 - Name string
 Name of existing NAT Rule.
Name uniqueness is not enforced in NSX-T NAT rules, but for this data source to work properly names should be unique so that they can be distinguished.
- Id string
 - Org string
 - The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organizations.
 - Vdc string
 
- edge
Gateway StringId  - The ID of the Edge Gateway (NSX-T only). Can be looked up using
 - name String
 Name of existing NAT Rule.
Name uniqueness is not enforced in NSX-T NAT rules, but for this data source to work properly names should be unique so that they can be distinguished.
- id String
 - org String
 - The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organizations.
 - vdc String
 
- edge
Gateway stringId  - The ID of the Edge Gateway (NSX-T only). Can be looked up using
 - name string
 Name of existing NAT Rule.
Name uniqueness is not enforced in NSX-T NAT rules, but for this data source to work properly names should be unique so that they can be distinguished.
- id string
 - org string
 - The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organizations.
 - vdc string
 
- edge_
gateway_ strid  - The ID of the Edge Gateway (NSX-T only). Can be looked up using
 - name str
 Name of existing NAT Rule.
Name uniqueness is not enforced in NSX-T NAT rules, but for this data source to work properly names should be unique so that they can be distinguished.
- id str
 - org str
 - The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organizations.
 - vdc str
 
- edge
Gateway StringId  - The ID of the Edge Gateway (NSX-T only). Can be looked up using
 - name String
 Name of existing NAT Rule.
Name uniqueness is not enforced in NSX-T NAT rules, but for this data source to work properly names should be unique so that they can be distinguished.
- id String
 - org String
 - The name of organization to use, optional if defined at provider level. Useful when connected as sysadmin working across different organizations.
 - vdc String
 
getNsxtNatRule Result
The following output properties are available:
- App
Port stringProfile Id  - Description string
 - Dnat
External stringPort  - Edge
Gateway stringId  - Enabled bool
 - External
Address string - Firewall
Match string - Id string
 - Internal
Address string - Logging bool
 - Name string
 - Priority double
 - Rule
Type string - Snat
Destination stringAddress  - Org string
 - Vdc string
 
- App
Port stringProfile Id  - Description string
 - Dnat
External stringPort  - Edge
Gateway stringId  - Enabled bool
 - External
Address string - Firewall
Match string - Id string
 - Internal
Address string - Logging bool
 - Name string
 - Priority float64
 - Rule
Type string - Snat
Destination stringAddress  - Org string
 - Vdc string
 
- app
Port StringProfile Id  - description String
 - dnat
External StringPort  - edge
Gateway StringId  - enabled Boolean
 - external
Address String - firewall
Match String - id String
 - internal
Address String - logging Boolean
 - name String
 - priority Double
 - rule
Type String - snat
Destination StringAddress  - org String
 - vdc String
 
- app
Port stringProfile Id  - description string
 - dnat
External stringPort  - edge
Gateway stringId  - enabled boolean
 - external
Address string - firewall
Match string - id string
 - internal
Address string - logging boolean
 - name string
 - priority number
 - rule
Type string - snat
Destination stringAddress  - org string
 - vdc string
 
- app_
port_ strprofile_ id  - description str
 - dnat_
external_ strport  - edge_
gateway_ strid  - enabled bool
 - external_
address str - firewall_
match str - id str
 - internal_
address str - logging bool
 - name str
 - priority float
 - rule_
type str - snat_
destination_ straddress  - org str
 - vdc str
 
- app
Port StringProfile Id  - description String
 - dnat
External StringPort  - edge
Gateway StringId  - enabled Boolean
 - external
Address String - firewall
Match String - id String
 - internal
Address String - logging Boolean
 - name String
 - priority Number
 - rule
Type String - snat
Destination StringAddress  - org String
 - vdc String
 
Package Details
- Repository
 - vcd vmware/terraform-provider-vcd
 - License
 - Notes
 - This Pulumi package is based on the 
vcdTerraform Provider.