IoTHub

class IoTHub : KotlinCustomResource

Manages an IotHub

NOTE: Endpoints can be defined either directly on the azure.iot.IoTHub resource, or using the azurerm_iothub_endpoint_* resources - but the two ways of defining the endpoints cannot be used together. If both are used against the same IoTHub, spurious changes will occur. Also, defining a azurerm_iothub_endpoint_* resource and another endpoint of a different type directly on the azure.iot.IoTHub resource is not supported. 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. NOTE: Enrichments can be defined either directly on the azure.iot.IoTHub resource, or using the azure.iot.Enrichment resource - but the two cannot be used together. If both are used against the same IoTHub, spurious changes will occur. NOTE: Fallback route can be defined either directly on the azure.iot.IoTHub resource, or using the azure.iot.FallbackRoute resource - but the two cannot be used together. If both are used against the same IoTHub, spurious changes will occur. NOTE: File upload can be defined either directly on the azure.iot.IoTHub resource, or using the azure.iot.FileUpload resource - but the two cannot be used together. If both are used against the same IoTHub, spurious changes will occur.

Example Usage

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.eventhub.EventHubNamespace;
import com.pulumi.azure.eventhub.EventHubNamespaceArgs;
import com.pulumi.azure.eventhub.EventHub;
import com.pulumi.azure.eventhub.EventHubArgs;
import com.pulumi.azure.eventhub.AuthorizationRule;
import com.pulumi.azure.eventhub.AuthorizationRuleArgs;
import com.pulumi.azure.iot.IoTHub;
import com.pulumi.azure.iot.IoTHubArgs;
import com.pulumi.azure.iot.inputs.IoTHubSkuArgs;
import com.pulumi.azure.iot.inputs.IoTHubEndpointArgs;
import com.pulumi.azure.iot.inputs.IoTHubRouteArgs;
import com.pulumi.azure.iot.inputs.IoTHubEnrichmentArgs;
import com.pulumi.azure.iot.inputs.IoTHubCloudToDeviceArgs;
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 exampleEventHubNamespace = new EventHubNamespace("exampleEventHubNamespace", EventHubNamespaceArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.sku("Basic")
.build());
var exampleEventHub = new EventHub("exampleEventHub", EventHubArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.namespaceName(exampleEventHubNamespace.name())
.partitionCount(2)
.messageRetention(1)
.build());
var exampleAuthorizationRule = new AuthorizationRule("exampleAuthorizationRule", AuthorizationRuleArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.namespaceName(exampleEventHubNamespace.name())
.eventhubName(exampleEventHub.name())
.send(true)
.build());
var exampleIoTHub = new IoTHub("exampleIoTHub", IoTHubArgs.builder()
.resourceGroupName(exampleResourceGroup.name())
.location(exampleResourceGroup.location())
.localAuthenticationEnabled(false)
.sku(IoTHubSkuArgs.builder()
.name("S1")
.capacity("1")
.build())
.endpoints(
IoTHubEndpointArgs.builder()
.type("AzureIotHub.StorageContainer")
.connectionString(exampleAccount.primaryBlobConnectionString())
.name("export")
.batchFrequencyInSeconds(60)
.maxChunkSizeInBytes(10485760)
.containerName(exampleContainer.name())
.encoding("Avro")
.fileNameFormat("{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}")
.build(),
IoTHubEndpointArgs.builder()
.type("AzureIotHub.EventHub")
.connectionString(exampleAuthorizationRule.primaryConnectionString())
.name("export2")
.build())
.routes(
IoTHubRouteArgs.builder()
.name("export")
.source("DeviceMessages")
.condition("true")
.endpointNames("export")
.enabled(true)
.build(),
IoTHubRouteArgs.builder()
.name("export2")
.source("DeviceMessages")
.condition("true")
.endpointNames("export2")
.enabled(true)
.build())
.enrichments(IoTHubEnrichmentArgs.builder()
.key("tenant")
.value("$twin.tags.Tenant")
.endpointNames(
"export",
"export2")
.build())
.cloudToDevice(IoTHubCloudToDeviceArgs.builder()
.maxDeliveryCount(30)
.defaultTtl("PT1H")
.feedbacks(IoTHubCloudToDeviceFeedbackArgs.builder()
.timeToLive("PT1H10M")
.maxDeliveryCount(15)
.lockDuration("PT30S")
.build())
.build())
.tags(Map.of("purpose", "testing"))
.build());
}
}

Import

IoTHubs can be imported using the resource id, e.g.

$ pulumi import azure:iot/ioTHub:IoTHub hub1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/iotHubs/hub1

Properties

Link copied to clipboard

A cloud_to_device block as defined below.

Link copied to clipboard

An endpoint block as defined below.

Link copied to clipboard

A enrichment block as defined below.

Link copied to clipboard

The EventHub compatible endpoint for events data

Link copied to clipboard

The EventHub namespace for events data

Link copied to clipboard

The EventHub compatible path for events data

Link copied to clipboard

The EventHub compatible endpoint for operational data

Link copied to clipboard

The EventHub compatible path for operational data

Link copied to clipboard

The number of device-to-cloud partitions used by backing event hubs. Must be between 2 and 128.

Link copied to clipboard

The event hub retention to use in days. Must be between 1 and 7.

Link copied to clipboard

A fallback_route block as defined below. If the fallback route is enabled, messages that don't match any of the supplied routes are automatically sent to this route. Defaults to messages/events.

Link copied to clipboard

A file_upload block as defined below.

Link copied to clipboard
val hostname: Output<String>

The hostname of the IotHub Resource.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val identity: Output<IoTHubIdentity>?

An identity block as defined below.

Link copied to clipboard

If false, SAS tokens with Iot hub scoped SAS keys cannot be used for authentication. Defaults to true.

Link copied to clipboard
val location: Output<String>

Specifies the supported Azure location where the resource has to be created. Changing this forces a new resource to be created.

Link copied to clipboard
val minTlsVersion: Output<String>?

Specifies the minimum TLS version to support for this hub. The only valid value is 1.2. Changing this forces a new resource to be created.

Link copied to clipboard
val name: Output<String>

Specifies the name of the IotHub resource. Changing this forces a new resource to be created.

Link copied to clipboard

A network_rule_set block as defined below.

Link copied to clipboard

Is the IotHub resource accessible from a public network?

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

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

Link copied to clipboard
val routes: Output<List<IoTHubRoute>>

A route block as defined below.

Link copied to clipboard

One or more shared_access_policy blocks as defined below.

Link copied to clipboard
val sku: Output<IoTHubSku>

A sku block as defined below.

Link copied to clipboard
val tags: Output<Map<String, String>>?

A mapping of tags to assign to the resource.

Link copied to clipboard
val type: Output<String>

The type of the endpoint. Possible values are AzureIotHub.StorageContainer, AzureIotHub.ServiceBusQueue, AzureIotHub.ServiceBusTopic or AzureIotHub.EventHub.

Link copied to clipboard
val urn: Output<String>