azure-native.network.ForwardingRule
Explore with Pulumi AI
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.
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=[
        azure_native.network.TargetDnsServerArgs(
            ip_address="10.0.0.1",
            port=53,
        ),
        azure_native.network.TargetDnsServerArgs(
            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=[azure_native.network.TargetDnsServerArgs(
        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
The ForwardingRule resource accepts the following input properties:
- DnsForwarding stringRuleset Name 
- The name of the DNS forwarding ruleset.
- DomainName string
- The domain name for the forwarding rule.
- ResourceGroup stringName 
- The name of the resource group. The name is case insensitive.
- TargetDns List<Pulumi.Servers Azure Native. Network. Inputs. Target Dns Server> 
- DNS servers to forward the DNS query to.
- ForwardingRule stringName 
- The name of the forwarding rule.
- ForwardingRule string | Pulumi.State Azure Native. Network. Forwarding Rule State 
- The state of forwarding rule.
- Metadata Dictionary<string, string>
- Metadata attached to the forwarding rule.
- DnsForwarding stringRuleset Name 
- The name of the DNS forwarding ruleset.
- DomainName string
- The domain name for the forwarding rule.
- ResourceGroup stringName 
- The name of the resource group. The name is case insensitive.
- TargetDns []TargetServers Dns Server Args 
- DNS servers to forward the DNS query to.
- ForwardingRule stringName 
- The name of the forwarding rule.
- ForwardingRule string | ForwardingState Rule State Enum 
- The state of forwarding rule.
- Metadata map[string]string
- Metadata attached to the forwarding rule.
- dnsForwarding StringRuleset Name 
- The name of the DNS forwarding ruleset.
- domainName String
- The domain name for the forwarding rule.
- resourceGroup StringName 
- The name of the resource group. The name is case insensitive.
- targetDns List<TargetServers Dns Server> 
- DNS servers to forward the DNS query to.
- forwardingRule StringName 
- The name of the forwarding rule.
- forwardingRule String | ForwardingState Rule State 
- The state of forwarding rule.
- metadata Map<String,String>
- Metadata attached to the forwarding rule.
- dnsForwarding stringRuleset Name 
- The name of the DNS forwarding ruleset.
- domainName string
- The domain name for the forwarding rule.
- resourceGroup stringName 
- The name of the resource group. The name is case insensitive.
- targetDns TargetServers Dns Server[] 
- DNS servers to forward the DNS query to.
- forwardingRule stringName 
- The name of the forwarding rule.
- forwardingRule string | ForwardingState Rule State 
- The state of forwarding rule.
- metadata {[key: string]: string}
- Metadata attached to the forwarding rule.
- dns_forwarding_ strruleset_ name 
- The name of the DNS forwarding ruleset.
- domain_name str
- The domain name for the forwarding rule.
- resource_group_ strname 
- The name of the resource group. The name is case insensitive.
- target_dns_ Sequence[Targetservers Dns Server Args] 
- DNS servers to forward the DNS query to.
- forwarding_rule_ strname 
- The name of the forwarding rule.
- forwarding_rule_ str | Forwardingstate Rule State 
- The state of forwarding rule.
- metadata Mapping[str, str]
- Metadata attached to the forwarding rule.
- dnsForwarding StringRuleset Name 
- The name of the DNS forwarding ruleset.
- domainName String
- The domain name for the forwarding rule.
- resourceGroup StringName 
- The name of the resource group. The name is case insensitive.
- targetDns List<Property Map>Servers 
- DNS servers to forward the DNS query to.
- forwardingRule StringName 
- The name of the forwarding rule.
- forwardingRule String | "Enabled" | "Disabled"State 
- 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.Azure Native. Network. Outputs. System Data Response 
- 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 SystemData Response 
- 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 SystemData Response 
- 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 SystemData Response 
- 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 SystemData Response 
- 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
- ForwardingRule State Enabled 
- Enabled
- ForwardingRule State Disabled 
- 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.
- CreatedBy stringType 
- The type of identity that created the resource.
- LastModified stringAt 
- The type of identity that last modified the resource.
- LastModified stringBy 
- The identity that last modified the resource.
- LastModified stringBy Type 
- 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.
- CreatedBy stringType 
- The type of identity that created the resource.
- LastModified stringAt 
- The type of identity that last modified the resource.
- LastModified stringBy 
- The identity that last modified the resource.
- LastModified stringBy Type 
- 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.
- createdBy StringType 
- The type of identity that created the resource.
- lastModified StringAt 
- The type of identity that last modified the resource.
- lastModified StringBy 
- The identity that last modified the resource.
- lastModified StringBy Type 
- 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.
- createdBy stringType 
- The type of identity that created the resource.
- lastModified stringAt 
- The type of identity that last modified the resource.
- lastModified stringBy 
- The identity that last modified the resource.
- lastModified stringBy Type 
- 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_ strtype 
- The type of identity that created the resource.
- last_modified_ strat 
- The type of identity that last modified the resource.
- last_modified_ strby 
- The identity that last modified the resource.
- last_modified_ strby_ type 
- 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.
- createdBy StringType 
- The type of identity that created the resource.
- lastModified StringAt 
- The type of identity that last modified the resource.
- lastModified StringBy 
- The identity that last modified the resource.
- lastModified StringBy Type 
- The type of identity that last modified the resource.
TargetDnsServer, TargetDnsServerArgs      
- ip_address str
- DNS server IP address.
- port int
- DNS server port.
TargetDnsServerResponse, TargetDnsServerResponseArgs        
- ip_address str
- DNS server IP address.
- port int
- 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