alicloud.rocketmq.Topic
Explore with Pulumi AI
Provides an ONS topic resource.
For more information about how to use it, see RocketMQ Topic Management API.
NOTE: Available in 1.53.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") ?? "onsInstanceName";
var topic = config.Get("topic") ?? "onsTopicName";
var defaultInstance = new AliCloud.RocketMQ.Instance("defaultInstance", new()
{
Remark = "default_ons_instance_remark",
});
var defaultTopic = new AliCloud.RocketMQ.Topic("defaultTopic", new()
{
TopicName = topic,
InstanceId = defaultInstance.Id,
MessageType = 0,
Remark = "dafault_ons_topic_remark",
});
});
package main
import (
"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/rocketmq"
"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 := "onsInstanceName"
if param := cfg.Get("name"); param != "" {
name = param
}
topic := "onsTopicName"
if param := cfg.Get("topic"); param != "" {
topic = param
}
defaultInstance, err := rocketmq.NewInstance(ctx, "defaultInstance", &rocketmq.InstanceArgs{
Remark: pulumi.String("default_ons_instance_remark"),
})
if err != nil {
return err
}
_, err = rocketmq.NewTopic(ctx, "defaultTopic", &rocketmq.TopicArgs{
TopicName: pulumi.String(topic),
InstanceId: defaultInstance.ID(),
MessageType: pulumi.Int(0),
Remark: pulumi.String("dafault_ons_topic_remark"),
})
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.rocketmq.Instance;
import com.pulumi.alicloud.rocketmq.InstanceArgs;
import com.pulumi.alicloud.rocketmq.Topic;
import com.pulumi.alicloud.rocketmq.TopicArgs;
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("onsInstanceName");
final var topic = config.get("topic").orElse("onsTopicName");
var defaultInstance = new Instance("defaultInstance", InstanceArgs.builder()
.remark("default_ons_instance_remark")
.build());
var defaultTopic = new Topic("defaultTopic", TopicArgs.builder()
.topicName(topic)
.instanceId(defaultInstance.id())
.messageType(0)
.remark("dafault_ons_topic_remark")
.build());
}
}
import pulumi
import pulumi_alicloud as alicloud
config = pulumi.Config()
name = config.get("name")
if name is None:
name = "onsInstanceName"
topic = config.get("topic")
if topic is None:
topic = "onsTopicName"
default_instance = alicloud.rocketmq.Instance("defaultInstance", remark="default_ons_instance_remark")
default_topic = alicloud.rocketmq.Topic("defaultTopic",
topic_name=topic,
instance_id=default_instance.id,
message_type=0,
remark="dafault_ons_topic_remark")
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const config = new pulumi.Config();
const name = config.get("name") || "onsInstanceName";
const topic = config.get("topic") || "onsTopicName";
const defaultInstance = new alicloud.rocketmq.Instance("defaultInstance", {remark: "default_ons_instance_remark"});
const defaultTopic = new alicloud.rocketmq.Topic("defaultTopic", {
topicName: topic,
instanceId: defaultInstance.id,
messageType: 0,
remark: "dafault_ons_topic_remark",
});
configuration:
name:
type: string
default: onsInstanceName
topic:
type: string
default: onsTopicName
resources:
defaultInstance:
type: alicloud:rocketmq:Instance
properties:
remark: default_ons_instance_remark
defaultTopic:
type: alicloud:rocketmq:Topic
properties:
topicName: ${topic}
instanceId: ${defaultInstance.id}
messageType: 0
remark: dafault_ons_topic_remark
Create Topic Resource
new Topic(name: string, args: TopicArgs, opts?: CustomResourceOptions);
@overload
def Topic(resource_name: str,
opts: Optional[ResourceOptions] = None,
instance_id: Optional[str] = None,
message_type: Optional[int] = None,
perm: Optional[int] = None,
remark: Optional[str] = None,
tags: Optional[Mapping[str, Any]] = None,
topic: Optional[str] = None,
topic_name: Optional[str] = None)
@overload
def Topic(resource_name: str,
args: TopicArgs,
opts: Optional[ResourceOptions] = None)
func NewTopic(ctx *Context, name string, args TopicArgs, opts ...ResourceOption) (*Topic, error)
public Topic(string name, TopicArgs args, CustomResourceOptions? opts = null)
type: alicloud:rocketmq:Topic
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args TopicArgs
- 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 TopicArgs
- 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 TopicArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args TopicArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args TopicArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Topic 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 Topic resource accepts the following input properties:
- Instance
Id string ID of the ONS Instance that owns the topics.
- Message
Type int The type of the message. Read Ons Topic Create for further details.
- Perm int
This attribute has been deprecated.
Attribute perm has been deprecated and suggest removing it from your template.
- Remark string
This attribute is a concise description of topic. The length cannot exceed 128.
- Dictionary<string, object>
A mapping of tags to assign to the resource.
- Key: It can be up to 64 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It cannot be a null string.
- Value: It can be up to 128 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It can be a null string.
NOTE: At least one of
topic_name
andtopic
should be set.- Topic
Deprecated string Replaced by
topic_name
after version 1.97.0.Field 'topic' has been deprecated from version 1.97.0. Use 'topic_name' instead.
- Topic
Name string Name of the topic. Two topics on a single instance cannot have the same name and the name cannot start with 'GID' or 'CID'. The length cannot exceed 64 characters.
- Instance
Id string ID of the ONS Instance that owns the topics.
- Message
Type int The type of the message. Read Ons Topic Create for further details.
- Perm int
This attribute has been deprecated.
Attribute perm has been deprecated and suggest removing it from your template.
- Remark string
This attribute is a concise description of topic. The length cannot exceed 128.
- map[string]interface{}
A mapping of tags to assign to the resource.
- Key: It can be up to 64 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It cannot be a null string.
- Value: It can be up to 128 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It can be a null string.
NOTE: At least one of
topic_name
andtopic
should be set.- Topic string
Replaced by
topic_name
after version 1.97.0.Field 'topic' has been deprecated from version 1.97.0. Use 'topic_name' instead.
- Topic
Name string Name of the topic. Two topics on a single instance cannot have the same name and the name cannot start with 'GID' or 'CID'. The length cannot exceed 64 characters.
- instance
Id String ID of the ONS Instance that owns the topics.
- message
Type Integer The type of the message. Read Ons Topic Create for further details.
- perm Integer
This attribute has been deprecated.
Attribute perm has been deprecated and suggest removing it from your template.
- remark String
This attribute is a concise description of topic. The length cannot exceed 128.
- Map<String,Object>
A mapping of tags to assign to the resource.
- Key: It can be up to 64 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It cannot be a null string.
- Value: It can be up to 128 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It can be a null string.
NOTE: At least one of
topic_name
andtopic
should be set.- topic String
Replaced by
topic_name
after version 1.97.0.Field 'topic' has been deprecated from version 1.97.0. Use 'topic_name' instead.
- topic
Name String Name of the topic. Two topics on a single instance cannot have the same name and the name cannot start with 'GID' or 'CID'. The length cannot exceed 64 characters.
- instance
Id string ID of the ONS Instance that owns the topics.
- message
Type number The type of the message. Read Ons Topic Create for further details.
- perm number
This attribute has been deprecated.
Attribute perm has been deprecated and suggest removing it from your template.
- remark string
This attribute is a concise description of topic. The length cannot exceed 128.
- {[key: string]: any}
A mapping of tags to assign to the resource.
- Key: It can be up to 64 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It cannot be a null string.
- Value: It can be up to 128 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It can be a null string.
NOTE: At least one of
topic_name
andtopic
should be set.- topic string
Replaced by
topic_name
after version 1.97.0.Field 'topic' has been deprecated from version 1.97.0. Use 'topic_name' instead.
- topic
Name string Name of the topic. Two topics on a single instance cannot have the same name and the name cannot start with 'GID' or 'CID'. The length cannot exceed 64 characters.
- instance_
id str ID of the ONS Instance that owns the topics.
- message_
type int The type of the message. Read Ons Topic Create for further details.
- perm int
This attribute has been deprecated.
Attribute perm has been deprecated and suggest removing it from your template.
- remark str
This attribute is a concise description of topic. The length cannot exceed 128.
- Mapping[str, Any]
A mapping of tags to assign to the resource.
- Key: It can be up to 64 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It cannot be a null string.
- Value: It can be up to 128 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It can be a null string.
NOTE: At least one of
topic_name
andtopic
should be set.- topic str
Replaced by
topic_name
after version 1.97.0.Field 'topic' has been deprecated from version 1.97.0. Use 'topic_name' instead.
- topic_
name str Name of the topic. Two topics on a single instance cannot have the same name and the name cannot start with 'GID' or 'CID'. The length cannot exceed 64 characters.
- instance
Id String ID of the ONS Instance that owns the topics.
- message
Type Number The type of the message. Read Ons Topic Create for further details.
- perm Number
This attribute has been deprecated.
Attribute perm has been deprecated and suggest removing it from your template.
- remark String
This attribute is a concise description of topic. The length cannot exceed 128.
- Map<Any>
A mapping of tags to assign to the resource.
- Key: It can be up to 64 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It cannot be a null string.
- Value: It can be up to 128 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It can be a null string.
NOTE: At least one of
topic_name
andtopic
should be set.- topic String
Replaced by
topic_name
after version 1.97.0.Field 'topic' has been deprecated from version 1.97.0. Use 'topic_name' instead.
- topic
Name String Name of the topic. Two topics on a single instance cannot have the same name and the name cannot start with 'GID' or 'CID'. The length cannot exceed 64 characters.
Outputs
All input properties are implicitly available as output properties. Additionally, the Topic 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 Topic Resource
Get an existing Topic 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?: TopicState, opts?: CustomResourceOptions): Topic
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
instance_id: Optional[str] = None,
message_type: Optional[int] = None,
perm: Optional[int] = None,
remark: Optional[str] = None,
tags: Optional[Mapping[str, Any]] = None,
topic: Optional[str] = None,
topic_name: Optional[str] = None) -> Topic
func GetTopic(ctx *Context, name string, id IDInput, state *TopicState, opts ...ResourceOption) (*Topic, error)
public static Topic Get(string name, Input<string> id, TopicState? state, CustomResourceOptions? opts = null)
public static Topic get(String name, Output<String> id, TopicState 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.
- Instance
Id string ID of the ONS Instance that owns the topics.
- Message
Type int The type of the message. Read Ons Topic Create for further details.
- Perm int
This attribute has been deprecated.
Attribute perm has been deprecated and suggest removing it from your template.
- Remark string
This attribute is a concise description of topic. The length cannot exceed 128.
- Dictionary<string, object>
A mapping of tags to assign to the resource.
- Key: It can be up to 64 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It cannot be a null string.
- Value: It can be up to 128 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It can be a null string.
NOTE: At least one of
topic_name
andtopic
should be set.- Topic
Deprecated string Replaced by
topic_name
after version 1.97.0.Field 'topic' has been deprecated from version 1.97.0. Use 'topic_name' instead.
- Topic
Name string Name of the topic. Two topics on a single instance cannot have the same name and the name cannot start with 'GID' or 'CID'. The length cannot exceed 64 characters.
- Instance
Id string ID of the ONS Instance that owns the topics.
- Message
Type int The type of the message. Read Ons Topic Create for further details.
- Perm int
This attribute has been deprecated.
Attribute perm has been deprecated and suggest removing it from your template.
- Remark string
This attribute is a concise description of topic. The length cannot exceed 128.
- map[string]interface{}
A mapping of tags to assign to the resource.
- Key: It can be up to 64 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It cannot be a null string.
- Value: It can be up to 128 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It can be a null string.
NOTE: At least one of
topic_name
andtopic
should be set.- Topic string
Replaced by
topic_name
after version 1.97.0.Field 'topic' has been deprecated from version 1.97.0. Use 'topic_name' instead.
- Topic
Name string Name of the topic. Two topics on a single instance cannot have the same name and the name cannot start with 'GID' or 'CID'. The length cannot exceed 64 characters.
- instance
Id String ID of the ONS Instance that owns the topics.
- message
Type Integer The type of the message. Read Ons Topic Create for further details.
- perm Integer
This attribute has been deprecated.
Attribute perm has been deprecated and suggest removing it from your template.
- remark String
This attribute is a concise description of topic. The length cannot exceed 128.
- Map<String,Object>
A mapping of tags to assign to the resource.
- Key: It can be up to 64 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It cannot be a null string.
- Value: It can be up to 128 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It can be a null string.
NOTE: At least one of
topic_name
andtopic
should be set.- topic String
Replaced by
topic_name
after version 1.97.0.Field 'topic' has been deprecated from version 1.97.0. Use 'topic_name' instead.
- topic
Name String Name of the topic. Two topics on a single instance cannot have the same name and the name cannot start with 'GID' or 'CID'. The length cannot exceed 64 characters.
- instance
Id string ID of the ONS Instance that owns the topics.
- message
Type number The type of the message. Read Ons Topic Create for further details.
- perm number
This attribute has been deprecated.
Attribute perm has been deprecated and suggest removing it from your template.
- remark string
This attribute is a concise description of topic. The length cannot exceed 128.
- {[key: string]: any}
A mapping of tags to assign to the resource.
- Key: It can be up to 64 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It cannot be a null string.
- Value: It can be up to 128 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It can be a null string.
NOTE: At least one of
topic_name
andtopic
should be set.- topic string
Replaced by
topic_name
after version 1.97.0.Field 'topic' has been deprecated from version 1.97.0. Use 'topic_name' instead.
- topic
Name string Name of the topic. Two topics on a single instance cannot have the same name and the name cannot start with 'GID' or 'CID'. The length cannot exceed 64 characters.
- instance_
id str ID of the ONS Instance that owns the topics.
- message_
type int The type of the message. Read Ons Topic Create for further details.
- perm int
This attribute has been deprecated.
Attribute perm has been deprecated and suggest removing it from your template.
- remark str
This attribute is a concise description of topic. The length cannot exceed 128.
- Mapping[str, Any]
A mapping of tags to assign to the resource.
- Key: It can be up to 64 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It cannot be a null string.
- Value: It can be up to 128 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It can be a null string.
NOTE: At least one of
topic_name
andtopic
should be set.- topic str
Replaced by
topic_name
after version 1.97.0.Field 'topic' has been deprecated from version 1.97.0. Use 'topic_name' instead.
- topic_
name str Name of the topic. Two topics on a single instance cannot have the same name and the name cannot start with 'GID' or 'CID'. The length cannot exceed 64 characters.
- instance
Id String ID of the ONS Instance that owns the topics.
- message
Type Number The type of the message. Read Ons Topic Create for further details.
- perm Number
This attribute has been deprecated.
Attribute perm has been deprecated and suggest removing it from your template.
- remark String
This attribute is a concise description of topic. The length cannot exceed 128.
- Map<Any>
A mapping of tags to assign to the resource.
- Key: It can be up to 64 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It cannot be a null string.
- Value: It can be up to 128 characters in length. It cannot begin with "aliyun", "acs:", "http://", or "https://". It can be a null string.
NOTE: At least one of
topic_name
andtopic
should be set.- topic String
Replaced by
topic_name
after version 1.97.0.Field 'topic' has been deprecated from version 1.97.0. Use 'topic_name' instead.
- topic
Name String Name of the topic. Two topics on a single instance cannot have the same name and the name cannot start with 'GID' or 'CID'. The length cannot exceed 64 characters.
Import
ONS TOPIC can be imported using the id, e.g.
$ pulumi import alicloud:rocketmq/topic:Topic topic MQ_INST_1234567890_Baso1234567:onsTopicDemo
Package Details
- Repository
- Alibaba Cloud pulumi/pulumi-alicloud
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
alicloud
Terraform Provider.