Route

Manages an IotHub Route

NOTE: Routes can be defined either directly on the azure.iot.IoTHub resource, or using the azure.iot.Route resource - but the two cannot be used together. If both are used against the same IoTHub, spurious changes will occur.

Example Usage

Coming soon!

Coming soon!

package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.storage.Account;
import com.pulumi.azure.storage.AccountArgs;
import com.pulumi.azure.storage.Container;
import com.pulumi.azure.storage.ContainerArgs;
import com.pulumi.azure.iot.IoTHub;
import com.pulumi.azure.iot.IoTHubArgs;
import com.pulumi.azure.iot.inputs.IoTHubSkuArgs;
import com.pulumi.azure.iot.EndpointStorageContainer;
import com.pulumi.azure.iot.EndpointStorageContainerArgs;
import com.pulumi.azure.iot.Route;
import com.pulumi.azure.iot.RouteArgs;
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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()        
            .location("West Europe")
            .build());

        var exampleAccount = new Account("exampleAccount", AccountArgs.builder()        
            .resourceGroupName(exampleResourceGroup.name())
            .location(exampleResourceGroup.location())
            .accountTier("Standard")
            .accountReplicationType("LRS")
            .build());

        var exampleContainer = new Container("exampleContainer", ContainerArgs.builder()        
            .storageAccountName(exampleAccount.name())
            .containerAccessType("private")
            .build());

        var exampleIoTHub = new IoTHub("exampleIoTHub", IoTHubArgs.builder()        
            .resourceGroupName(exampleResourceGroup.name())
            .location(exampleResourceGroup.location())
            .sku(IoTHubSkuArgs.builder()
                .name("S1")
                .capacity("1")
                .build())
            .tags(Map.of("purpose", "testing"))
            .build());

        var exampleEndpointStorageContainer = new EndpointStorageContainer("exampleEndpointStorageContainer", EndpointStorageContainerArgs.builder()        
            .resourceGroupName(exampleResourceGroup.name())
            .iothubId(exampleIoTHub.id())
            .connectionString(exampleAccount.primaryBlobConnectionString())
            .batchFrequencyInSeconds(60)
            .maxChunkSizeInBytes(10485760)
            .containerName(exampleContainer.name())
            .encoding("Avro")
            .fileNameFormat("{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}")
            .build());

        var exampleRoute = new Route("exampleRoute", RouteArgs.builder()        
            .resourceGroupName(exampleResourceGroup.name())
            .iothubName(exampleIoTHub.name())
            .source("DeviceMessages")
            .condition("true")
            .endpointNames(exampleEndpointStorageContainer.name())
            .enabled(true)
            .build());

    }
}

Coming soon!

Coming soon!

resources:
  exampleResourceGroup:
    type: azure:core:ResourceGroup
    properties:
      location: West Europe
  exampleAccount:
    type: azure:storage:Account
    properties:
      resourceGroupName: ${exampleResourceGroup.name}
      location: ${exampleResourceGroup.location}
      accountTier: Standard
      accountReplicationType: LRS
  exampleContainer:
    type: azure:storage:Container
    properties:
      storageAccountName: ${exampleAccount.name}
      containerAccessType: private
  exampleIoTHub:
    type: azure:iot:IoTHub
    properties:
      resourceGroupName: ${exampleResourceGroup.name}
      location: ${exampleResourceGroup.location}
      sku:
        name: S1
        capacity: 1
      tags:
        purpose: testing
  exampleEndpointStorageContainer:
    type: azure:iot:EndpointStorageContainer
    properties:
      resourceGroupName: ${exampleResourceGroup.name}
      iothubId: ${exampleIoTHub.id}
      connectionString: ${exampleAccount.primaryBlobConnectionString}
      batchFrequencyInSeconds: 60
      maxChunkSizeInBytes: 1.048576e+07
      containerName: ${exampleContainer.name}
      encoding: Avro
      fileNameFormat: '{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}'
  exampleRoute:
    type: azure:iot:Route
    properties:
      resourceGroupName: ${exampleResourceGroup.name}
      iothubName: ${exampleIoTHub.name}
      source: DeviceMessages
      condition: true
      endpointNames:
        - ${exampleEndpointStorageContainer.name}
      enabled: true

Create Route Resource

new Route(name: string, args: RouteArgs, opts?: CustomResourceOptions);
@overload
def Route(resource_name: str,
          opts: Optional[ResourceOptions] = None,
          condition: Optional[str] = None,
          enabled: Optional[bool] = None,
          endpoint_names: Optional[str] = None,
          iothub_name: Optional[str] = None,
          name: Optional[str] = None,
          resource_group_name: Optional[str] = None,
          source: Optional[str] = None)
@overload
def Route(resource_name: str,
          args: RouteArgs,
          opts: Optional[ResourceOptions] = None)
func NewRoute(ctx *Context, name string, args RouteArgs, opts ...ResourceOption) (*Route, error)
public Route(string name, RouteArgs args, CustomResourceOptions? opts = null)
public Route(String name, RouteArgs args)
public Route(String name, RouteArgs args, CustomResourceOptions options)
type: azure:iot:Route
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args RouteArgs
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 RouteArgs
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 RouteArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args RouteArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args RouteArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Route 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 Route resource accepts the following input properties:

Enabled bool

Specifies whether a route is enabled.

EndpointNames string

The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed.

IothubName string

The name of the IoTHub to which this Route belongs. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group under which the IotHub Route resource has to be created. Changing this forces a new resource to be created.

Source string

The source that the routing rule is to be applied to. Possible values include: DeviceConnectionStateEvents, DeviceJobLifecycleEvents, DeviceLifecycleEvents, DeviceMessages, DigitalTwinChangeEvents, Invalid, TwinChangeEvents. Defaults to DeviceMessages.

Condition string

The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language.

Name string

The name of the route. Changing this forces a new resource to be created.

Enabled bool

Specifies whether a route is enabled.

EndpointNames string

The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed.

IothubName string

The name of the IoTHub to which this Route belongs. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group under which the IotHub Route resource has to be created. Changing this forces a new resource to be created.

Source string

The source that the routing rule is to be applied to. Possible values include: DeviceConnectionStateEvents, DeviceJobLifecycleEvents, DeviceLifecycleEvents, DeviceMessages, DigitalTwinChangeEvents, Invalid, TwinChangeEvents. Defaults to DeviceMessages.

Condition string

The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language.

Name string

The name of the route. Changing this forces a new resource to be created.

enabled Boolean

Specifies whether a route is enabled.

endpointNames String

The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed.

iothubName String

The name of the IoTHub to which this Route belongs. Changing this forces a new resource to be created.

resourceGroupName String

The name of the resource group under which the IotHub Route resource has to be created. Changing this forces a new resource to be created.

source String

The source that the routing rule is to be applied to. Possible values include: DeviceConnectionStateEvents, DeviceJobLifecycleEvents, DeviceLifecycleEvents, DeviceMessages, DigitalTwinChangeEvents, Invalid, TwinChangeEvents. Defaults to DeviceMessages.

condition String

The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language.

name String

The name of the route. Changing this forces a new resource to be created.

enabled boolean

Specifies whether a route is enabled.

endpointNames string

The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed.

iothubName string

The name of the IoTHub to which this Route belongs. Changing this forces a new resource to be created.

resourceGroupName string

The name of the resource group under which the IotHub Route resource has to be created. Changing this forces a new resource to be created.

source string

The source that the routing rule is to be applied to. Possible values include: DeviceConnectionStateEvents, DeviceJobLifecycleEvents, DeviceLifecycleEvents, DeviceMessages, DigitalTwinChangeEvents, Invalid, TwinChangeEvents. Defaults to DeviceMessages.

condition string

The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language.

name string

The name of the route. Changing this forces a new resource to be created.

enabled bool

Specifies whether a route is enabled.

endpoint_names str

The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed.

iothub_name str

The name of the IoTHub to which this Route belongs. Changing this forces a new resource to be created.

resource_group_name str

The name of the resource group under which the IotHub Route resource has to be created. Changing this forces a new resource to be created.

source str

The source that the routing rule is to be applied to. Possible values include: DeviceConnectionStateEvents, DeviceJobLifecycleEvents, DeviceLifecycleEvents, DeviceMessages, DigitalTwinChangeEvents, Invalid, TwinChangeEvents. Defaults to DeviceMessages.

condition str

The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language.

name str

The name of the route. Changing this forces a new resource to be created.

enabled Boolean

Specifies whether a route is enabled.

endpointNames String

The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed.

iothubName String

The name of the IoTHub to which this Route belongs. Changing this forces a new resource to be created.

resourceGroupName String

The name of the resource group under which the IotHub Route resource has to be created. Changing this forces a new resource to be created.

source String

The source that the routing rule is to be applied to. Possible values include: DeviceConnectionStateEvents, DeviceJobLifecycleEvents, DeviceLifecycleEvents, DeviceMessages, DigitalTwinChangeEvents, Invalid, TwinChangeEvents. Defaults to DeviceMessages.

condition String

The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language.

name String

The name of the route. Changing this forces a new resource to be created.

Outputs

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

Id string

The provider-assigned unique ID for this managed resource.

Id string

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

id string

The provider-assigned unique ID for this managed resource.

id str

The provider-assigned unique ID for this managed resource.

id String

The provider-assigned unique ID for this managed resource.

Look up Existing Route Resource

Get an existing Route resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: RouteState, opts?: CustomResourceOptions): Route
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        condition: Optional[str] = None,
        enabled: Optional[bool] = None,
        endpoint_names: Optional[str] = None,
        iothub_name: Optional[str] = None,
        name: Optional[str] = None,
        resource_group_name: Optional[str] = None,
        source: Optional[str] = None) -> Route
func GetRoute(ctx *Context, name string, id IDInput, state *RouteState, opts ...ResourceOption) (*Route, error)
public static Route Get(string name, Input<string> id, RouteState? state, CustomResourceOptions? opts = null)
public static Route get(String name, Output<String> id, RouteState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Condition string

The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language.

Enabled bool

Specifies whether a route is enabled.

EndpointNames string

The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed.

IothubName string

The name of the IoTHub to which this Route belongs. Changing this forces a new resource to be created.

Name string

The name of the route. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group under which the IotHub Route resource has to be created. Changing this forces a new resource to be created.

Source string

The source that the routing rule is to be applied to. Possible values include: DeviceConnectionStateEvents, DeviceJobLifecycleEvents, DeviceLifecycleEvents, DeviceMessages, DigitalTwinChangeEvents, Invalid, TwinChangeEvents. Defaults to DeviceMessages.

Condition string

The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language.

Enabled bool

Specifies whether a route is enabled.

EndpointNames string

The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed.

IothubName string

The name of the IoTHub to which this Route belongs. Changing this forces a new resource to be created.

Name string

The name of the route. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group under which the IotHub Route resource has to be created. Changing this forces a new resource to be created.

Source string

The source that the routing rule is to be applied to. Possible values include: DeviceConnectionStateEvents, DeviceJobLifecycleEvents, DeviceLifecycleEvents, DeviceMessages, DigitalTwinChangeEvents, Invalid, TwinChangeEvents. Defaults to DeviceMessages.

condition String

The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language.

enabled Boolean

Specifies whether a route is enabled.

endpointNames String

The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed.

iothubName String

The name of the IoTHub to which this Route belongs. Changing this forces a new resource to be created.

name String

The name of the route. Changing this forces a new resource to be created.

resourceGroupName String

The name of the resource group under which the IotHub Route resource has to be created. Changing this forces a new resource to be created.

source String

The source that the routing rule is to be applied to. Possible values include: DeviceConnectionStateEvents, DeviceJobLifecycleEvents, DeviceLifecycleEvents, DeviceMessages, DigitalTwinChangeEvents, Invalid, TwinChangeEvents. Defaults to DeviceMessages.

condition string

The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language.

enabled boolean

Specifies whether a route is enabled.

endpointNames string

The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed.

iothubName string

The name of the IoTHub to which this Route belongs. Changing this forces a new resource to be created.

name string

The name of the route. Changing this forces a new resource to be created.

resourceGroupName string

The name of the resource group under which the IotHub Route resource has to be created. Changing this forces a new resource to be created.

source string

The source that the routing rule is to be applied to. Possible values include: DeviceConnectionStateEvents, DeviceJobLifecycleEvents, DeviceLifecycleEvents, DeviceMessages, DigitalTwinChangeEvents, Invalid, TwinChangeEvents. Defaults to DeviceMessages.

condition str

The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language.

enabled bool

Specifies whether a route is enabled.

endpoint_names str

The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed.

iothub_name str

The name of the IoTHub to which this Route belongs. Changing this forces a new resource to be created.

name str

The name of the route. Changing this forces a new resource to be created.

resource_group_name str

The name of the resource group under which the IotHub Route resource has to be created. Changing this forces a new resource to be created.

source str

The source that the routing rule is to be applied to. Possible values include: DeviceConnectionStateEvents, DeviceJobLifecycleEvents, DeviceLifecycleEvents, DeviceMessages, DigitalTwinChangeEvents, Invalid, TwinChangeEvents. Defaults to DeviceMessages.

condition String

The condition that is evaluated to apply the routing rule. If no condition is provided, it evaluates to true by default. For grammar, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-query-language.

enabled Boolean

Specifies whether a route is enabled.

endpointNames String

The list of endpoints to which messages that satisfy the condition are routed. Currently only one endpoint is allowed.

iothubName String

The name of the IoTHub to which this Route belongs. Changing this forces a new resource to be created.

name String

The name of the route. Changing this forces a new resource to be created.

resourceGroupName String

The name of the resource group under which the IotHub Route resource has to be created. Changing this forces a new resource to be created.

source String

The source that the routing rule is to be applied to. Possible values include: DeviceConnectionStateEvents, DeviceJobLifecycleEvents, DeviceLifecycleEvents, DeviceMessages, DigitalTwinChangeEvents, Invalid, TwinChangeEvents. Defaults to DeviceMessages.

Import

IoTHub Route can be imported using the resource id, e.g.

 $ pulumi import azure:iot/route:Route route1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/IotHubs/hub1/Routes/route1

Package Details

Repository
https://github.com/pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.