1. Packages
  2. Azure Classic
  3. API Docs
  4. iot
  5. ConsumerGroup

We recommend using Azure Native.

Azure Classic v5.72.0 published on Monday, Apr 15, 2024 by Pulumi

azure.iot.ConsumerGroup

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.72.0 published on Monday, Apr 15, 2024 by Pulumi

    Manages a Consumer Group within an IotHub

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = new azure.core.ResourceGroup("example", {
        name: "example-resources",
        location: "West Europe",
    });
    const exampleIoTHub = new azure.iot.IoTHub("example", {
        name: "test",
        resourceGroupName: example.name,
        location: example.location,
        sku: {
            name: "S1",
            capacity: 1,
        },
        tags: {
            purpose: "testing",
        },
    });
    const exampleConsumerGroup = new azure.iot.ConsumerGroup("example", {
        name: "group",
        iothubName: exampleIoTHub.name,
        eventhubEndpointName: "events",
        resourceGroupName: example.name,
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.core.ResourceGroup("example",
        name="example-resources",
        location="West Europe")
    example_io_t_hub = azure.iot.IoTHub("example",
        name="test",
        resource_group_name=example.name,
        location=example.location,
        sku=azure.iot.IoTHubSkuArgs(
            name="S1",
            capacity=1,
        ),
        tags={
            "purpose": "testing",
        })
    example_consumer_group = azure.iot.ConsumerGroup("example",
        name="group",
        iothub_name=example_io_t_hub.name,
        eventhub_endpoint_name="events",
        resource_group_name=example.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 {
    		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
    			Name:     pulumi.String("example-resources"),
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleIoTHub, err := iot.NewIoTHub(ctx, "example", &iot.IoTHubArgs{
    			Name:              pulumi.String("test"),
    			ResourceGroupName: example.Name,
    			Location:          example.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, "example", &iot.ConsumerGroupArgs{
    			Name:                 pulumi.String("group"),
    			IothubName:           exampleIoTHub.Name,
    			EventhubEndpointName: pulumi.String("events"),
    			ResourceGroupName:    example.Name,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Azure.Core.ResourceGroup("example", new()
        {
            Name = "example-resources",
            Location = "West Europe",
        });
    
        var exampleIoTHub = new Azure.Iot.IoTHub("example", new()
        {
            Name = "test",
            ResourceGroupName = example.Name,
            Location = example.Location,
            Sku = new Azure.Iot.Inputs.IoTHubSkuArgs
            {
                Name = "S1",
                Capacity = 1,
            },
            Tags = 
            {
                { "purpose", "testing" },
            },
        });
    
        var exampleConsumerGroup = new Azure.Iot.ConsumerGroup("example", new()
        {
            Name = "group",
            IothubName = exampleIoTHub.Name,
            EventhubEndpointName = "events",
            ResourceGroupName = example.Name,
        });
    
    });
    
    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 example = new ResourceGroup("example", ResourceGroupArgs.builder()        
                .name("example-resources")
                .location("West Europe")
                .build());
    
            var exampleIoTHub = new IoTHub("exampleIoTHub", IoTHubArgs.builder()        
                .name("test")
                .resourceGroupName(example.name())
                .location(example.location())
                .sku(IoTHubSkuArgs.builder()
                    .name("S1")
                    .capacity("1")
                    .build())
                .tags(Map.of("purpose", "testing"))
                .build());
    
            var exampleConsumerGroup = new ConsumerGroup("exampleConsumerGroup", ConsumerGroupArgs.builder()        
                .name("group")
                .iothubName(exampleIoTHub.name())
                .eventhubEndpointName("events")
                .resourceGroupName(example.name())
                .build());
    
        }
    }
    
    resources:
      example:
        type: azure:core:ResourceGroup
        properties:
          name: example-resources
          location: West Europe
      exampleIoTHub:
        type: azure:iot:IoTHub
        name: example
        properties:
          name: test
          resourceGroupName: ${example.name}
          location: ${example.location}
          sku:
            name: S1
            capacity: '1'
          tags:
            purpose: testing
      exampleConsumerGroup:
        type: azure:iot:ConsumerGroup
        name: example
        properties:
          name: group
          iothubName: ${exampleIoTHub.name}
          eventhubEndpointName: events
          resourceGroupName: ${example.name}
    

    Create ConsumerGroup Resource

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

    Constructor syntax

    new ConsumerGroup(name: string, args: ConsumerGroupArgs, opts?: CustomResourceOptions);
    @overload
    def ConsumerGroup(resource_name: str,
                      args: ConsumerGroupArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def ConsumerGroup(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      eventhub_endpoint_name: Optional[str] = None,
                      iothub_name: Optional[str] = None,
                      resource_group_name: Optional[str] = None,
                      name: Optional[str] = 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.
    
    

    Parameters

    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.

    Example

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

    var azureConsumerGroupResource = new Azure.Iot.ConsumerGroup("azureConsumerGroupResource", new()
    {
        EventhubEndpointName = "string",
        IothubName = "string",
        ResourceGroupName = "string",
        Name = "string",
    });
    
    example, err := iot.NewConsumerGroup(ctx, "azureConsumerGroupResource", &iot.ConsumerGroupArgs{
    	EventhubEndpointName: pulumi.String("string"),
    	IothubName:           pulumi.String("string"),
    	ResourceGroupName:    pulumi.String("string"),
    	Name:                 pulumi.String("string"),
    })
    
    var azureConsumerGroupResource = new ConsumerGroup("azureConsumerGroupResource", ConsumerGroupArgs.builder()        
        .eventhubEndpointName("string")
        .iothubName("string")
        .resourceGroupName("string")
        .name("string")
        .build());
    
    azure_consumer_group_resource = azure.iot.ConsumerGroup("azureConsumerGroupResource",
        eventhub_endpoint_name="string",
        iothub_name="string",
        resource_group_name="string",
        name="string")
    
    const azureConsumerGroupResource = new azure.iot.ConsumerGroup("azureConsumerGroupResource", {
        eventhubEndpointName: "string",
        iothubName: "string",
        resourceGroupName: "string",
        name: "string",
    });
    
    type: azure:iot:ConsumerGroup
    properties:
        eventhubEndpointName: string
        iothubName: string
        name: string
        resourceGroupName: string
    

    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
    

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

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.72.0 published on Monday, Apr 15, 2024 by Pulumi