azure logo
Azure Classic v5.37.0, Mar 15 23

azure.iot.ConsumerGroup

Manages a Consumer Group within an IotHub

Example Usage

using System.Collections.Generic;
using Pulumi;
using Azure = Pulumi.Azure;

return await Deployment.RunAsync(() => 
{
    var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
    {
        Location = "West Europe",
    });

    var exampleIoTHub = new Azure.Iot.IoTHub("exampleIoTHub", new()
    {
        ResourceGroupName = exampleResourceGroup.Name,
        Location = exampleResourceGroup.Location,
        Sku = new Azure.Iot.Inputs.IoTHubSkuArgs
        {
            Name = "S1",
            Capacity = 1,
        },
        Tags = 
        {
            { "purpose", "testing" },
        },
    });

    var exampleConsumerGroup = new Azure.Iot.ConsumerGroup("exampleConsumerGroup", new()
    {
        IothubName = exampleIoTHub.Name,
        EventhubEndpointName = "events",
        ResourceGroupName = exampleResourceGroup.Name,
    });

});
package main

import (
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/iot"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleResourceGroup, err := core.NewResourceGroup(ctx, "exampleResourceGroup", &core.ResourceGroupArgs{
			Location: pulumi.String("West Europe"),
		})
		if err != nil {
			return err
		}
		exampleIoTHub, err := iot.NewIoTHub(ctx, "exampleIoTHub", &iot.IoTHubArgs{
			ResourceGroupName: exampleResourceGroup.Name,
			Location:          exampleResourceGroup.Location,
			Sku: &iot.IoTHubSkuArgs{
				Name:     pulumi.String("S1"),
				Capacity: pulumi.Int(1),
			},
			Tags: pulumi.StringMap{
				"purpose": pulumi.String("testing"),
			},
		})
		if err != nil {
			return err
		}
		_, err = iot.NewConsumerGroup(ctx, "exampleConsumerGroup", &iot.ConsumerGroupArgs{
			IothubName:           exampleIoTHub.Name,
			EventhubEndpointName: pulumi.String("events"),
			ResourceGroupName:    exampleResourceGroup.Name,
		})
		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.azure.core.ResourceGroup;
import com.pulumi.azure.core.ResourceGroupArgs;
import com.pulumi.azure.iot.IoTHub;
import com.pulumi.azure.iot.IoTHubArgs;
import com.pulumi.azure.iot.inputs.IoTHubSkuArgs;
import com.pulumi.azure.iot.ConsumerGroup;
import com.pulumi.azure.iot.ConsumerGroupArgs;
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 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 exampleConsumerGroup = new ConsumerGroup("exampleConsumerGroup", ConsumerGroupArgs.builder()        
            .iothubName(exampleIoTHub.name())
            .eventhubEndpointName("events")
            .resourceGroupName(exampleResourceGroup.name())
            .build());

    }
}
import pulumi
import pulumi_azure as azure

example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_io_t_hub = azure.iot.IoTHub("exampleIoTHub",
    resource_group_name=example_resource_group.name,
    location=example_resource_group.location,
    sku=azure.iot.IoTHubSkuArgs(
        name="S1",
        capacity=1,
    ),
    tags={
        "purpose": "testing",
    })
example_consumer_group = azure.iot.ConsumerGroup("exampleConsumerGroup",
    iothub_name=example_io_t_hub.name,
    eventhub_endpoint_name="events",
    resource_group_name=example_resource_group.name)
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const exampleIoTHub = new azure.iot.IoTHub("exampleIoTHub", {
    resourceGroupName: exampleResourceGroup.name,
    location: exampleResourceGroup.location,
    sku: {
        name: "S1",
        capacity: 1,
    },
    tags: {
        purpose: "testing",
    },
});
const exampleConsumerGroup = new azure.iot.ConsumerGroup("exampleConsumerGroup", {
    iothubName: exampleIoTHub.name,
    eventhubEndpointName: "events",
    resourceGroupName: exampleResourceGroup.name,
});
resources:
  exampleResourceGroup:
    type: azure:core:ResourceGroup
    properties:
      location: West Europe
  exampleIoTHub:
    type: azure:iot:IoTHub
    properties:
      resourceGroupName: ${exampleResourceGroup.name}
      location: ${exampleResourceGroup.location}
      sku:
        name: S1
        capacity: '1'
      tags:
        purpose: testing
  exampleConsumerGroup:
    type: azure:iot:ConsumerGroup
    properties:
      iothubName: ${exampleIoTHub.name}
      eventhubEndpointName: events
      resourceGroupName: ${exampleResourceGroup.name}

Create ConsumerGroup Resource

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

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

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

EventhubEndpointName string

The name of the Event Hub-compatible endpoint in the IoT hub. Changing this forces a new resource to be created.

IothubName string

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

ResourceGroupName string

The name of the resource group that contains the IoT hub. Changing this forces a new resource to be created.

Name string

The name of this Consumer Group. Changing this forces a new resource to be created.

EventhubEndpointName string

The name of the Event Hub-compatible endpoint in the IoT hub. Changing this forces a new resource to be created.

IothubName string

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

ResourceGroupName string

The name of the resource group that contains the IoT hub. Changing this forces a new resource to be created.

Name string

The name of this Consumer Group. Changing this forces a new resource to be created.

eventhubEndpointName String

The name of the Event Hub-compatible endpoint in the IoT hub. Changing this forces a new resource to be created.

iothubName String

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

resourceGroupName String

The name of the resource group that contains the IoT hub. Changing this forces a new resource to be created.

name String

The name of this Consumer Group. Changing this forces a new resource to be created.

eventhubEndpointName string

The name of the Event Hub-compatible endpoint in the IoT hub. Changing this forces a new resource to be created.

iothubName string

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

resourceGroupName string

The name of the resource group that contains the IoT hub. Changing this forces a new resource to be created.

name string

The name of this Consumer Group. Changing this forces a new resource to be created.

eventhub_endpoint_name str

The name of the Event Hub-compatible endpoint in the IoT hub. Changing this forces a new resource to be created.

iothub_name str

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

resource_group_name str

The name of the resource group that contains the IoT hub. Changing this forces a new resource to be created.

name str

The name of this Consumer Group. Changing this forces a new resource to be created.

eventhubEndpointName String

The name of the Event Hub-compatible endpoint in the IoT hub. Changing this forces a new resource to be created.

iothubName String

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

resourceGroupName String

The name of the resource group that contains the IoT hub. Changing this forces a new resource to be created.

name String

The name of this Consumer Group. Changing this forces a new resource to be created.

Outputs

All input properties are implicitly available as output properties. Additionally, the ConsumerGroup 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 ConsumerGroup Resource

Get an existing ConsumerGroup 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?: ConsumerGroupState, opts?: CustomResourceOptions): ConsumerGroup
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        eventhub_endpoint_name: Optional[str] = None,
        iothub_name: Optional[str] = None,
        name: Optional[str] = None,
        resource_group_name: Optional[str] = None) -> ConsumerGroup
func GetConsumerGroup(ctx *Context, name string, id IDInput, state *ConsumerGroupState, opts ...ResourceOption) (*ConsumerGroup, error)
public static ConsumerGroup Get(string name, Input<string> id, ConsumerGroupState? state, CustomResourceOptions? opts = null)
public static ConsumerGroup get(String name, Output<String> id, ConsumerGroupState 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:
EventhubEndpointName string

The name of the Event Hub-compatible endpoint in the IoT hub. Changing this forces a new resource to be created.

IothubName string

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

Name string

The name of this Consumer Group. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group that contains the IoT hub. Changing this forces a new resource to be created.

EventhubEndpointName string

The name of the Event Hub-compatible endpoint in the IoT hub. Changing this forces a new resource to be created.

IothubName string

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

Name string

The name of this Consumer Group. Changing this forces a new resource to be created.

ResourceGroupName string

The name of the resource group that contains the IoT hub. Changing this forces a new resource to be created.

eventhubEndpointName String

The name of the Event Hub-compatible endpoint in the IoT hub. Changing this forces a new resource to be created.

iothubName String

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

name String

The name of this Consumer Group. Changing this forces a new resource to be created.

resourceGroupName String

The name of the resource group that contains the IoT hub. Changing this forces a new resource to be created.

eventhubEndpointName string

The name of the Event Hub-compatible endpoint in the IoT hub. Changing this forces a new resource to be created.

iothubName string

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

name string

The name of this Consumer Group. Changing this forces a new resource to be created.

resourceGroupName string

The name of the resource group that contains the IoT hub. Changing this forces a new resource to be created.

eventhub_endpoint_name str

The name of the Event Hub-compatible endpoint in the IoT hub. Changing this forces a new resource to be created.

iothub_name str

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

name str

The name of this Consumer Group. Changing this forces a new resource to be created.

resource_group_name str

The name of the resource group that contains the IoT hub. Changing this forces a new resource to be created.

eventhubEndpointName String

The name of the Event Hub-compatible endpoint in the IoT hub. Changing this forces a new resource to be created.

iothubName String

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

name String

The name of this Consumer Group. Changing this forces a new resource to be created.

resourceGroupName String

The name of the resource group that contains the IoT hub. Changing this forces a new resource to be created.

Import

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

 $ pulumi import azure:iot/consumerGroup:ConsumerGroup group1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Devices/iotHubs/hub1/eventHubEndpoints/events/consumerGroups/group1

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.