1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. alikafka
  5. ConsumerGroup
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

alicloud.alikafka.ConsumerGroup

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi

    Provides an ALIKAFKA consumer group resource, see What is alikafka consumer group.

    NOTE: Available since v1.56.0.

    NOTE: Only the following regions support create alikafka consumer group. [cn-hangzhou,cn-beijing,cn-shenzhen,cn-shanghai,cn-qingdao,cn-hongkong,cn-huhehaote,cn-zhangjiakou,cn-chengdu,cn-heyuan,ap-southeast-1,ap-southeast-3,ap-southeast-5,ap-northeast-1,eu-central-1,eu-west-1,us-west-1,us-east-1]

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    import * as random from "@pulumi/random";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf-example";
    const defaultInteger = new random.index.Integer("default", {
        min: 10000,
        max: 99999,
    });
    const default = alicloud.getZones({
        availableResourceCreation: "VSwitch",
    });
    const defaultNetwork = new alicloud.vpc.Network("default", {cidrBlock: "172.16.0.0/12"});
    const defaultSwitch = new alicloud.vpc.Switch("default", {
        vpcId: defaultNetwork.id,
        cidrBlock: "172.16.0.0/24",
        zoneId: _default.then(_default => _default.zones?.[0]?.id),
    });
    const defaultSecurityGroup = new alicloud.ecs.SecurityGroup("default", {vpcId: defaultNetwork.id});
    const defaultInstance = new alicloud.alikafka.Instance("default", {
        name: `${name}-${defaultInteger.result}`,
        partitionNum: 50,
        diskType: 1,
        diskSize: 500,
        deployType: 5,
        ioMax: 20,
        vswitchId: defaultSwitch.id,
        securityGroup: defaultSecurityGroup.id,
    });
    const defaultConsumerGroup = new alicloud.alikafka.ConsumerGroup("default", {
        consumerId: name,
        instanceId: defaultInstance.id,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    import pulumi_random as random
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf-example"
    default_integer = random.index.Integer("default",
        min=10000,
        max=99999)
    default = alicloud.get_zones(available_resource_creation="VSwitch")
    default_network = alicloud.vpc.Network("default", cidr_block="172.16.0.0/12")
    default_switch = alicloud.vpc.Switch("default",
        vpc_id=default_network.id,
        cidr_block="172.16.0.0/24",
        zone_id=default.zones[0].id)
    default_security_group = alicloud.ecs.SecurityGroup("default", vpc_id=default_network.id)
    default_instance = alicloud.alikafka.Instance("default",
        name=f"{name}-{default_integer['result']}",
        partition_num=50,
        disk_type=1,
        disk_size=500,
        deploy_type=5,
        io_max=20,
        vswitch_id=default_switch.id,
        security_group=default_security_group.id)
    default_consumer_group = alicloud.alikafka.ConsumerGroup("default",
        consumer_id=name,
        instance_id=default_instance.id)
    
    package main
    
    import (
    	"fmt"
    
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/alikafka"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ecs"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
    	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "tf-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		defaultInteger, err := random.NewInteger(ctx, "default", &random.IntegerArgs{
    			Min: 10000,
    			Max: 99999,
    		})
    		if err != nil {
    			return err
    		}
    		_default, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
    			AvailableResourceCreation: pulumi.StringRef("VSwitch"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		defaultNetwork, err := vpc.NewNetwork(ctx, "default", &vpc.NetworkArgs{
    			CidrBlock: pulumi.String("172.16.0.0/12"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultSwitch, err := vpc.NewSwitch(ctx, "default", &vpc.SwitchArgs{
    			VpcId:     defaultNetwork.ID(),
    			CidrBlock: pulumi.String("172.16.0.0/24"),
    			ZoneId:    pulumi.String(_default.Zones[0].Id),
    		})
    		if err != nil {
    			return err
    		}
    		defaultSecurityGroup, err := ecs.NewSecurityGroup(ctx, "default", &ecs.SecurityGroupArgs{
    			VpcId: defaultNetwork.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		defaultInstance, err := alikafka.NewInstance(ctx, "default", &alikafka.InstanceArgs{
    			Name:          pulumi.String(fmt.Sprintf("%v-%v", name, defaultInteger.Result)),
    			PartitionNum:  pulumi.Int(50),
    			DiskType:      pulumi.Int(1),
    			DiskSize:      pulumi.Int(500),
    			DeployType:    pulumi.Int(5),
    			IoMax:         pulumi.Int(20),
    			VswitchId:     defaultSwitch.ID(),
    			SecurityGroup: defaultSecurityGroup.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = alikafka.NewConsumerGroup(ctx, "default", &alikafka.ConsumerGroupArgs{
    			ConsumerId: pulumi.String(name),
    			InstanceId: defaultInstance.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    using Random = Pulumi.Random;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf-example";
        var defaultInteger = new Random.Index.Integer("default", new()
        {
            Min = 10000,
            Max = 99999,
        });
    
        var @default = AliCloud.GetZones.Invoke(new()
        {
            AvailableResourceCreation = "VSwitch",
        });
    
        var defaultNetwork = new AliCloud.Vpc.Network("default", new()
        {
            CidrBlock = "172.16.0.0/12",
        });
    
        var defaultSwitch = new AliCloud.Vpc.Switch("default", new()
        {
            VpcId = defaultNetwork.Id,
            CidrBlock = "172.16.0.0/24",
            ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id)),
        });
    
        var defaultSecurityGroup = new AliCloud.Ecs.SecurityGroup("default", new()
        {
            VpcId = defaultNetwork.Id,
        });
    
        var defaultInstance = new AliCloud.AliKafka.Instance("default", new()
        {
            Name = $"{name}-{defaultInteger.Result}",
            PartitionNum = 50,
            DiskType = 1,
            DiskSize = 500,
            DeployType = 5,
            IoMax = 20,
            VswitchId = defaultSwitch.Id,
            SecurityGroup = defaultSecurityGroup.Id,
        });
    
        var defaultConsumerGroup = new AliCloud.AliKafka.ConsumerGroup("default", new()
        {
            ConsumerId = name,
            InstanceId = defaultInstance.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.random.integer;
    import com.pulumi.random.IntegerArgs;
    import com.pulumi.alicloud.AlicloudFunctions;
    import com.pulumi.alicloud.inputs.GetZonesArgs;
    import com.pulumi.alicloud.vpc.Network;
    import com.pulumi.alicloud.vpc.NetworkArgs;
    import com.pulumi.alicloud.vpc.Switch;
    import com.pulumi.alicloud.vpc.SwitchArgs;
    import com.pulumi.alicloud.ecs.SecurityGroup;
    import com.pulumi.alicloud.ecs.SecurityGroupArgs;
    import com.pulumi.alicloud.alikafka.Instance;
    import com.pulumi.alicloud.alikafka.InstanceArgs;
    import com.pulumi.alicloud.alikafka.ConsumerGroup;
    import com.pulumi.alicloud.alikafka.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) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("tf-example");
            var defaultInteger = new Integer("defaultInteger", IntegerArgs.builder()
                .min(10000)
                .max(99999)
                .build());
    
            final var default = AlicloudFunctions.getZones(GetZonesArgs.builder()
                .availableResourceCreation("VSwitch")
                .build());
    
            var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
                .cidrBlock("172.16.0.0/12")
                .build());
    
            var defaultSwitch = new Switch("defaultSwitch", SwitchArgs.builder()
                .vpcId(defaultNetwork.id())
                .cidrBlock("172.16.0.0/24")
                .zoneId(default_.zones()[0].id())
                .build());
    
            var defaultSecurityGroup = new SecurityGroup("defaultSecurityGroup", SecurityGroupArgs.builder()
                .vpcId(defaultNetwork.id())
                .build());
    
            var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
                .name(String.format("%s-%s", name,defaultInteger.result()))
                .partitionNum("50")
                .diskType("1")
                .diskSize("500")
                .deployType("5")
                .ioMax("20")
                .vswitchId(defaultSwitch.id())
                .securityGroup(defaultSecurityGroup.id())
                .build());
    
            var defaultConsumerGroup = new ConsumerGroup("defaultConsumerGroup", ConsumerGroupArgs.builder()
                .consumerId(name)
                .instanceId(defaultInstance.id())
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf-example
    resources:
      defaultInteger:
        type: random:integer
        name: default
        properties:
          min: 10000
          max: 99999
      defaultNetwork:
        type: alicloud:vpc:Network
        name: default
        properties:
          cidrBlock: 172.16.0.0/12
      defaultSwitch:
        type: alicloud:vpc:Switch
        name: default
        properties:
          vpcId: ${defaultNetwork.id}
          cidrBlock: 172.16.0.0/24
          zoneId: ${default.zones[0].id}
      defaultSecurityGroup:
        type: alicloud:ecs:SecurityGroup
        name: default
        properties:
          vpcId: ${defaultNetwork.id}
      defaultInstance:
        type: alicloud:alikafka:Instance
        name: default
        properties:
          name: ${name}-${defaultInteger.result}
          partitionNum: '50'
          diskType: '1'
          diskSize: '500'
          deployType: '5'
          ioMax: '20'
          vswitchId: ${defaultSwitch.id}
          securityGroup: ${defaultSecurityGroup.id}
      defaultConsumerGroup:
        type: alicloud:alikafka:ConsumerGroup
        name: default
        properties:
          consumerId: ${name}
          instanceId: ${defaultInstance.id}
    variables:
      default:
        fn::invoke:
          Function: alicloud:getZones
          Arguments:
            availableResourceCreation: VSwitch
    

    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,
                      consumer_id: Optional[str] = None,
                      instance_id: Optional[str] = None,
                      description: Optional[str] = None,
                      tags: Optional[Mapping[str, Any]] = 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: alicloud:alikafka: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.

    Constructor example

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

    var consumerGroupResource = new AliCloud.AliKafka.ConsumerGroup("consumerGroupResource", new()
    {
        ConsumerId = "string",
        InstanceId = "string",
        Description = "string",
        Tags = 
        {
            { "string", "any" },
        },
    });
    
    example, err := alikafka.NewConsumerGroup(ctx, "consumerGroupResource", &alikafka.ConsumerGroupArgs{
    	ConsumerId:  pulumi.String("string"),
    	InstanceId:  pulumi.String("string"),
    	Description: pulumi.String("string"),
    	Tags: pulumi.Map{
    		"string": pulumi.Any("any"),
    	},
    })
    
    var consumerGroupResource = new ConsumerGroup("consumerGroupResource", ConsumerGroupArgs.builder()
        .consumerId("string")
        .instanceId("string")
        .description("string")
        .tags(Map.of("string", "any"))
        .build());
    
    consumer_group_resource = alicloud.alikafka.ConsumerGroup("consumerGroupResource",
        consumer_id="string",
        instance_id="string",
        description="string",
        tags={
            "string": "any",
        })
    
    const consumerGroupResource = new alicloud.alikafka.ConsumerGroup("consumerGroupResource", {
        consumerId: "string",
        instanceId: "string",
        description: "string",
        tags: {
            string: "any",
        },
    });
    
    type: alicloud:alikafka:ConsumerGroup
    properties:
        consumerId: string
        description: string
        instanceId: string
        tags:
            string: any
    

    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:

    ConsumerId string
    ID of the consumer group. The length cannot exceed 64 characters.
    InstanceId string
    ID of the ALIKAFKA Instance that owns the groups.
    Description string
    The description of the resource.
    Tags Dictionary<string, object>
    A mapping of tags to assign to the resource.
    ConsumerId string
    ID of the consumer group. The length cannot exceed 64 characters.
    InstanceId string
    ID of the ALIKAFKA Instance that owns the groups.
    Description string
    The description of the resource.
    Tags map[string]interface{}
    A mapping of tags to assign to the resource.
    consumerId String
    ID of the consumer group. The length cannot exceed 64 characters.
    instanceId String
    ID of the ALIKAFKA Instance that owns the groups.
    description String
    The description of the resource.
    tags Map<String,Object>
    A mapping of tags to assign to the resource.
    consumerId string
    ID of the consumer group. The length cannot exceed 64 characters.
    instanceId string
    ID of the ALIKAFKA Instance that owns the groups.
    description string
    The description of the resource.
    tags {[key: string]: any}
    A mapping of tags to assign to the resource.
    consumer_id str
    ID of the consumer group. The length cannot exceed 64 characters.
    instance_id str
    ID of the ALIKAFKA Instance that owns the groups.
    description str
    The description of the resource.
    tags Mapping[str, Any]
    A mapping of tags to assign to the resource.
    consumerId String
    ID of the consumer group. The length cannot exceed 64 characters.
    instanceId String
    ID of the ALIKAFKA Instance that owns the groups.
    description String
    The description of the resource.
    tags Map<Any>
    A mapping of tags to assign to the resource.

    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,
            consumer_id: Optional[str] = None,
            description: Optional[str] = None,
            instance_id: Optional[str] = None,
            tags: Optional[Mapping[str, Any]] = 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:
    ConsumerId string
    ID of the consumer group. The length cannot exceed 64 characters.
    Description string
    The description of the resource.
    InstanceId string
    ID of the ALIKAFKA Instance that owns the groups.
    Tags Dictionary<string, object>
    A mapping of tags to assign to the resource.
    ConsumerId string
    ID of the consumer group. The length cannot exceed 64 characters.
    Description string
    The description of the resource.
    InstanceId string
    ID of the ALIKAFKA Instance that owns the groups.
    Tags map[string]interface{}
    A mapping of tags to assign to the resource.
    consumerId String
    ID of the consumer group. The length cannot exceed 64 characters.
    description String
    The description of the resource.
    instanceId String
    ID of the ALIKAFKA Instance that owns the groups.
    tags Map<String,Object>
    A mapping of tags to assign to the resource.
    consumerId string
    ID of the consumer group. The length cannot exceed 64 characters.
    description string
    The description of the resource.
    instanceId string
    ID of the ALIKAFKA Instance that owns the groups.
    tags {[key: string]: any}
    A mapping of tags to assign to the resource.
    consumer_id str
    ID of the consumer group. The length cannot exceed 64 characters.
    description str
    The description of the resource.
    instance_id str
    ID of the ALIKAFKA Instance that owns the groups.
    tags Mapping[str, Any]
    A mapping of tags to assign to the resource.
    consumerId String
    ID of the consumer group. The length cannot exceed 64 characters.
    description String
    The description of the resource.
    instanceId String
    ID of the ALIKAFKA Instance that owns the groups.
    tags Map<Any>
    A mapping of tags to assign to the resource.

    Import

    ALIKAFKA GROUP can be imported using the id, e.g.

    $ pulumi import alicloud:alikafka/consumerGroup:ConsumerGroup group alikafka_post-cn-123455abc:consumerId
    

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

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.57.1 published on Wednesday, Jun 26, 2024 by Pulumi