alicloud.dts.ConsumerChannel
Provides a DTS Consumer Channel resource.
For information about DTS Consumer Channel and how to use it, see What is Consumer Channel.
NOTE: Available in v1.146.0+.
Example Usage
Basic Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var config = new Config();
var name = config.Get("name") ?? "tftestdts";
var creation = config.Get("creation") ?? "Rds";
var defaultZones = AliCloud.GetZones.Invoke(new()
{
AvailableResourceCreation = creation,
});
var defaultNetworks = AliCloud.Vpc.GetNetworks.Invoke(new()
{
NameRegex = "default-NODELETING",
});
var defaultSwitches = AliCloud.Vpc.GetSwitches.Invoke(new()
{
VpcId = defaultNetworks.Apply(getNetworksResult => getNetworksResult.Ids[0]),
ZoneId = defaultZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
});
var instance = new AliCloud.Rds.Instance("instance", new()
{
Engine = "MySQL",
EngineVersion = "5.6",
InstanceType = "rds.mysql.s1.small",
InstanceStorage = 10,
VswitchId = defaultSwitches.Apply(getSwitchesResult => getSwitchesResult.Ids[0]),
InstanceName = name,
});
var db = new List<AliCloud.Rds.Database>();
for (var rangeIndex = 0; rangeIndex < 2; rangeIndex++)
{
var range = new { Value = rangeIndex };
db.Add(new AliCloud.Rds.Database($"db-{range.Value}", new()
{
InstanceId = instance.Id,
Description = "from terraform",
}));
}
var account = new AliCloud.Rds.Account("account", new()
{
DbInstanceId = instance.Id,
AccountName = "tftestprivilege",
AccountPassword = "Test12345",
AccountDescription = "from terraform",
});
var privilege = new AliCloud.Rds.AccountPrivilege("privilege", new()
{
InstanceId = instance.Id,
AccountName = account.Name,
Privilege = "ReadWrite",
DbNames = db.Select(__item => __item.Name).ToList(),
});
var defaultSubscriptionJob = new AliCloud.Dts.SubscriptionJob("defaultSubscriptionJob", new()
{
DtsJobName = name,
PaymentType = "PayAsYouGo",
SourceEndpointEngineName = "MySQL",
SourceEndpointRegion = "cn-hangzhou",
SourceEndpointInstanceType = "RDS",
SourceEndpointInstanceId = instance.Id,
SourceEndpointDatabaseName = "tfaccountpri_0",
SourceEndpointUserName = "tftestprivilege",
SourceEndpointPassword = "Test12345",
SubscriptionInstanceNetworkType = "vpc",
DbList = @" {""dtstestdata"": {""name"": ""tfaccountpri_0"", ""all"": true}}
",
SubscriptionInstanceVpcId = defaultNetworks.Apply(getNetworksResult => getNetworksResult.Ids[0]),
SubscriptionInstanceVswitchId = defaultSwitches.Apply(getSwitchesResult => getSwitchesResult.Ids[0]),
Status = "Normal",
});
var defaultConsumerChannel = new AliCloud.Dts.ConsumerChannel("defaultConsumerChannel", new()
{
DtsInstanceId = defaultSubscriptionJob.DtsInstanceId,
ConsumerGroupName = name,
ConsumerGroupUserName = name,
ConsumerGroupPassword = "tftestAcc123",
});
});
Coming soon!
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.VpcFunctions;
import com.pulumi.alicloud.vpc.inputs.GetNetworksArgs;
import com.pulumi.alicloud.vpc.inputs.GetSwitchesArgs;
import com.pulumi.alicloud.rds.Instance;
import com.pulumi.alicloud.rds.InstanceArgs;
import com.pulumi.alicloud.rds.Database;
import com.pulumi.alicloud.rds.DatabaseArgs;
import com.pulumi.alicloud.rds.Account;
import com.pulumi.alicloud.rds.AccountArgs;
import com.pulumi.alicloud.rds.AccountPrivilege;
import com.pulumi.alicloud.rds.AccountPrivilegeArgs;
import com.pulumi.alicloud.dts.SubscriptionJob;
import com.pulumi.alicloud.dts.SubscriptionJobArgs;
import com.pulumi.alicloud.dts.ConsumerChannel;
import com.pulumi.alicloud.dts.ConsumerChannelArgs;
import com.pulumi.codegen.internal.KeyedValue;
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("tftestdts");
final var creation = config.get("creation").orElse("Rds");
final var defaultZones = AlicloudFunctions.getZones(GetZonesArgs.builder()
.availableResourceCreation(creation)
.build());
final var defaultNetworks = VpcFunctions.getNetworks(GetNetworksArgs.builder()
.nameRegex("default-NODELETING")
.build());
final var defaultSwitches = VpcFunctions.getSwitches(GetSwitchesArgs.builder()
.vpcId(defaultNetworks.applyValue(getNetworksResult -> getNetworksResult.ids()[0]))
.zoneId(defaultZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.build());
var instance = new Instance("instance", InstanceArgs.builder()
.engine("MySQL")
.engineVersion("5.6")
.instanceType("rds.mysql.s1.small")
.instanceStorage("10")
.vswitchId(defaultSwitches.applyValue(getSwitchesResult -> getSwitchesResult.ids()[0]))
.instanceName(name)
.build());
for (var i = 0; i < 2; i++) {
new Database("db-" + i, DatabaseArgs.builder()
.instanceId(instance.id())
.description("from terraform")
.build());
}
var account = new Account("account", AccountArgs.builder()
.dbInstanceId(instance.id())
.accountName("tftestprivilege")
.accountPassword("Test12345")
.accountDescription("from terraform")
.build());
var privilege = new AccountPrivilege("privilege", AccountPrivilegeArgs.builder()
.instanceId(instance.id())
.accountName(account.name())
.privilege("ReadWrite")
.dbNames(db.stream().map(element -> element.name()).collect(toList()))
.build());
var defaultSubscriptionJob = new SubscriptionJob("defaultSubscriptionJob", SubscriptionJobArgs.builder()
.dtsJobName(name)
.paymentType("PayAsYouGo")
.sourceEndpointEngineName("MySQL")
.sourceEndpointRegion("cn-hangzhou")
.sourceEndpointInstanceType("RDS")
.sourceEndpointInstanceId(instance.id())
.sourceEndpointDatabaseName("tfaccountpri_0")
.sourceEndpointUserName("tftestprivilege")
.sourceEndpointPassword("Test12345")
.subscriptionInstanceNetworkType("vpc")
.dbList("""
{"dtstestdata": {"name": "tfaccountpri_0", "all": true}}
""")
.subscriptionInstanceVpcId(defaultNetworks.applyValue(getNetworksResult -> getNetworksResult.ids()[0]))
.subscriptionInstanceVswitchId(defaultSwitches.applyValue(getSwitchesResult -> getSwitchesResult.ids()[0]))
.status("Normal")
.build());
var defaultConsumerChannel = new ConsumerChannel("defaultConsumerChannel", ConsumerChannelArgs.builder()
.dtsInstanceId(defaultSubscriptionJob.dtsInstanceId())
.consumerGroupName(name)
.consumerGroupUserName(name)
.consumerGroupPassword("tftestAcc123")
.build());
}
}
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "tftestdts"
creation = config.get("creation")
if creation is None:
creation = "Rds"
default_zones = alicloud.get_zones(available_resource_creation=creation)
default_networks = alicloud.vpc.get_networks(name_regex="default-NODELETING")
default_switches = alicloud.vpc.get_switches(vpc_id=default_networks.ids[0],
zone_id=default_zones.zones[0].id)
instance = alicloud.rds.Instance("instance",
engine="MySQL",
engine_version="5.6",
instance_type="rds.mysql.s1.small",
instance_storage=10,
vswitch_id=default_switches.ids[0],
instance_name=name)
db = []
for range in [{"value": i} for i in range(0, 2)]:
db.append(alicloud.rds.Database(f"db-{range['value']}",
instance_id=instance.id,
description="from terraform"))
account = alicloud.rds.Account("account",
db_instance_id=instance.id,
account_name="tftestprivilege",
account_password="Test12345",
account_description="from terraform")
privilege = alicloud.rds.AccountPrivilege("privilege",
instance_id=instance.id,
account_name=account.name,
privilege="ReadWrite",
db_names=[__item.name for __item in db])
default_subscription_job = alicloud.dts.SubscriptionJob("defaultSubscriptionJob",
dts_job_name=name,
payment_type="PayAsYouGo",
source_endpoint_engine_name="MySQL",
source_endpoint_region="cn-hangzhou",
source_endpoint_instance_type="RDS",
source_endpoint_instance_id=instance.id,
source_endpoint_database_name="tfaccountpri_0",
source_endpoint_user_name="tftestprivilege",
source_endpoint_password="Test12345",
subscription_instance_network_type="vpc",
db_list=" {\"dtstestdata\": {\"name\": \"tfaccountpri_0\", \"all\": true}}\n",
subscription_instance_vpc_id=default_networks.ids[0],
subscription_instance_vswitch_id=default_switches.ids[0],
status="Normal")
default_consumer_channel = alicloud.dts.ConsumerChannel("defaultConsumerChannel",
dts_instance_id=default_subscription_job.dts_instance_id,
consumer_group_name=name,
consumer_group_user_name=name,
consumer_group_password="tftestAcc123")
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "tftestdts";
const creation = config.get("creation") || "Rds";
const defaultZones = alicloud.getZones({
availableResourceCreation: creation,
});
const defaultNetworks = alicloud.vpc.getNetworks({
nameRegex: "default-NODELETING",
});
const defaultSwitches = Promise.all([defaultNetworks, defaultZones]).then(([defaultNetworks, defaultZones]) => alicloud.vpc.getSwitches({
vpcId: defaultNetworks.ids?.[0],
zoneId: defaultZones.zones?.[0]?.id,
}));
const instance = new alicloud.rds.Instance("instance", {
engine: "MySQL",
engineVersion: "5.6",
instanceType: "rds.mysql.s1.small",
instanceStorage: 10,
vswitchId: defaultSwitches.then(defaultSwitches => defaultSwitches.ids?.[0]),
instanceName: name,
});
const db: alicloud.rds.Database[] = [];
for (const range = {value: 0}; range.value < 2; range.value++) {
db.push(new alicloud.rds.Database(`db-${range.value}`, {
instanceId: instance.id,
description: "from terraform",
}));
}
const account = new alicloud.rds.Account("account", {
dbInstanceId: instance.id,
accountName: "tftestprivilege",
accountPassword: "Test12345",
accountDescription: "from terraform",
});
const privilege = new alicloud.rds.AccountPrivilege("privilege", {
instanceId: instance.id,
accountName: account.name,
privilege: "ReadWrite",
dbNames: db.map(__item => __item.name),
});
const defaultSubscriptionJob = new alicloud.dts.SubscriptionJob("defaultSubscriptionJob", {
dtsJobName: name,
paymentType: "PayAsYouGo",
sourceEndpointEngineName: "MySQL",
sourceEndpointRegion: "cn-hangzhou",
sourceEndpointInstanceType: "RDS",
sourceEndpointInstanceId: instance.id,
sourceEndpointDatabaseName: "tfaccountpri_0",
sourceEndpointUserName: "tftestprivilege",
sourceEndpointPassword: "Test12345",
subscriptionInstanceNetworkType: "vpc",
dbList: " {\"dtstestdata\": {\"name\": \"tfaccountpri_0\", \"all\": true}}\n",
subscriptionInstanceVpcId: defaultNetworks.then(defaultNetworks => defaultNetworks.ids?.[0]),
subscriptionInstanceVswitchId: defaultSwitches.then(defaultSwitches => defaultSwitches.ids?.[0]),
status: "Normal",
});
const defaultConsumerChannel = new alicloud.dts.ConsumerChannel("defaultConsumerChannel", {
dtsInstanceId: defaultSubscriptionJob.dtsInstanceId,
consumerGroupName: name,
consumerGroupUserName: name,
consumerGroupPassword: "tftestAcc123",
});
Coming soon!
Create ConsumerChannel Resource
new ConsumerChannel(name: string, args: ConsumerChannelArgs, opts?: CustomResourceOptions);
@overload
def ConsumerChannel(resource_name: str,
opts: Optional[ResourceOptions] = None,
consumer_group_name: Optional[str] = None,
consumer_group_password: Optional[str] = None,
consumer_group_user_name: Optional[str] = None,
dts_instance_id: Optional[str] = None)
@overload
def ConsumerChannel(resource_name: str,
args: ConsumerChannelArgs,
opts: Optional[ResourceOptions] = None)
func NewConsumerChannel(ctx *Context, name string, args ConsumerChannelArgs, opts ...ResourceOption) (*ConsumerChannel, error)
public ConsumerChannel(string name, ConsumerChannelArgs args, CustomResourceOptions? opts = null)
public ConsumerChannel(String name, ConsumerChannelArgs args)
public ConsumerChannel(String name, ConsumerChannelArgs args, CustomResourceOptions options)
type: alicloud:dts:ConsumerChannel
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ConsumerChannelArgs
- 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 ConsumerChannelArgs
- 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 ConsumerChannelArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ConsumerChannelArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ConsumerChannelArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
ConsumerChannel 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 ConsumerChannel resource accepts the following input properties:
- Consumer
Group stringName The name of the consumer group.
- Consumer
Group stringPassword The password of the consumer group account. The length of the
consumer_group_password
is limited to8
to32
characters. It can contain two or more of the following characters: uppercase letters, lowercase letters, digits, and special characters.- Consumer
Group stringUser Name The username of the consumer group. The length of the
consumer_group_user_name
is limited to1
to16
characters. It can contain one or more of the following characters: uppercase letters, lowercase letters, digits, and underscores (_).- Dts
Instance stringId The ID of the subscription instance.
- Consumer
Group stringName The name of the consumer group.
- Consumer
Group stringPassword The password of the consumer group account. The length of the
consumer_group_password
is limited to8
to32
characters. It can contain two or more of the following characters: uppercase letters, lowercase letters, digits, and special characters.- Consumer
Group stringUser Name The username of the consumer group. The length of the
consumer_group_user_name
is limited to1
to16
characters. It can contain one or more of the following characters: uppercase letters, lowercase letters, digits, and underscores (_).- Dts
Instance stringId The ID of the subscription instance.
- consumer
Group StringName The name of the consumer group.
- consumer
Group StringPassword The password of the consumer group account. The length of the
consumer_group_password
is limited to8
to32
characters. It can contain two or more of the following characters: uppercase letters, lowercase letters, digits, and special characters.- consumer
Group StringUser Name The username of the consumer group. The length of the
consumer_group_user_name
is limited to1
to16
characters. It can contain one or more of the following characters: uppercase letters, lowercase letters, digits, and underscores (_).- dts
Instance StringId The ID of the subscription instance.
- consumer
Group stringName The name of the consumer group.
- consumer
Group stringPassword The password of the consumer group account. The length of the
consumer_group_password
is limited to8
to32
characters. It can contain two or more of the following characters: uppercase letters, lowercase letters, digits, and special characters.- consumer
Group stringUser Name The username of the consumer group. The length of the
consumer_group_user_name
is limited to1
to16
characters. It can contain one or more of the following characters: uppercase letters, lowercase letters, digits, and underscores (_).- dts
Instance stringId The ID of the subscription instance.
- consumer_
group_ strname The name of the consumer group.
- consumer_
group_ strpassword The password of the consumer group account. The length of the
consumer_group_password
is limited to8
to32
characters. It can contain two or more of the following characters: uppercase letters, lowercase letters, digits, and special characters.- consumer_
group_ struser_ name The username of the consumer group. The length of the
consumer_group_user_name
is limited to1
to16
characters. It can contain one or more of the following characters: uppercase letters, lowercase letters, digits, and underscores (_).- dts_
instance_ strid The ID of the subscription instance.
- consumer
Group StringName The name of the consumer group.
- consumer
Group StringPassword The password of the consumer group account. The length of the
consumer_group_password
is limited to8
to32
characters. It can contain two or more of the following characters: uppercase letters, lowercase letters, digits, and special characters.- consumer
Group StringUser Name The username of the consumer group. The length of the
consumer_group_user_name
is limited to1
to16
characters. It can contain one or more of the following characters: uppercase letters, lowercase letters, digits, and underscores (_).- dts
Instance StringId The ID of the subscription instance.
Outputs
All input properties are implicitly available as output properties. Additionally, the ConsumerChannel resource produces the following output properties:
- Consumer
Group stringId The ID of the consumer group.
- Id string
The provider-assigned unique ID for this managed resource.
- Consumer
Group stringId The ID of the consumer group.
- Id string
The provider-assigned unique ID for this managed resource.
- consumer
Group StringId The ID of the consumer group.
- id String
The provider-assigned unique ID for this managed resource.
- consumer
Group stringId The ID of the consumer group.
- id string
The provider-assigned unique ID for this managed resource.
- consumer_
group_ strid The ID of the consumer group.
- id str
The provider-assigned unique ID for this managed resource.
- consumer
Group StringId The ID of the consumer group.
- id String
The provider-assigned unique ID for this managed resource.
Look up Existing ConsumerChannel Resource
Get an existing ConsumerChannel 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?: ConsumerChannelState, opts?: CustomResourceOptions): ConsumerChannel
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
consumer_group_id: Optional[str] = None,
consumer_group_name: Optional[str] = None,
consumer_group_password: Optional[str] = None,
consumer_group_user_name: Optional[str] = None,
dts_instance_id: Optional[str] = None) -> ConsumerChannel
func GetConsumerChannel(ctx *Context, name string, id IDInput, state *ConsumerChannelState, opts ...ResourceOption) (*ConsumerChannel, error)
public static ConsumerChannel Get(string name, Input<string> id, ConsumerChannelState? state, CustomResourceOptions? opts = null)
public static ConsumerChannel get(String name, Output<String> id, ConsumerChannelState 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.
- Consumer
Group stringId The ID of the consumer group.
- Consumer
Group stringName The name of the consumer group.
- Consumer
Group stringPassword The password of the consumer group account. The length of the
consumer_group_password
is limited to8
to32
characters. It can contain two or more of the following characters: uppercase letters, lowercase letters, digits, and special characters.- Consumer
Group stringUser Name The username of the consumer group. The length of the
consumer_group_user_name
is limited to1
to16
characters. It can contain one or more of the following characters: uppercase letters, lowercase letters, digits, and underscores (_).- Dts
Instance stringId The ID of the subscription instance.
- Consumer
Group stringId The ID of the consumer group.
- Consumer
Group stringName The name of the consumer group.
- Consumer
Group stringPassword The password of the consumer group account. The length of the
consumer_group_password
is limited to8
to32
characters. It can contain two or more of the following characters: uppercase letters, lowercase letters, digits, and special characters.- Consumer
Group stringUser Name The username of the consumer group. The length of the
consumer_group_user_name
is limited to1
to16
characters. It can contain one or more of the following characters: uppercase letters, lowercase letters, digits, and underscores (_).- Dts
Instance stringId The ID of the subscription instance.
- consumer
Group StringId The ID of the consumer group.
- consumer
Group StringName The name of the consumer group.
- consumer
Group StringPassword The password of the consumer group account. The length of the
consumer_group_password
is limited to8
to32
characters. It can contain two or more of the following characters: uppercase letters, lowercase letters, digits, and special characters.- consumer
Group StringUser Name The username of the consumer group. The length of the
consumer_group_user_name
is limited to1
to16
characters. It can contain one or more of the following characters: uppercase letters, lowercase letters, digits, and underscores (_).- dts
Instance StringId The ID of the subscription instance.
- consumer
Group stringId The ID of the consumer group.
- consumer
Group stringName The name of the consumer group.
- consumer
Group stringPassword The password of the consumer group account. The length of the
consumer_group_password
is limited to8
to32
characters. It can contain two or more of the following characters: uppercase letters, lowercase letters, digits, and special characters.- consumer
Group stringUser Name The username of the consumer group. The length of the
consumer_group_user_name
is limited to1
to16
characters. It can contain one or more of the following characters: uppercase letters, lowercase letters, digits, and underscores (_).- dts
Instance stringId The ID of the subscription instance.
- consumer_
group_ strid The ID of the consumer group.
- consumer_
group_ strname The name of the consumer group.
- consumer_
group_ strpassword The password of the consumer group account. The length of the
consumer_group_password
is limited to8
to32
characters. It can contain two or more of the following characters: uppercase letters, lowercase letters, digits, and special characters.- consumer_
group_ struser_ name The username of the consumer group. The length of the
consumer_group_user_name
is limited to1
to16
characters. It can contain one or more of the following characters: uppercase letters, lowercase letters, digits, and underscores (_).- dts_
instance_ strid The ID of the subscription instance.
- consumer
Group StringId The ID of the consumer group.
- consumer
Group StringName The name of the consumer group.
- consumer
Group StringPassword The password of the consumer group account. The length of the
consumer_group_password
is limited to8
to32
characters. It can contain two or more of the following characters: uppercase letters, lowercase letters, digits, and special characters.- consumer
Group StringUser Name The username of the consumer group. The length of the
consumer_group_user_name
is limited to1
to16
characters. It can contain one or more of the following characters: uppercase letters, lowercase letters, digits, and underscores (_).- dts
Instance StringId The ID of the subscription instance.
Import
DTS Consumer Channel can be imported using the id, e.g.
$ pulumi import alicloud:dts/consumerChannel:ConsumerChannel example <dts_instance_id>:<consumer_group_id>
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
alicloud
Terraform Provider.