alicloud logo
Alibaba Cloud v3.34.0, Mar 17 23

alicloud.alikafka.ConsumerGroup

Provides an ALIKAFKA consumer group resource.

NOTE: Available in 1.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-south-1,ap-northeast-1,eu-central-1,eu-west-1,us-west-1,us-east-1]

Example Usage

Basic Usage

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

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var consumerId = config.Get("consumerId") ?? "CID-alikafkaGroupDatasourceName";
    var defaultZones = AliCloud.GetZones.Invoke(new()
    {
        AvailableResourceCreation = "VSwitch",
    });

    var defaultNetwork = new AliCloud.Vpc.Network("defaultNetwork", new()
    {
        CidrBlock = "172.16.0.0/12",
    });

    var defaultSwitch = new AliCloud.Vpc.Switch("defaultSwitch", new()
    {
        VpcId = defaultNetwork.Id,
        CidrBlock = "172.16.0.0/24",
        ZoneId = defaultZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
    });

    var defaultInstance = new AliCloud.AliKafka.Instance("defaultInstance", new()
    {
        PartitionNum = 50,
        DiskType = 1,
        DiskSize = 500,
        DeployType = 5,
        IoMax = 20,
        VswitchId = defaultSwitch.Id,
    });

    var defaultConsumerGroup = new AliCloud.AliKafka.ConsumerGroup("defaultConsumerGroup", new()
    {
        ConsumerId = consumerId,
        InstanceId = defaultInstance.Id,
    });

});
package main

import (
	"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/vpc"
	"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, "")
		consumerId := "CID-alikafkaGroupDatasourceName"
		if param := cfg.Get("consumerId"); param != "" {
			consumerId = param
		}
		defaultZones, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
			AvailableResourceCreation: pulumi.StringRef("VSwitch"),
		}, nil)
		if err != nil {
			return err
		}
		defaultNetwork, err := vpc.NewNetwork(ctx, "defaultNetwork", &vpc.NetworkArgs{
			CidrBlock: pulumi.String("172.16.0.0/12"),
		})
		if err != nil {
			return err
		}
		defaultSwitch, err := vpc.NewSwitch(ctx, "defaultSwitch", &vpc.SwitchArgs{
			VpcId:     defaultNetwork.ID(),
			CidrBlock: pulumi.String("172.16.0.0/24"),
			ZoneId:    *pulumi.String(defaultZones.Zones[0].Id),
		})
		if err != nil {
			return err
		}
		defaultInstance, err := alikafka.NewInstance(ctx, "defaultInstance", &alikafka.InstanceArgs{
			PartitionNum: pulumi.Int(50),
			DiskType:     pulumi.Int(1),
			DiskSize:     pulumi.Int(500),
			DeployType:   pulumi.Int(5),
			IoMax:        pulumi.Int(20),
			VswitchId:    defaultSwitch.ID(),
		})
		if err != nil {
			return err
		}
		_, err = alikafka.NewConsumerGroup(ctx, "defaultConsumerGroup", &alikafka.ConsumerGroupArgs{
			ConsumerId: pulumi.String(consumerId),
			InstanceId: defaultInstance.ID(),
		})
		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.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.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 consumerId = config.get("consumerId").orElse("CID-alikafkaGroupDatasourceName");
        final var defaultZones = 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(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
            .build());

        var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()        
            .partitionNum("50")
            .diskType("1")
            .diskSize("500")
            .deployType("5")
            .ioMax("20")
            .vswitchId(defaultSwitch.id())
            .build());

        var defaultConsumerGroup = new ConsumerGroup("defaultConsumerGroup", ConsumerGroupArgs.builder()        
            .consumerId(consumerId)
            .instanceId(defaultInstance.id())
            .build());

    }
}
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
consumer_id = config.get("consumerId")
if consumer_id is None:
    consumer_id = "CID-alikafkaGroupDatasourceName"
default_zones = alicloud.get_zones(available_resource_creation="VSwitch")
default_network = alicloud.vpc.Network("defaultNetwork", cidr_block="172.16.0.0/12")
default_switch = alicloud.vpc.Switch("defaultSwitch",
    vpc_id=default_network.id,
    cidr_block="172.16.0.0/24",
    zone_id=default_zones.zones[0].id)
default_instance = alicloud.alikafka.Instance("defaultInstance",
    partition_num=50,
    disk_type=1,
    disk_size=500,
    deploy_type=5,
    io_max=20,
    vswitch_id=default_switch.id)
default_consumer_group = alicloud.alikafka.ConsumerGroup("defaultConsumerGroup",
    consumer_id=consumer_id,
    instance_id=default_instance.id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const consumerId = config.get("consumerId") || "CID-alikafkaGroupDatasourceName";
const defaultZones = alicloud.getZones({
    availableResourceCreation: "VSwitch",
});
const defaultNetwork = new alicloud.vpc.Network("defaultNetwork", {cidrBlock: "172.16.0.0/12"});
const defaultSwitch = new alicloud.vpc.Switch("defaultSwitch", {
    vpcId: defaultNetwork.id,
    cidrBlock: "172.16.0.0/24",
    zoneId: defaultZones.then(defaultZones => defaultZones.zones?.[0]?.id),
});
const defaultInstance = new alicloud.alikafka.Instance("defaultInstance", {
    partitionNum: 50,
    diskType: 1,
    diskSize: 500,
    deployType: 5,
    ioMax: 20,
    vswitchId: defaultSwitch.id,
});
const defaultConsumerGroup = new alicloud.alikafka.ConsumerGroup("defaultConsumerGroup", {
    consumerId: consumerId,
    instanceId: defaultInstance.id,
});
configuration:
  consumerId:
    type: string
    default: CID-alikafkaGroupDatasourceName
resources:
  defaultNetwork:
    type: alicloud:vpc:Network
    properties:
      cidrBlock: 172.16.0.0/12
  defaultSwitch:
    type: alicloud:vpc:Switch
    properties:
      vpcId: ${defaultNetwork.id}
      cidrBlock: 172.16.0.0/24
      zoneId: ${defaultZones.zones[0].id}
  defaultInstance:
    type: alicloud:alikafka:Instance
    properties:
      partitionNum: '50'
      diskType: '1'
      diskSize: '500'
      deployType: '5'
      ioMax: '20'
      vswitchId: ${defaultSwitch.id}
  defaultConsumerGroup:
    type: alicloud:alikafka:ConsumerGroup
    properties:
      consumerId: ${consumerId}
      instanceId: ${defaultInstance.id}
variables:
  defaultZones:
    fn::invoke:
      Function: alicloud:getZones
      Arguments:
        availableResourceCreation: VSwitch

Create ConsumerGroup Resource

new ConsumerGroup(name: string, args: ConsumerGroupArgs, opts?: CustomResourceOptions);
@overload
def ConsumerGroup(resource_name: 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)
@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: alicloud:alikafka: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:

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

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.