1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. message
  5. ServiceTopic
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.message.ServiceTopic

Explore with Pulumi AI

Provides a Message Service Topic resource.

For information about Message Service Topic and how to use it, see What is Topic.

NOTE: Available since v1.188.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 = new alicloud.message.ServiceTopic("default", {
    topicName: name,
    maxMessageSize: 16888,
    enableLogging: true,
});
Copy
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "terraform-example"
default = alicloud.message.ServiceTopic("default",
    topic_name=name,
    max_message_size=16888,
    enable_logging=True)
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/message"
	"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
		}
		_, err := message.NewServiceTopic(ctx, "default", &message.ServiceTopicArgs{
			TopicName:      pulumi.String(name),
			MaxMessageSize: pulumi.Int(16888),
			EnableLogging:  pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
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 = new AliCloud.Message.ServiceTopic("default", new()
    {
        TopicName = name,
        MaxMessageSize = 16888,
        EnableLogging = true,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.message.ServiceTopic;
import com.pulumi.alicloud.message.ServiceTopicArgs;
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");
        var default_ = new ServiceTopic("default", ServiceTopicArgs.builder()
            .topicName(name)
            .maxMessageSize(16888)
            .enableLogging(true)
            .build());

    }
}
Copy
configuration:
  name:
    type: string
    default: terraform-example
resources:
  default:
    type: alicloud:message:ServiceTopic
    properties:
      topicName: ${name}
      maxMessageSize: 16888
      enableLogging: true
Copy

Create ServiceTopic Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ServiceTopic(name: string, args: ServiceTopicArgs, opts?: CustomResourceOptions);
@overload
def ServiceTopic(resource_name: str,
                 args: ServiceTopicArgs,
                 opts: Optional[ResourceOptions] = None)

@overload
def ServiceTopic(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 topic_name: Optional[str] = None,
                 enable_logging: Optional[bool] = None,
                 logging_enabled: Optional[bool] = None,
                 max_message_size: Optional[int] = None,
                 tags: Optional[Mapping[str, str]] = None)
func NewServiceTopic(ctx *Context, name string, args ServiceTopicArgs, opts ...ResourceOption) (*ServiceTopic, error)
public ServiceTopic(string name, ServiceTopicArgs args, CustomResourceOptions? opts = null)
public ServiceTopic(String name, ServiceTopicArgs args)
public ServiceTopic(String name, ServiceTopicArgs args, CustomResourceOptions options)
type: alicloud:message:ServiceTopic
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ServiceTopicArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ServiceTopicArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ServiceTopicArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ServiceTopicArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ServiceTopicArgs
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 serviceTopicResource = new AliCloud.Message.ServiceTopic("serviceTopicResource", new()
{
    TopicName = "string",
    EnableLogging = false,
    MaxMessageSize = 0,
    Tags = 
    {
        { "string", "string" },
    },
});
Copy
example, err := message.NewServiceTopic(ctx, "serviceTopicResource", &message.ServiceTopicArgs{
	TopicName:      pulumi.String("string"),
	EnableLogging:  pulumi.Bool(false),
	MaxMessageSize: pulumi.Int(0),
	Tags: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
})
Copy
var serviceTopicResource = new ServiceTopic("serviceTopicResource", ServiceTopicArgs.builder()
    .topicName("string")
    .enableLogging(false)
    .maxMessageSize(0)
    .tags(Map.of("string", "string"))
    .build());
Copy
service_topic_resource = alicloud.message.ServiceTopic("serviceTopicResource",
    topic_name="string",
    enable_logging=False,
    max_message_size=0,
    tags={
        "string": "string",
    })
Copy
const serviceTopicResource = new alicloud.message.ServiceTopic("serviceTopicResource", {
    topicName: "string",
    enableLogging: false,
    maxMessageSize: 0,
    tags: {
        string: "string",
    },
});
Copy
type: alicloud:message:ServiceTopic
properties:
    enableLogging: false
    maxMessageSize: 0
    tags:
        string: string
    topicName: string
Copy

ServiceTopic 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 ServiceTopic resource accepts the following input properties:

TopicName
This property is required.
Changes to this property will trigger replacement.
string

The name of the topic.

The following arguments will be discarded. Please use new fields as soon as possible:

EnableLogging bool
Specifies whether to enable the logging feature. Default value: false. Valid values:
LoggingEnabled bool
. Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

Deprecated: Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

MaxMessageSize int
The maximum length of the message that is sent to the topic. Default value: 65536. Valid values: 1024 to 65536. Unit: bytes.
Tags Dictionary<string, string>
A mapping of tags to assign to the resource.
TopicName
This property is required.
Changes to this property will trigger replacement.
string

The name of the topic.

The following arguments will be discarded. Please use new fields as soon as possible:

EnableLogging bool
Specifies whether to enable the logging feature. Default value: false. Valid values:
LoggingEnabled bool
. Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

Deprecated: Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

MaxMessageSize int
The maximum length of the message that is sent to the topic. Default value: 65536. Valid values: 1024 to 65536. Unit: bytes.
Tags map[string]string
A mapping of tags to assign to the resource.
topicName
This property is required.
Changes to this property will trigger replacement.
String

The name of the topic.

The following arguments will be discarded. Please use new fields as soon as possible:

enableLogging Boolean
Specifies whether to enable the logging feature. Default value: false. Valid values:
loggingEnabled Boolean
. Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

Deprecated: Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

maxMessageSize Integer
The maximum length of the message that is sent to the topic. Default value: 65536. Valid values: 1024 to 65536. Unit: bytes.
tags Map<String,String>
A mapping of tags to assign to the resource.
topicName
This property is required.
Changes to this property will trigger replacement.
string

The name of the topic.

The following arguments will be discarded. Please use new fields as soon as possible:

enableLogging boolean
Specifies whether to enable the logging feature. Default value: false. Valid values:
loggingEnabled boolean
. Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

Deprecated: Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

maxMessageSize number
The maximum length of the message that is sent to the topic. Default value: 65536. Valid values: 1024 to 65536. Unit: bytes.
tags {[key: string]: string}
A mapping of tags to assign to the resource.
topic_name
This property is required.
Changes to this property will trigger replacement.
str

The name of the topic.

The following arguments will be discarded. Please use new fields as soon as possible:

enable_logging bool
Specifies whether to enable the logging feature. Default value: false. Valid values:
logging_enabled bool
. Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

Deprecated: Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

max_message_size int
The maximum length of the message that is sent to the topic. Default value: 65536. Valid values: 1024 to 65536. Unit: bytes.
tags Mapping[str, str]
A mapping of tags to assign to the resource.
topicName
This property is required.
Changes to this property will trigger replacement.
String

The name of the topic.

The following arguments will be discarded. Please use new fields as soon as possible:

enableLogging Boolean
Specifies whether to enable the logging feature. Default value: false. Valid values:
loggingEnabled Boolean
. Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

Deprecated: Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

maxMessageSize Number
The maximum length of the message that is sent to the topic. Default value: 65536. Valid values: 1024 to 65536. Unit: bytes.
tags Map<String>
A mapping of tags to assign to the resource.

Outputs

All input properties are implicitly available as output properties. Additionally, the ServiceTopic resource produces the following output properties:

CreateTime string
(Available since v1.241.0) The time when the topic was created.
Id string
The provider-assigned unique ID for this managed resource.
CreateTime string
(Available since v1.241.0) The time when the topic was created.
Id string
The provider-assigned unique ID for this managed resource.
createTime String
(Available since v1.241.0) The time when the topic was created.
id String
The provider-assigned unique ID for this managed resource.
createTime string
(Available since v1.241.0) The time when the topic was created.
id string
The provider-assigned unique ID for this managed resource.
create_time str
(Available since v1.241.0) The time when the topic was created.
id str
The provider-assigned unique ID for this managed resource.
createTime String
(Available since v1.241.0) The time when the topic was created.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing ServiceTopic Resource

Get an existing ServiceTopic 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?: ServiceTopicState, opts?: CustomResourceOptions): ServiceTopic
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        create_time: Optional[str] = None,
        enable_logging: Optional[bool] = None,
        logging_enabled: Optional[bool] = None,
        max_message_size: Optional[int] = None,
        tags: Optional[Mapping[str, str]] = None,
        topic_name: Optional[str] = None) -> ServiceTopic
func GetServiceTopic(ctx *Context, name string, id IDInput, state *ServiceTopicState, opts ...ResourceOption) (*ServiceTopic, error)
public static ServiceTopic Get(string name, Input<string> id, ServiceTopicState? state, CustomResourceOptions? opts = null)
public static ServiceTopic get(String name, Output<String> id, ServiceTopicState state, CustomResourceOptions options)
resources:  _:    type: alicloud:message:ServiceTopic    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
CreateTime string
(Available since v1.241.0) The time when the topic was created.
EnableLogging bool
Specifies whether to enable the logging feature. Default value: false. Valid values:
LoggingEnabled bool
. Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

Deprecated: Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

MaxMessageSize int
The maximum length of the message that is sent to the topic. Default value: 65536. Valid values: 1024 to 65536. Unit: bytes.
Tags Dictionary<string, string>
A mapping of tags to assign to the resource.
TopicName Changes to this property will trigger replacement. string

The name of the topic.

The following arguments will be discarded. Please use new fields as soon as possible:

CreateTime string
(Available since v1.241.0) The time when the topic was created.
EnableLogging bool
Specifies whether to enable the logging feature. Default value: false. Valid values:
LoggingEnabled bool
. Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

Deprecated: Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

MaxMessageSize int
The maximum length of the message that is sent to the topic. Default value: 65536. Valid values: 1024 to 65536. Unit: bytes.
Tags map[string]string
A mapping of tags to assign to the resource.
TopicName Changes to this property will trigger replacement. string

The name of the topic.

The following arguments will be discarded. Please use new fields as soon as possible:

createTime String
(Available since v1.241.0) The time when the topic was created.
enableLogging Boolean
Specifies whether to enable the logging feature. Default value: false. Valid values:
loggingEnabled Boolean
. Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

Deprecated: Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

maxMessageSize Integer
The maximum length of the message that is sent to the topic. Default value: 65536. Valid values: 1024 to 65536. Unit: bytes.
tags Map<String,String>
A mapping of tags to assign to the resource.
topicName Changes to this property will trigger replacement. String

The name of the topic.

The following arguments will be discarded. Please use new fields as soon as possible:

createTime string
(Available since v1.241.0) The time when the topic was created.
enableLogging boolean
Specifies whether to enable the logging feature. Default value: false. Valid values:
loggingEnabled boolean
. Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

Deprecated: Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

maxMessageSize number
The maximum length of the message that is sent to the topic. Default value: 65536. Valid values: 1024 to 65536. Unit: bytes.
tags {[key: string]: string}
A mapping of tags to assign to the resource.
topicName Changes to this property will trigger replacement. string

The name of the topic.

The following arguments will be discarded. Please use new fields as soon as possible:

create_time str
(Available since v1.241.0) The time when the topic was created.
enable_logging bool
Specifies whether to enable the logging feature. Default value: false. Valid values:
logging_enabled bool
. Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

Deprecated: Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

max_message_size int
The maximum length of the message that is sent to the topic. Default value: 65536. Valid values: 1024 to 65536. Unit: bytes.
tags Mapping[str, str]
A mapping of tags to assign to the resource.
topic_name Changes to this property will trigger replacement. str

The name of the topic.

The following arguments will be discarded. Please use new fields as soon as possible:

createTime String
(Available since v1.241.0) The time when the topic was created.
enableLogging Boolean
Specifies whether to enable the logging feature. Default value: false. Valid values:
loggingEnabled Boolean
. Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

Deprecated: Field logging_enabled has been deprecated from provider version 1.241.0. New field enable_logging instead.

maxMessageSize Number
The maximum length of the message that is sent to the topic. Default value: 65536. Valid values: 1024 to 65536. Unit: bytes.
tags Map<String>
A mapping of tags to assign to the resource.
topicName Changes to this property will trigger replacement. String

The name of the topic.

The following arguments will be discarded. Please use new fields as soon as possible:

Import

Message Service Topic can be imported using the id, e.g.

$ pulumi import alicloud:message/serviceTopic:ServiceTopic example <id>
Copy

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.