1. Packages
  2. Azure Native
  3. API Docs
  4. network
  5. ForwardingRule
This is the latest version of Azure Native. Use the Azure Native v1 docs if using the v1 version of this package.
Azure Native v2.73.0 published on Wednesday, Nov 20, 2024 by Pulumi

azure-native.network.ForwardingRule

Explore with Pulumi AI

azure-native logo
This is the latest version of Azure Native. Use the Azure Native v1 docs if using the v1 version of this package.
Azure Native v2.73.0 published on Wednesday, Nov 20, 2024 by Pulumi

    Describes a forwarding rule within a DNS forwarding ruleset. Azure REST API version: 2022-07-01. Prior API version in Azure Native 1.x: 2020-04-01-preview.

    Other available API versions: 2023-07-01-preview.

    Example Usage

    Upsert forwarding rule in a DNS forwarding ruleset

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AzureNative = Pulumi.AzureNative;
    
    return await Deployment.RunAsync(() => 
    {
        var forwardingRule = new AzureNative.Network.ForwardingRule("forwardingRule", new()
        {
            DnsForwardingRulesetName = "sampleDnsForwardingRuleset",
            DomainName = "contoso.com.",
            ForwardingRuleName = "sampleForwardingRule",
            ForwardingRuleState = AzureNative.Network.ForwardingRuleState.Enabled,
            Metadata = 
            {
                { "additionalProp1", "value1" },
            },
            ResourceGroupName = "sampleResourceGroup",
            TargetDnsServers = new[]
            {
                new AzureNative.Network.Inputs.TargetDnsServerArgs
                {
                    IpAddress = "10.0.0.1",
                    Port = 53,
                },
                new AzureNative.Network.Inputs.TargetDnsServerArgs
                {
                    IpAddress = "10.0.0.2",
                    Port = 53,
                },
            },
        });
    
    });
    
    package main
    
    import (
    	network "github.com/pulumi/pulumi-azure-native-sdk/network/v2"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := network.NewForwardingRule(ctx, "forwardingRule", &network.ForwardingRuleArgs{
    			DnsForwardingRulesetName: pulumi.String("sampleDnsForwardingRuleset"),
    			DomainName:               pulumi.String("contoso.com."),
    			ForwardingRuleName:       pulumi.String("sampleForwardingRule"),
    			ForwardingRuleState:      pulumi.String(network.ForwardingRuleStateEnabled),
    			Metadata: pulumi.StringMap{
    				"additionalProp1": pulumi.String("value1"),
    			},
    			ResourceGroupName: pulumi.String("sampleResourceGroup"),
    			TargetDnsServers: network.TargetDnsServerArray{
    				&network.TargetDnsServerArgs{
    					IpAddress: pulumi.String("10.0.0.1"),
    					Port:      pulumi.Int(53),
    				},
    				&network.TargetDnsServerArgs{
    					IpAddress: pulumi.String("10.0.0.2"),
    					Port:      pulumi.Int(53),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azurenative.network.ForwardingRule;
    import com.pulumi.azurenative.network.ForwardingRuleArgs;
    import com.pulumi.azurenative.network.inputs.TargetDnsServerArgs;
    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) {
            var forwardingRule = new ForwardingRule("forwardingRule", ForwardingRuleArgs.builder()
                .dnsForwardingRulesetName("sampleDnsForwardingRuleset")
                .domainName("contoso.com.")
                .forwardingRuleName("sampleForwardingRule")
                .forwardingRuleState("Enabled")
                .metadata(Map.of("additionalProp1", "value1"))
                .resourceGroupName("sampleResourceGroup")
                .targetDnsServers(            
                    TargetDnsServerArgs.builder()
                        .ipAddress("10.0.0.1")
                        .port(53)
                        .build(),
                    TargetDnsServerArgs.builder()
                        .ipAddress("10.0.0.2")
                        .port(53)
                        .build())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_azure_native as azure_native
    
    forwarding_rule = azure_native.network.ForwardingRule("forwardingRule",
        dns_forwarding_ruleset_name="sampleDnsForwardingRuleset",
        domain_name="contoso.com.",
        forwarding_rule_name="sampleForwardingRule",
        forwarding_rule_state=azure_native.network.ForwardingRuleState.ENABLED,
        metadata={
            "additionalProp1": "value1",
        },
        resource_group_name="sampleResourceGroup",
        target_dns_servers=[
            {
                "ip_address": "10.0.0.1",
                "port": 53,
            },
            {
                "ip_address": "10.0.0.2",
                "port": 53,
            },
        ])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as azure_native from "@pulumi/azure-native";
    
    const forwardingRule = new azure_native.network.ForwardingRule("forwardingRule", {
        dnsForwardingRulesetName: "sampleDnsForwardingRuleset",
        domainName: "contoso.com.",
        forwardingRuleName: "sampleForwardingRule",
        forwardingRuleState: azure_native.network.ForwardingRuleState.Enabled,
        metadata: {
            additionalProp1: "value1",
        },
        resourceGroupName: "sampleResourceGroup",
        targetDnsServers: [
            {
                ipAddress: "10.0.0.1",
                port: 53,
            },
            {
                ipAddress: "10.0.0.2",
                port: 53,
            },
        ],
    });
    
    resources:
      forwardingRule:
        type: azure-native:network:ForwardingRule
        properties:
          dnsForwardingRulesetName: sampleDnsForwardingRuleset
          domainName: contoso.com.
          forwardingRuleName: sampleForwardingRule
          forwardingRuleState: Enabled
          metadata:
            additionalProp1: value1
          resourceGroupName: sampleResourceGroup
          targetDnsServers:
            - ipAddress: 10.0.0.1
              port: 53
            - ipAddress: 10.0.0.2
              port: 53
    

    Create ForwardingRule Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ForwardingRule(name: string, args: ForwardingRuleArgs, opts?: CustomResourceOptions);
    @overload
    def ForwardingRule(resource_name: str,
                       args: ForwardingRuleArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def ForwardingRule(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       dns_forwarding_ruleset_name: Optional[str] = None,
                       domain_name: Optional[str] = None,
                       resource_group_name: Optional[str] = None,
                       target_dns_servers: Optional[Sequence[TargetDnsServerArgs]] = None,
                       forwarding_rule_name: Optional[str] = None,
                       forwarding_rule_state: Optional[Union[str, ForwardingRuleState]] = None,
                       metadata: Optional[Mapping[str, str]] = None)
    func NewForwardingRule(ctx *Context, name string, args ForwardingRuleArgs, opts ...ResourceOption) (*ForwardingRule, error)
    public ForwardingRule(string name, ForwardingRuleArgs args, CustomResourceOptions? opts = null)
    public ForwardingRule(String name, ForwardingRuleArgs args)
    public ForwardingRule(String name, ForwardingRuleArgs args, CustomResourceOptions options)
    
    type: azure-native:network:ForwardingRule
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args ForwardingRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args ForwardingRuleArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args ForwardingRuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ForwardingRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ForwardingRuleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var forwardingRuleResource = new AzureNative.Network.ForwardingRule("forwardingRuleResource", new()
    {
        DnsForwardingRulesetName = "string",
        DomainName = "string",
        ResourceGroupName = "string",
        TargetDnsServers = new[]
        {
            new AzureNative.Network.Inputs.TargetDnsServerArgs
            {
                IpAddress = "string",
                Port = 0,
            },
        },
        ForwardingRuleName = "string",
        ForwardingRuleState = "string",
        Metadata = 
        {
            { "string", "string" },
        },
    });
    
    example, err := network.NewForwardingRule(ctx, "forwardingRuleResource", &network.ForwardingRuleArgs{
    	DnsForwardingRulesetName: pulumi.String("string"),
    	DomainName:               pulumi.String("string"),
    	ResourceGroupName:        pulumi.String("string"),
    	TargetDnsServers: network.TargetDnsServerArray{
    		&network.TargetDnsServerArgs{
    			IpAddress: pulumi.String("string"),
    			Port:      pulumi.Int(0),
    		},
    	},
    	ForwardingRuleName:  pulumi.String("string"),
    	ForwardingRuleState: pulumi.String("string"),
    	Metadata: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var forwardingRuleResource = new ForwardingRule("forwardingRuleResource", ForwardingRuleArgs.builder()
        .dnsForwardingRulesetName("string")
        .domainName("string")
        .resourceGroupName("string")
        .targetDnsServers(TargetDnsServerArgs.builder()
            .ipAddress("string")
            .port(0)
            .build())
        .forwardingRuleName("string")
        .forwardingRuleState("string")
        .metadata(Map.of("string", "string"))
        .build());
    
    forwarding_rule_resource = azure_native.network.ForwardingRule("forwardingRuleResource",
        dns_forwarding_ruleset_name="string",
        domain_name="string",
        resource_group_name="string",
        target_dns_servers=[{
            "ip_address": "string",
            "port": 0,
        }],
        forwarding_rule_name="string",
        forwarding_rule_state="string",
        metadata={
            "string": "string",
        })
    
    const forwardingRuleResource = new azure_native.network.ForwardingRule("forwardingRuleResource", {
        dnsForwardingRulesetName: "string",
        domainName: "string",
        resourceGroupName: "string",
        targetDnsServers: [{
            ipAddress: "string",
            port: 0,
        }],
        forwardingRuleName: "string",
        forwardingRuleState: "string",
        metadata: {
            string: "string",
        },
    });
    
    type: azure-native:network:ForwardingRule
    properties:
        dnsForwardingRulesetName: string
        domainName: string
        forwardingRuleName: string
        forwardingRuleState: string
        metadata:
            string: string
        resourceGroupName: string
        targetDnsServers:
            - ipAddress: string
              port: 0
    

    ForwardingRule Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The ForwardingRule resource accepts the following input properties:

    DnsForwardingRulesetName string
    The name of the DNS forwarding ruleset.
    DomainName string
    The domain name for the forwarding rule.
    ResourceGroupName string
    The name of the resource group. The name is case insensitive.
    TargetDnsServers List<Pulumi.AzureNative.Network.Inputs.TargetDnsServer>
    DNS servers to forward the DNS query to.
    ForwardingRuleName string
    The name of the forwarding rule.
    ForwardingRuleState string | Pulumi.AzureNative.Network.ForwardingRuleState
    The state of forwarding rule.
    Metadata Dictionary<string, string>
    Metadata attached to the forwarding rule.
    DnsForwardingRulesetName string
    The name of the DNS forwarding ruleset.
    DomainName string
    The domain name for the forwarding rule.
    ResourceGroupName string
    The name of the resource group. The name is case insensitive.
    TargetDnsServers []TargetDnsServerArgs
    DNS servers to forward the DNS query to.
    ForwardingRuleName string
    The name of the forwarding rule.
    ForwardingRuleState string | ForwardingRuleStateEnum
    The state of forwarding rule.
    Metadata map[string]string
    Metadata attached to the forwarding rule.
    dnsForwardingRulesetName String
    The name of the DNS forwarding ruleset.
    domainName String
    The domain name for the forwarding rule.
    resourceGroupName String
    The name of the resource group. The name is case insensitive.
    targetDnsServers List<TargetDnsServer>
    DNS servers to forward the DNS query to.
    forwardingRuleName String
    The name of the forwarding rule.
    forwardingRuleState String | ForwardingRuleState
    The state of forwarding rule.
    metadata Map<String,String>
    Metadata attached to the forwarding rule.
    dnsForwardingRulesetName string
    The name of the DNS forwarding ruleset.
    domainName string
    The domain name for the forwarding rule.
    resourceGroupName string
    The name of the resource group. The name is case insensitive.
    targetDnsServers TargetDnsServer[]
    DNS servers to forward the DNS query to.
    forwardingRuleName string
    The name of the forwarding rule.
    forwardingRuleState string | ForwardingRuleState
    The state of forwarding rule.
    metadata {[key: string]: string}
    Metadata attached to the forwarding rule.
    dns_forwarding_ruleset_name str
    The name of the DNS forwarding ruleset.
    domain_name str
    The domain name for the forwarding rule.
    resource_group_name str
    The name of the resource group. The name is case insensitive.
    target_dns_servers Sequence[TargetDnsServerArgs]
    DNS servers to forward the DNS query to.
    forwarding_rule_name str
    The name of the forwarding rule.
    forwarding_rule_state str | ForwardingRuleState
    The state of forwarding rule.
    metadata Mapping[str, str]
    Metadata attached to the forwarding rule.
    dnsForwardingRulesetName String
    The name of the DNS forwarding ruleset.
    domainName String
    The domain name for the forwarding rule.
    resourceGroupName String
    The name of the resource group. The name is case insensitive.
    targetDnsServers List<Property Map>
    DNS servers to forward the DNS query to.
    forwardingRuleName String
    The name of the forwarding rule.
    forwardingRuleState String | "Enabled" | "Disabled"
    The state of forwarding rule.
    metadata Map<String>
    Metadata attached to the forwarding rule.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ForwardingRule resource produces the following output properties:

    Etag string
    ETag of the forwarding rule.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    The name of the resource
    ProvisioningState string
    The current provisioning state of the forwarding rule. This is a read-only property and any attempt to set this value will be ignored.
    SystemData Pulumi.AzureNative.Network.Outputs.SystemDataResponse
    Metadata pertaining to creation and last modification of the resource.
    Type string
    The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
    Etag string
    ETag of the forwarding rule.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    The name of the resource
    ProvisioningState string
    The current provisioning state of the forwarding rule. This is a read-only property and any attempt to set this value will be ignored.
    SystemData SystemDataResponse
    Metadata pertaining to creation and last modification of the resource.
    Type string
    The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
    etag String
    ETag of the forwarding rule.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    The name of the resource
    provisioningState String
    The current provisioning state of the forwarding rule. This is a read-only property and any attempt to set this value will be ignored.
    systemData SystemDataResponse
    Metadata pertaining to creation and last modification of the resource.
    type String
    The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
    etag string
    ETag of the forwarding rule.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    The name of the resource
    provisioningState string
    The current provisioning state of the forwarding rule. This is a read-only property and any attempt to set this value will be ignored.
    systemData SystemDataResponse
    Metadata pertaining to creation and last modification of the resource.
    type string
    The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
    etag str
    ETag of the forwarding rule.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    The name of the resource
    provisioning_state str
    The current provisioning state of the forwarding rule. This is a read-only property and any attempt to set this value will be ignored.
    system_data SystemDataResponse
    Metadata pertaining to creation and last modification of the resource.
    type str
    The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"
    etag String
    ETag of the forwarding rule.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    The name of the resource
    provisioningState String
    The current provisioning state of the forwarding rule. This is a read-only property and any attempt to set this value will be ignored.
    systemData Property Map
    Metadata pertaining to creation and last modification of the resource.
    type String
    The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts"

    Supporting Types

    ForwardingRuleState, ForwardingRuleStateArgs

    Enabled
    Enabled
    Disabled
    Disabled
    ForwardingRuleStateEnabled
    Enabled
    ForwardingRuleStateDisabled
    Disabled
    Enabled
    Enabled
    Disabled
    Disabled
    Enabled
    Enabled
    Disabled
    Disabled
    ENABLED
    Enabled
    DISABLED
    Disabled
    "Enabled"
    Enabled
    "Disabled"
    Disabled

    SystemDataResponse, SystemDataResponseArgs

    CreatedAt string
    The timestamp of resource creation (UTC).
    CreatedBy string
    The identity that created the resource.
    CreatedByType string
    The type of identity that created the resource.
    LastModifiedAt string
    The type of identity that last modified the resource.
    LastModifiedBy string
    The identity that last modified the resource.
    LastModifiedByType string
    The type of identity that last modified the resource.
    CreatedAt string
    The timestamp of resource creation (UTC).
    CreatedBy string
    The identity that created the resource.
    CreatedByType string
    The type of identity that created the resource.
    LastModifiedAt string
    The type of identity that last modified the resource.
    LastModifiedBy string
    The identity that last modified the resource.
    LastModifiedByType string
    The type of identity that last modified the resource.
    createdAt String
    The timestamp of resource creation (UTC).
    createdBy String
    The identity that created the resource.
    createdByType String
    The type of identity that created the resource.
    lastModifiedAt String
    The type of identity that last modified the resource.
    lastModifiedBy String
    The identity that last modified the resource.
    lastModifiedByType String
    The type of identity that last modified the resource.
    createdAt string
    The timestamp of resource creation (UTC).
    createdBy string
    The identity that created the resource.
    createdByType string
    The type of identity that created the resource.
    lastModifiedAt string
    The type of identity that last modified the resource.
    lastModifiedBy string
    The identity that last modified the resource.
    lastModifiedByType string
    The type of identity that last modified the resource.
    created_at str
    The timestamp of resource creation (UTC).
    created_by str
    The identity that created the resource.
    created_by_type str
    The type of identity that created the resource.
    last_modified_at str
    The type of identity that last modified the resource.
    last_modified_by str
    The identity that last modified the resource.
    last_modified_by_type str
    The type of identity that last modified the resource.
    createdAt String
    The timestamp of resource creation (UTC).
    createdBy String
    The identity that created the resource.
    createdByType String
    The type of identity that created the resource.
    lastModifiedAt String
    The type of identity that last modified the resource.
    lastModifiedBy String
    The identity that last modified the resource.
    lastModifiedByType String
    The type of identity that last modified the resource.

    TargetDnsServer, TargetDnsServerArgs

    IpAddress string
    DNS server IP address.
    Port int
    DNS server port.
    IpAddress string
    DNS server IP address.
    Port int
    DNS server port.
    ipAddress String
    DNS server IP address.
    port Integer
    DNS server port.
    ipAddress string
    DNS server IP address.
    port number
    DNS server port.
    ip_address str
    DNS server IP address.
    port int
    DNS server port.
    ipAddress String
    DNS server IP address.
    port Number
    DNS server port.

    TargetDnsServerResponse, TargetDnsServerResponseArgs

    IpAddress string
    DNS server IP address.
    Port int
    DNS server port.
    IpAddress string
    DNS server IP address.
    Port int
    DNS server port.
    ipAddress String
    DNS server IP address.
    port Integer
    DNS server port.
    ipAddress string
    DNS server IP address.
    port number
    DNS server port.
    ip_address str
    DNS server IP address.
    port int
    DNS server port.
    ipAddress String
    DNS server IP address.
    port Number
    DNS server port.

    Import

    An existing resource can be imported using its type token, name, and identifier, e.g.

    $ pulumi import azure-native:network:ForwardingRule sampleForwardingRule /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/dnsForwardingRulesets/{dnsForwardingRulesetName}/forwardingRules/{forwardingRuleName} 
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Azure Native pulumi/pulumi-azure-native
    License
    Apache-2.0
    azure-native logo
    This is the latest version of Azure Native. Use the Azure Native v1 docs if using the v1 version of this package.
    Azure Native v2.73.0 published on Wednesday, Nov 20, 2024 by Pulumi