alicloud.rocketmq.RocketMQTopic
Explore with Pulumi AI
Provides a RocketMQ Topic resource.
For information about RocketMQ Topic and how to use it, see What is Topic.
NOTE: Available since v1.211.0.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "terraform-example";
const default = alicloud.getZones({
availableResourceCreation: "VSwitch",
});
const createVpc = new alicloud.vpc.Network("createVpc", {
description: "example",
cidrBlock: "172.16.0.0/12",
vpcName: name,
});
const createVswitch = new alicloud.vpc.Switch("createVswitch", {
description: "example",
vpcId: createVpc.id,
zoneId: _default.then(_default => _default.zones?.[0]?.id),
cidrBlock: "172.16.0.0/24",
vswitchName: name,
});
const createInstance = new alicloud.rocketmq.RocketMQInstance("createInstance", {
autoRenewPeriod: 1,
productInfo: {
msgProcessSpec: "rmq.p2.4xlarge",
sendReceiveRatio: 0.3,
messageRetentionTime: 70,
},
networkInfo: {
vpcInfo: {
vpcId: createVpc.id,
vswitchId: createVswitch.id,
},
internetInfo: {
internetSpec: "enable",
flowOutType: "payByBandwidth",
flowOutBandwidth: 30,
},
},
period: 1,
subSeriesCode: "cluster_ha",
remark: "example",
instanceName: name,
serviceCode: "rmq",
seriesCode: "professional",
paymentType: "PayAsYouGo",
periodUnit: "Month",
});
const defaultRocketMQTopic = new alicloud.rocketmq.RocketMQTopic("default", {
remark: "example",
instanceId: createInstance.id,
messageType: "NORMAL",
topicName: name,
});
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "terraform-example"
default = alicloud.get_zones(available_resource_creation="VSwitch")
create_vpc = alicloud.vpc.Network("createVpc",
description="example",
cidr_block="172.16.0.0/12",
vpc_name=name)
create_vswitch = alicloud.vpc.Switch("createVswitch",
description="example",
vpc_id=create_vpc.id,
zone_id=default.zones[0].id,
cidr_block="172.16.0.0/24",
vswitch_name=name)
create_instance = alicloud.rocketmq.RocketMQInstance("createInstance",
auto_renew_period=1,
product_info={
"msg_process_spec": "rmq.p2.4xlarge",
"send_receive_ratio": 0.3,
"message_retention_time": 70,
},
network_info={
"vpc_info": {
"vpc_id": create_vpc.id,
"vswitch_id": create_vswitch.id,
},
"internet_info": {
"internet_spec": "enable",
"flow_out_type": "payByBandwidth",
"flow_out_bandwidth": 30,
},
},
period=1,
sub_series_code="cluster_ha",
remark="example",
instance_name=name,
service_code="rmq",
series_code="professional",
payment_type="PayAsYouGo",
period_unit="Month")
default_rocket_mq_topic = alicloud.rocketmq.RocketMQTopic("default",
remark="example",
instance_id=create_instance.id,
message_type="NORMAL",
topic_name=name)
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud"
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/rocketmq"
"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, "")
name := "terraform-example"
if param := cfg.Get("name"); param != "" {
name = param
}
_default, err := alicloud.GetZones(ctx, &alicloud.GetZonesArgs{
AvailableResourceCreation: pulumi.StringRef("VSwitch"),
}, nil)
if err != nil {
return err
}
createVpc, err := vpc.NewNetwork(ctx, "createVpc", &vpc.NetworkArgs{
Description: pulumi.String("example"),
CidrBlock: pulumi.String("172.16.0.0/12"),
VpcName: pulumi.String(name),
})
if err != nil {
return err
}
createVswitch, err := vpc.NewSwitch(ctx, "createVswitch", &vpc.SwitchArgs{
Description: pulumi.String("example"),
VpcId: createVpc.ID(),
ZoneId: pulumi.String(_default.Zones[0].Id),
CidrBlock: pulumi.String("172.16.0.0/24"),
VswitchName: pulumi.String(name),
})
if err != nil {
return err
}
createInstance, err := rocketmq.NewRocketMQInstance(ctx, "createInstance", &rocketmq.RocketMQInstanceArgs{
AutoRenewPeriod: pulumi.Int(1),
ProductInfo: &rocketmq.RocketMQInstanceProductInfoArgs{
MsgProcessSpec: pulumi.String("rmq.p2.4xlarge"),
SendReceiveRatio: pulumi.Float64(0.3),
MessageRetentionTime: pulumi.Int(70),
},
NetworkInfo: &rocketmq.RocketMQInstanceNetworkInfoArgs{
VpcInfo: &rocketmq.RocketMQInstanceNetworkInfoVpcInfoArgs{
VpcId: createVpc.ID(),
VswitchId: createVswitch.ID(),
},
InternetInfo: &rocketmq.RocketMQInstanceNetworkInfoInternetInfoArgs{
InternetSpec: pulumi.String("enable"),
FlowOutType: pulumi.String("payByBandwidth"),
FlowOutBandwidth: pulumi.Int(30),
},
},
Period: pulumi.Int(1),
SubSeriesCode: pulumi.String("cluster_ha"),
Remark: pulumi.String("example"),
InstanceName: pulumi.String(name),
ServiceCode: pulumi.String("rmq"),
SeriesCode: pulumi.String("professional"),
PaymentType: pulumi.String("PayAsYouGo"),
PeriodUnit: pulumi.String("Month"),
})
if err != nil {
return err
}
_, err = rocketmq.NewRocketMQTopic(ctx, "default", &rocketmq.RocketMQTopicArgs{
Remark: pulumi.String("example"),
InstanceId: createInstance.ID(),
MessageType: pulumi.String("NORMAL"),
TopicName: pulumi.String(name),
})
if err != nil {
return err
}
return nil
})
}
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") ?? "terraform-example";
var @default = AliCloud.GetZones.Invoke(new()
{
AvailableResourceCreation = "VSwitch",
});
var createVpc = new AliCloud.Vpc.Network("createVpc", new()
{
Description = "example",
CidrBlock = "172.16.0.0/12",
VpcName = name,
});
var createVswitch = new AliCloud.Vpc.Switch("createVswitch", new()
{
Description = "example",
VpcId = createVpc.Id,
ZoneId = @default.Apply(@default => @default.Apply(getZonesResult => getZonesResult.Zones[0]?.Id)),
CidrBlock = "172.16.0.0/24",
VswitchName = name,
});
var createInstance = new AliCloud.RocketMQ.RocketMQInstance("createInstance", new()
{
AutoRenewPeriod = 1,
ProductInfo = new AliCloud.RocketMQ.Inputs.RocketMQInstanceProductInfoArgs
{
MsgProcessSpec = "rmq.p2.4xlarge",
SendReceiveRatio = 0.3,
MessageRetentionTime = 70,
},
NetworkInfo = new AliCloud.RocketMQ.Inputs.RocketMQInstanceNetworkInfoArgs
{
VpcInfo = new AliCloud.RocketMQ.Inputs.RocketMQInstanceNetworkInfoVpcInfoArgs
{
VpcId = createVpc.Id,
VswitchId = createVswitch.Id,
},
InternetInfo = new AliCloud.RocketMQ.Inputs.RocketMQInstanceNetworkInfoInternetInfoArgs
{
InternetSpec = "enable",
FlowOutType = "payByBandwidth",
FlowOutBandwidth = 30,
},
},
Period = 1,
SubSeriesCode = "cluster_ha",
Remark = "example",
InstanceName = name,
ServiceCode = "rmq",
SeriesCode = "professional",
PaymentType = "PayAsYouGo",
PeriodUnit = "Month",
});
var defaultRocketMQTopic = new AliCloud.RocketMQ.RocketMQTopic("default", new()
{
Remark = "example",
InstanceId = createInstance.Id,
MessageType = "NORMAL",
TopicName = name,
});
});
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.rocketmq.RocketMQInstance;
import com.pulumi.alicloud.rocketmq.RocketMQInstanceArgs;
import com.pulumi.alicloud.rocketmq.inputs.RocketMQInstanceProductInfoArgs;
import com.pulumi.alicloud.rocketmq.inputs.RocketMQInstanceNetworkInfoArgs;
import com.pulumi.alicloud.rocketmq.inputs.RocketMQInstanceNetworkInfoVpcInfoArgs;
import com.pulumi.alicloud.rocketmq.inputs.RocketMQInstanceNetworkInfoInternetInfoArgs;
import com.pulumi.alicloud.rocketmq.RocketMQTopic;
import com.pulumi.alicloud.rocketmq.RocketMQTopicArgs;
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("terraform-example");
final var default = AlicloudFunctions.getZones(GetZonesArgs.builder()
.availableResourceCreation("VSwitch")
.build());
var createVpc = new Network("createVpc", NetworkArgs.builder()
.description("example")
.cidrBlock("172.16.0.0/12")
.vpcName(name)
.build());
var createVswitch = new Switch("createVswitch", SwitchArgs.builder()
.description("example")
.vpcId(createVpc.id())
.zoneId(default_.zones()[0].id())
.cidrBlock("172.16.0.0/24")
.vswitchName(name)
.build());
var createInstance = new RocketMQInstance("createInstance", RocketMQInstanceArgs.builder()
.autoRenewPeriod("1")
.productInfo(RocketMQInstanceProductInfoArgs.builder()
.msgProcessSpec("rmq.p2.4xlarge")
.sendReceiveRatio(0.3)
.messageRetentionTime("70")
.build())
.networkInfo(RocketMQInstanceNetworkInfoArgs.builder()
.vpcInfo(RocketMQInstanceNetworkInfoVpcInfoArgs.builder()
.vpcId(createVpc.id())
.vswitchId(createVswitch.id())
.build())
.internetInfo(RocketMQInstanceNetworkInfoInternetInfoArgs.builder()
.internetSpec("enable")
.flowOutType("payByBandwidth")
.flowOutBandwidth("30")
.build())
.build())
.period("1")
.subSeriesCode("cluster_ha")
.remark("example")
.instanceName(name)
.serviceCode("rmq")
.seriesCode("professional")
.paymentType("PayAsYouGo")
.periodUnit("Month")
.build());
var defaultRocketMQTopic = new RocketMQTopic("defaultRocketMQTopic", RocketMQTopicArgs.builder()
.remark("example")
.instanceId(createInstance.id())
.messageType("NORMAL")
.topicName(name)
.build());
}
}
configuration:
name:
type: string
default: terraform-example
resources:
createVpc:
type: alicloud:vpc:Network
properties:
description: example
cidrBlock: 172.16.0.0/12
vpcName: ${name}
createVswitch:
type: alicloud:vpc:Switch
properties:
description: example
vpcId: ${createVpc.id}
zoneId: ${default.zones[0].id}
cidrBlock: 172.16.0.0/24
vswitchName: ${name}
createInstance:
type: alicloud:rocketmq:RocketMQInstance
properties:
autoRenewPeriod: '1'
productInfo:
msgProcessSpec: rmq.p2.4xlarge
sendReceiveRatio: 0.3
messageRetentionTime: '70'
networkInfo:
vpcInfo:
vpcId: ${createVpc.id}
vswitchId: ${createVswitch.id}
internetInfo:
internetSpec: enable
flowOutType: payByBandwidth
flowOutBandwidth: '30'
period: '1'
subSeriesCode: cluster_ha
remark: example
instanceName: ${name}
serviceCode: rmq
seriesCode: professional
paymentType: PayAsYouGo
periodUnit: Month
defaultRocketMQTopic:
type: alicloud:rocketmq:RocketMQTopic
name: default
properties:
remark: example
instanceId: ${createInstance.id}
messageType: NORMAL
topicName: ${name}
variables:
default:
fn::invoke:
Function: alicloud:getZones
Arguments:
availableResourceCreation: VSwitch
Create RocketMQTopic Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RocketMQTopic(name: string, args: RocketMQTopicArgs, opts?: CustomResourceOptions);
@overload
def RocketMQTopic(resource_name: str,
args: RocketMQTopicArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RocketMQTopic(resource_name: str,
opts: Optional[ResourceOptions] = None,
instance_id: Optional[str] = None,
topic_name: Optional[str] = None,
message_type: Optional[str] = None,
remark: Optional[str] = None)
func NewRocketMQTopic(ctx *Context, name string, args RocketMQTopicArgs, opts ...ResourceOption) (*RocketMQTopic, error)
public RocketMQTopic(string name, RocketMQTopicArgs args, CustomResourceOptions? opts = null)
public RocketMQTopic(String name, RocketMQTopicArgs args)
public RocketMQTopic(String name, RocketMQTopicArgs args, CustomResourceOptions options)
type: alicloud:rocketmq:RocketMQTopic
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 RocketMQTopicArgs
- 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 RocketMQTopicArgs
- 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 RocketMQTopicArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RocketMQTopicArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RocketMQTopicArgs
- 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 rocketMQTopicResource = new AliCloud.RocketMQ.RocketMQTopic("rocketMQTopicResource", new()
{
InstanceId = "string",
TopicName = "string",
MessageType = "string",
Remark = "string",
});
example, err := rocketmq.NewRocketMQTopic(ctx, "rocketMQTopicResource", &rocketmq.RocketMQTopicArgs{
InstanceId: pulumi.String("string"),
TopicName: pulumi.String("string"),
MessageType: pulumi.String("string"),
Remark: pulumi.String("string"),
})
var rocketMQTopicResource = new RocketMQTopic("rocketMQTopicResource", RocketMQTopicArgs.builder()
.instanceId("string")
.topicName("string")
.messageType("string")
.remark("string")
.build());
rocket_mq_topic_resource = alicloud.rocketmq.RocketMQTopic("rocketMQTopicResource",
instance_id="string",
topic_name="string",
message_type="string",
remark="string")
const rocketMQTopicResource = new alicloud.rocketmq.RocketMQTopic("rocketMQTopicResource", {
instanceId: "string",
topicName: "string",
messageType: "string",
remark: "string",
});
type: alicloud:rocketmq:RocketMQTopic
properties:
instanceId: string
messageType: string
remark: string
topicName: string
RocketMQTopic Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The RocketMQTopic resource accepts the following input properties:
- Instance
Id string - Instance ID.
- Topic
Name string - Topic name and identification.
- Message
Type string - Message type.
- Remark string
- Custom remarks.
- Instance
Id string - Instance ID.
- Topic
Name string - Topic name and identification.
- Message
Type string - Message type.
- Remark string
- Custom remarks.
- instance
Id String - Instance ID.
- topic
Name String - Topic name and identification.
- message
Type String - Message type.
- remark String
- Custom remarks.
- instance
Id string - Instance ID.
- topic
Name string - Topic name and identification.
- message
Type string - Message type.
- remark string
- Custom remarks.
- instance_
id str - Instance ID.
- topic_
name str - Topic name and identification.
- message_
type str - Message type.
- remark str
- Custom remarks.
- instance
Id String - Instance ID.
- topic
Name String - Topic name and identification.
- message
Type String - Message type.
- remark String
- Custom remarks.
Outputs
All input properties are implicitly available as output properties. Additionally, the RocketMQTopic resource produces the following output properties:
- Create
Time string - The creation time of the resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- The status of the resource.
- Create
Time string - The creation time of the resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- Status string
- The status of the resource.
- create
Time String - The creation time of the resource.
- id String
- The provider-assigned unique ID for this managed resource.
- status String
- The status of the resource.
- create
Time string - The creation time of the resource.
- id string
- The provider-assigned unique ID for this managed resource.
- status string
- The status of the resource.
- create_
time str - The creation time of the resource.
- id str
- The provider-assigned unique ID for this managed resource.
- status str
- The status of the resource.
- create
Time String - The creation time of the resource.
- id String
- The provider-assigned unique ID for this managed resource.
- status String
- The status of the resource.
Look up Existing RocketMQTopic Resource
Get an existing RocketMQTopic 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?: RocketMQTopicState, opts?: CustomResourceOptions): RocketMQTopic
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
create_time: Optional[str] = None,
instance_id: Optional[str] = None,
message_type: Optional[str] = None,
remark: Optional[str] = None,
status: Optional[str] = None,
topic_name: Optional[str] = None) -> RocketMQTopic
func GetRocketMQTopic(ctx *Context, name string, id IDInput, state *RocketMQTopicState, opts ...ResourceOption) (*RocketMQTopic, error)
public static RocketMQTopic Get(string name, Input<string> id, RocketMQTopicState? state, CustomResourceOptions? opts = null)
public static RocketMQTopic get(String name, Output<String> id, RocketMQTopicState 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.
- Create
Time string - The creation time of the resource.
- Instance
Id string - Instance ID.
- Message
Type string - Message type.
- Remark string
- Custom remarks.
- Status string
- The status of the resource.
- Topic
Name string - Topic name and identification.
- Create
Time string - The creation time of the resource.
- Instance
Id string - Instance ID.
- Message
Type string - Message type.
- Remark string
- Custom remarks.
- Status string
- The status of the resource.
- Topic
Name string - Topic name and identification.
- create
Time String - The creation time of the resource.
- instance
Id String - Instance ID.
- message
Type String - Message type.
- remark String
- Custom remarks.
- status String
- The status of the resource.
- topic
Name String - Topic name and identification.
- create
Time string - The creation time of the resource.
- instance
Id string - Instance ID.
- message
Type string - Message type.
- remark string
- Custom remarks.
- status string
- The status of the resource.
- topic
Name string - Topic name and identification.
- create_
time str - The creation time of the resource.
- instance_
id str - Instance ID.
- message_
type str - Message type.
- remark str
- Custom remarks.
- status str
- The status of the resource.
- topic_
name str - Topic name and identification.
- create
Time String - The creation time of the resource.
- instance
Id String - Instance ID.
- message
Type String - Message type.
- remark String
- Custom remarks.
- status String
- The status of the resource.
- topic
Name String - Topic name and identification.
Import
RocketMQ Topic can be imported using the id, e.g.
$ pulumi import alicloud:rocketmq/rocketMQTopic:RocketMQTopic example <instance_id>:<topic_name>
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.