1. Packages
  2. Ibm Provider
  3. API Docs
  4. EventStreamsTopic
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

ibm.EventStreamsTopic

Explore with Pulumi AI

ibm logo
ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud

    Create and update the Event Streams. For more information, about Event Streams topics, see Event Streams.

    Example Usage

    Sample 2 create a topic on an existing Event Streams instance

    Create topic on an existing Event Streams instance.The owner of the ibmcloud_api_key has permission to create Event Streams instance in a specified resource group. However, you need the manager role to create the instance in order to create topic.

    import * as pulumi from "@pulumi/pulumi";
    import * as ibm from "@pulumi/ibm";
    
    const esInstance2 = ibm.getResourceInstance({
        name: "terraform-integration-2",
        resourceGroupId: data.ibm_resource_group.group.id,
    });
    const esTopic2 = new ibm.EventStreamsTopic("esTopic2", {
        resourceInstanceId: esInstance2.then(esInstance2 => esInstance2.id),
        partitions: 1,
        config: {
            "cleanup.policy": "compact,delete",
            "retention.ms": "86400000",
            "retention.bytes": "1073741824",
            "segment.bytes": "536870912",
        },
    });
    
    import pulumi
    import pulumi_ibm as ibm
    
    es_instance2 = ibm.get_resource_instance(name="terraform-integration-2",
        resource_group_id=data["ibm_resource_group"]["group"]["id"])
    es_topic2 = ibm.EventStreamsTopic("esTopic2",
        resource_instance_id=es_instance2.id,
        partitions=1,
        config={
            "cleanup.policy": "compact,delete",
            "retention.ms": "86400000",
            "retention.bytes": "1073741824",
            "segment.bytes": "536870912",
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/ibm"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		esInstance2, err := ibm.LookupResourceInstance(ctx, &ibm.LookupResourceInstanceArgs{
    			Name:            pulumi.StringRef("terraform-integration-2"),
    			ResourceGroupId: pulumi.StringRef(data.Ibm_resource_group.Group.Id),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = ibm.NewEventStreamsTopic(ctx, "esTopic2", &ibm.EventStreamsTopicArgs{
    			ResourceInstanceId: pulumi.String(esInstance2.Id),
    			Partitions:         pulumi.Float64(1),
    			Config: pulumi.StringMap{
    				"cleanup.policy":  pulumi.String("compact,delete"),
    				"retention.ms":    pulumi.String("86400000"),
    				"retention.bytes": pulumi.String("1073741824"),
    				"segment.bytes":   pulumi.String("536870912"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ibm = Pulumi.Ibm;
    
    return await Deployment.RunAsync(() => 
    {
        var esInstance2 = Ibm.GetResourceInstance.Invoke(new()
        {
            Name = "terraform-integration-2",
            ResourceGroupId = data.Ibm_resource_group.Group.Id,
        });
    
        var esTopic2 = new Ibm.EventStreamsTopic("esTopic2", new()
        {
            ResourceInstanceId = esInstance2.Apply(getResourceInstanceResult => getResourceInstanceResult.Id),
            Partitions = 1,
            Config = 
            {
                { "cleanup.policy", "compact,delete" },
                { "retention.ms", "86400000" },
                { "retention.bytes", "1073741824" },
                { "segment.bytes", "536870912" },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ibm.IbmFunctions;
    import com.pulumi.ibm.inputs.GetResourceInstanceArgs;
    import com.pulumi.ibm.EventStreamsTopic;
    import com.pulumi.ibm.EventStreamsTopicArgs;
    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 esInstance2 = IbmFunctions.getResourceInstance(GetResourceInstanceArgs.builder()
                .name("terraform-integration-2")
                .resourceGroupId(data.ibm_resource_group().group().id())
                .build());
    
            var esTopic2 = new EventStreamsTopic("esTopic2", EventStreamsTopicArgs.builder()
                .resourceInstanceId(esInstance2.applyValue(getResourceInstanceResult -> getResourceInstanceResult.id()))
                .partitions(1)
                .config(Map.ofEntries(
                    Map.entry("cleanup.policy", "compact,delete"),
                    Map.entry("retention.ms", "86400000"),
                    Map.entry("retention.bytes", "1073741824"),
                    Map.entry("segment.bytes", "536870912")
                ))
                .build());
    
        }
    }
    
    resources:
      esTopic2:
        type: ibm:EventStreamsTopic
        properties:
          resourceInstanceId: ${esInstance2.id}
          partitions: 1
          config:
            cleanup.policy: compact,delete
            retention.ms: '86400000'
            retention.bytes: '1073741824'
            segment.bytes: '536870912'
    variables:
      esInstance2:
        fn::invoke:
          function: ibm:getResourceInstance
          arguments:
            name: terraform-integration-2
            resourceGroupId: ${data.ibm_resource_group.group.id}
    

    Create EventStreamsTopic Resource

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

    Constructor syntax

    new EventStreamsTopic(name: string, args: EventStreamsTopicArgs, opts?: CustomResourceOptions);
    @overload
    def EventStreamsTopic(resource_name: str,
                          args: EventStreamsTopicArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def EventStreamsTopic(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          resource_instance_id: Optional[str] = None,
                          config: Optional[Mapping[str, str]] = None,
                          event_streams_topic_id: Optional[str] = None,
                          name: Optional[str] = None,
                          partitions: Optional[float] = None)
    func NewEventStreamsTopic(ctx *Context, name string, args EventStreamsTopicArgs, opts ...ResourceOption) (*EventStreamsTopic, error)
    public EventStreamsTopic(string name, EventStreamsTopicArgs args, CustomResourceOptions? opts = null)
    public EventStreamsTopic(String name, EventStreamsTopicArgs args)
    public EventStreamsTopic(String name, EventStreamsTopicArgs args, CustomResourceOptions options)
    
    type: ibm:EventStreamsTopic
    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 EventStreamsTopicArgs
    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 EventStreamsTopicArgs
    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 EventStreamsTopicArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args EventStreamsTopicArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args EventStreamsTopicArgs
    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 eventStreamsTopicResource = new Ibm.EventStreamsTopic("eventStreamsTopicResource", new()
    {
        ResourceInstanceId = "string",
        Config = 
        {
            { "string", "string" },
        },
        EventStreamsTopicId = "string",
        Name = "string",
        Partitions = 0,
    });
    
    example, err := ibm.NewEventStreamsTopic(ctx, "eventStreamsTopicResource", &ibm.EventStreamsTopicArgs{
    	ResourceInstanceId: pulumi.String("string"),
    	Config: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	EventStreamsTopicId: pulumi.String("string"),
    	Name:                pulumi.String("string"),
    	Partitions:          pulumi.Float64(0),
    })
    
    var eventStreamsTopicResource = new EventStreamsTopic("eventStreamsTopicResource", EventStreamsTopicArgs.builder()
        .resourceInstanceId("string")
        .config(Map.of("string", "string"))
        .eventStreamsTopicId("string")
        .name("string")
        .partitions(0)
        .build());
    
    event_streams_topic_resource = ibm.EventStreamsTopic("eventStreamsTopicResource",
        resource_instance_id="string",
        config={
            "string": "string",
        },
        event_streams_topic_id="string",
        name="string",
        partitions=0)
    
    const eventStreamsTopicResource = new ibm.EventStreamsTopic("eventStreamsTopicResource", {
        resourceInstanceId: "string",
        config: {
            string: "string",
        },
        eventStreamsTopicId: "string",
        name: "string",
        partitions: 0,
    });
    
    type: ibm:EventStreamsTopic
    properties:
        config:
            string: string
        eventStreamsTopicId: string
        name: string
        partitions: 0
        resourceInstanceId: string
    

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

    ResourceInstanceId string
    The ID or the CRN of the Event Streams service instance.
    Config Dictionary<string, string>
    The configuration parameters of the topic. Supported configurations are: cleanup.policy, retention.ms, retention.bytes, segment.bytes, segment.ms, segment.index.bytes.
    EventStreamsTopicId string
    (String) The ID of the topic in CRN format. For example, `crn:v1:bluemix:public:messagehub:us-south:a/6db1b0d0b5c54ee5c201552547febcd8:cb5a0252-8b8d-4390-b017-80b743d32839:topic:my-es-topic.
    Name string
    The name of the topic.
    Partitions double
    The number of partitions of the topic. Default value is 1.
    ResourceInstanceId string
    The ID or the CRN of the Event Streams service instance.
    Config map[string]string
    The configuration parameters of the topic. Supported configurations are: cleanup.policy, retention.ms, retention.bytes, segment.bytes, segment.ms, segment.index.bytes.
    EventStreamsTopicId string
    (String) The ID of the topic in CRN format. For example, `crn:v1:bluemix:public:messagehub:us-south:a/6db1b0d0b5c54ee5c201552547febcd8:cb5a0252-8b8d-4390-b017-80b743d32839:topic:my-es-topic.
    Name string
    The name of the topic.
    Partitions float64
    The number of partitions of the topic. Default value is 1.
    resourceInstanceId String
    The ID or the CRN of the Event Streams service instance.
    config Map<String,String>
    The configuration parameters of the topic. Supported configurations are: cleanup.policy, retention.ms, retention.bytes, segment.bytes, segment.ms, segment.index.bytes.
    eventStreamsTopicId String
    (String) The ID of the topic in CRN format. For example, `crn:v1:bluemix:public:messagehub:us-south:a/6db1b0d0b5c54ee5c201552547febcd8:cb5a0252-8b8d-4390-b017-80b743d32839:topic:my-es-topic.
    name String
    The name of the topic.
    partitions Double
    The number of partitions of the topic. Default value is 1.
    resourceInstanceId string
    The ID or the CRN of the Event Streams service instance.
    config {[key: string]: string}
    The configuration parameters of the topic. Supported configurations are: cleanup.policy, retention.ms, retention.bytes, segment.bytes, segment.ms, segment.index.bytes.
    eventStreamsTopicId string
    (String) The ID of the topic in CRN format. For example, `crn:v1:bluemix:public:messagehub:us-south:a/6db1b0d0b5c54ee5c201552547febcd8:cb5a0252-8b8d-4390-b017-80b743d32839:topic:my-es-topic.
    name string
    The name of the topic.
    partitions number
    The number of partitions of the topic. Default value is 1.
    resource_instance_id str
    The ID or the CRN of the Event Streams service instance.
    config Mapping[str, str]
    The configuration parameters of the topic. Supported configurations are: cleanup.policy, retention.ms, retention.bytes, segment.bytes, segment.ms, segment.index.bytes.
    event_streams_topic_id str
    (String) The ID of the topic in CRN format. For example, `crn:v1:bluemix:public:messagehub:us-south:a/6db1b0d0b5c54ee5c201552547febcd8:cb5a0252-8b8d-4390-b017-80b743d32839:topic:my-es-topic.
    name str
    The name of the topic.
    partitions float
    The number of partitions of the topic. Default value is 1.
    resourceInstanceId String
    The ID or the CRN of the Event Streams service instance.
    config Map<String>
    The configuration parameters of the topic. Supported configurations are: cleanup.policy, retention.ms, retention.bytes, segment.bytes, segment.ms, segment.index.bytes.
    eventStreamsTopicId String
    (String) The ID of the topic in CRN format. For example, `crn:v1:bluemix:public:messagehub:us-south:a/6db1b0d0b5c54ee5c201552547febcd8:cb5a0252-8b8d-4390-b017-80b743d32839:topic:my-es-topic.
    name String
    The name of the topic.
    partitions Number
    The number of partitions of the topic. Default value is 1.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    KafkaBrokersSasls List<string>
    (Array of Strings) Kafka brokers use for interacting with Kafka native API.
    KafkaHttpUrl string
    (String) The API endpoint for interacting with Event Streams REST API.
    Id string
    The provider-assigned unique ID for this managed resource.
    KafkaBrokersSasls []string
    (Array of Strings) Kafka brokers use for interacting with Kafka native API.
    KafkaHttpUrl string
    (String) The API endpoint for interacting with Event Streams REST API.
    id String
    The provider-assigned unique ID for this managed resource.
    kafkaBrokersSasls List<String>
    (Array of Strings) Kafka brokers use for interacting with Kafka native API.
    kafkaHttpUrl String
    (String) The API endpoint for interacting with Event Streams REST API.
    id string
    The provider-assigned unique ID for this managed resource.
    kafkaBrokersSasls string[]
    (Array of Strings) Kafka brokers use for interacting with Kafka native API.
    kafkaHttpUrl string
    (String) The API endpoint for interacting with Event Streams REST API.
    id str
    The provider-assigned unique ID for this managed resource.
    kafka_brokers_sasls Sequence[str]
    (Array of Strings) Kafka brokers use for interacting with Kafka native API.
    kafka_http_url str
    (String) The API endpoint for interacting with Event Streams REST API.
    id String
    The provider-assigned unique ID for this managed resource.
    kafkaBrokersSasls List<String>
    (Array of Strings) Kafka brokers use for interacting with Kafka native API.
    kafkaHttpUrl String
    (String) The API endpoint for interacting with Event Streams REST API.

    Look up Existing EventStreamsTopic Resource

    Get an existing EventStreamsTopic 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?: EventStreamsTopicState, opts?: CustomResourceOptions): EventStreamsTopic
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            config: Optional[Mapping[str, str]] = None,
            event_streams_topic_id: Optional[str] = None,
            kafka_brokers_sasls: Optional[Sequence[str]] = None,
            kafka_http_url: Optional[str] = None,
            name: Optional[str] = None,
            partitions: Optional[float] = None,
            resource_instance_id: Optional[str] = None) -> EventStreamsTopic
    func GetEventStreamsTopic(ctx *Context, name string, id IDInput, state *EventStreamsTopicState, opts ...ResourceOption) (*EventStreamsTopic, error)
    public static EventStreamsTopic Get(string name, Input<string> id, EventStreamsTopicState? state, CustomResourceOptions? opts = null)
    public static EventStreamsTopic get(String name, Output<String> id, EventStreamsTopicState state, CustomResourceOptions options)
    resources:  _:    type: ibm:EventStreamsTopic    get:      id: ${id}
    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:
    Config Dictionary<string, string>
    The configuration parameters of the topic. Supported configurations are: cleanup.policy, retention.ms, retention.bytes, segment.bytes, segment.ms, segment.index.bytes.
    EventStreamsTopicId string
    (String) The ID of the topic in CRN format. For example, `crn:v1:bluemix:public:messagehub:us-south:a/6db1b0d0b5c54ee5c201552547febcd8:cb5a0252-8b8d-4390-b017-80b743d32839:topic:my-es-topic.
    KafkaBrokersSasls List<string>
    (Array of Strings) Kafka brokers use for interacting with Kafka native API.
    KafkaHttpUrl string
    (String) The API endpoint for interacting with Event Streams REST API.
    Name string
    The name of the topic.
    Partitions double
    The number of partitions of the topic. Default value is 1.
    ResourceInstanceId string
    The ID or the CRN of the Event Streams service instance.
    Config map[string]string
    The configuration parameters of the topic. Supported configurations are: cleanup.policy, retention.ms, retention.bytes, segment.bytes, segment.ms, segment.index.bytes.
    EventStreamsTopicId string
    (String) The ID of the topic in CRN format. For example, `crn:v1:bluemix:public:messagehub:us-south:a/6db1b0d0b5c54ee5c201552547febcd8:cb5a0252-8b8d-4390-b017-80b743d32839:topic:my-es-topic.
    KafkaBrokersSasls []string
    (Array of Strings) Kafka brokers use for interacting with Kafka native API.
    KafkaHttpUrl string
    (String) The API endpoint for interacting with Event Streams REST API.
    Name string
    The name of the topic.
    Partitions float64
    The number of partitions of the topic. Default value is 1.
    ResourceInstanceId string
    The ID or the CRN of the Event Streams service instance.
    config Map<String,String>
    The configuration parameters of the topic. Supported configurations are: cleanup.policy, retention.ms, retention.bytes, segment.bytes, segment.ms, segment.index.bytes.
    eventStreamsTopicId String
    (String) The ID of the topic in CRN format. For example, `crn:v1:bluemix:public:messagehub:us-south:a/6db1b0d0b5c54ee5c201552547febcd8:cb5a0252-8b8d-4390-b017-80b743d32839:topic:my-es-topic.
    kafkaBrokersSasls List<String>
    (Array of Strings) Kafka brokers use for interacting with Kafka native API.
    kafkaHttpUrl String
    (String) The API endpoint for interacting with Event Streams REST API.
    name String
    The name of the topic.
    partitions Double
    The number of partitions of the topic. Default value is 1.
    resourceInstanceId String
    The ID or the CRN of the Event Streams service instance.
    config {[key: string]: string}
    The configuration parameters of the topic. Supported configurations are: cleanup.policy, retention.ms, retention.bytes, segment.bytes, segment.ms, segment.index.bytes.
    eventStreamsTopicId string
    (String) The ID of the topic in CRN format. For example, `crn:v1:bluemix:public:messagehub:us-south:a/6db1b0d0b5c54ee5c201552547febcd8:cb5a0252-8b8d-4390-b017-80b743d32839:topic:my-es-topic.
    kafkaBrokersSasls string[]
    (Array of Strings) Kafka brokers use for interacting with Kafka native API.
    kafkaHttpUrl string
    (String) The API endpoint for interacting with Event Streams REST API.
    name string
    The name of the topic.
    partitions number
    The number of partitions of the topic. Default value is 1.
    resourceInstanceId string
    The ID or the CRN of the Event Streams service instance.
    config Mapping[str, str]
    The configuration parameters of the topic. Supported configurations are: cleanup.policy, retention.ms, retention.bytes, segment.bytes, segment.ms, segment.index.bytes.
    event_streams_topic_id str
    (String) The ID of the topic in CRN format. For example, `crn:v1:bluemix:public:messagehub:us-south:a/6db1b0d0b5c54ee5c201552547febcd8:cb5a0252-8b8d-4390-b017-80b743d32839:topic:my-es-topic.
    kafka_brokers_sasls Sequence[str]
    (Array of Strings) Kafka brokers use for interacting with Kafka native API.
    kafka_http_url str
    (String) The API endpoint for interacting with Event Streams REST API.
    name str
    The name of the topic.
    partitions float
    The number of partitions of the topic. Default value is 1.
    resource_instance_id str
    The ID or the CRN of the Event Streams service instance.
    config Map<String>
    The configuration parameters of the topic. Supported configurations are: cleanup.policy, retention.ms, retention.bytes, segment.bytes, segment.ms, segment.index.bytes.
    eventStreamsTopicId String
    (String) The ID of the topic in CRN format. For example, `crn:v1:bluemix:public:messagehub:us-south:a/6db1b0d0b5c54ee5c201552547febcd8:cb5a0252-8b8d-4390-b017-80b743d32839:topic:my-es-topic.
    kafkaBrokersSasls List<String>
    (Array of Strings) Kafka brokers use for interacting with Kafka native API.
    kafkaHttpUrl String
    (String) The API endpoint for interacting with Event Streams REST API.
    name String
    The name of the topic.
    partitions Number
    The number of partitions of the topic. Default value is 1.
    resourceInstanceId String
    The ID or the CRN of the Event Streams service instance.

    Import

    The ibm_event_streams_topic resource can be imported by using CRN. The three parameters of the CRN with the colon separator are

    • ID = CRN
    • resource type = topic
    • resource = name of the topic.

    Syntax

    $ pulumi import ibm:index/eventStreamsTopic:EventStreamsTopic es_topic <crn>
    

    Example

    $ pulumi import ibm:index/eventStreamsTopic:EventStreamsTopic es_topic crn:v1:bluemix:public:messagehub:us-south:a/6db1b0d0b5c54ee5c201552547febcd8:cb5a0252-8b8d-4390-b017-80b743d32839:topic:my-es-topic
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    ibm ibm-cloud/terraform-provider-ibm
    License
    Notes
    This Pulumi package is based on the ibm Terraform Provider.
    ibm logo
    ibm 1.78.0 published on Wednesday, Apr 30, 2025 by ibm-cloud