1. Packages
  2. OVH
  3. API Docs
  4. CloudProjectDatabase
  5. KafkaTopic
OVHCloud v1.0.0 published on Wednesday, Oct 30, 2024 by OVHcloud

ovh.CloudProjectDatabase.KafkaTopic

Explore with Pulumi AI

ovh logo
OVHCloud v1.0.0 published on Wednesday, Oct 30, 2024 by OVHcloud

    Creates a topic for a kafka cluster associated with a public cloud project.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ovh from "@ovhcloud/pulumi-ovh";
    import * as ovh from "@pulumi/ovh";
    
    const kafka = ovh.CloudProjectDatabase.getDatabase({
        serviceName: "XXX",
        engine: "kafka",
        id: "ZZZ",
    });
    const topic = new ovh.cloudprojectdatabase.KafkaTopic("topic", {
        serviceName: kafka.then(kafka => kafka.serviceName),
        clusterId: kafka.then(kafka => kafka.id),
        minInsyncReplicas: 1,
        partitions: 3,
        replication: 2,
        retentionBytes: 4,
        retentionHours: 5,
    });
    
    import pulumi
    import pulumi_ovh as ovh
    
    kafka = ovh.CloudProjectDatabase.get_database(service_name="XXX",
        engine="kafka",
        id="ZZZ")
    topic = ovh.cloud_project_database.KafkaTopic("topic",
        service_name=kafka.service_name,
        cluster_id=kafka.id,
        min_insync_replicas=1,
        partitions=3,
        replication=2,
        retention_bytes=4,
        retention_hours=5)
    
    package main
    
    import (
    	"github.com/ovh/pulumi-ovh/sdk/go/ovh/CloudProjectDatabase"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		kafka, err := CloudProjectDatabase.GetDatabase(ctx, &cloudprojectdatabase.GetDatabaseArgs{
    			ServiceName: "XXX",
    			Engine:      "kafka",
    			Id:          "ZZZ",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = CloudProjectDatabase.NewKafkaTopic(ctx, "topic", &CloudProjectDatabase.KafkaTopicArgs{
    			ServiceName:       pulumi.String(kafka.ServiceName),
    			ClusterId:         pulumi.String(kafka.Id),
    			MinInsyncReplicas: pulumi.Int(1),
    			Partitions:        pulumi.Int(3),
    			Replication:       pulumi.Int(2),
    			RetentionBytes:    pulumi.Int(4),
    			RetentionHours:    pulumi.Int(5),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ovh = Pulumi.Ovh;
    
    return await Deployment.RunAsync(() => 
    {
        var kafka = Ovh.CloudProjectDatabase.GetDatabase.Invoke(new()
        {
            ServiceName = "XXX",
            Engine = "kafka",
            Id = "ZZZ",
        });
    
        var topic = new Ovh.CloudProjectDatabase.KafkaTopic("topic", new()
        {
            ServiceName = kafka.Apply(getDatabaseResult => getDatabaseResult.ServiceName),
            ClusterId = kafka.Apply(getDatabaseResult => getDatabaseResult.Id),
            MinInsyncReplicas = 1,
            Partitions = 3,
            Replication = 2,
            RetentionBytes = 4,
            RetentionHours = 5,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ovh.CloudProjectDatabase.CloudProjectDatabaseFunctions;
    import com.pulumi.ovh.CloudProjectDatabase.inputs.GetDatabaseArgs;
    import com.pulumi.ovh.CloudProjectDatabase.KafkaTopic;
    import com.pulumi.ovh.CloudProjectDatabase.KafkaTopicArgs;
    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 kafka = CloudProjectDatabaseFunctions.getDatabase(GetDatabaseArgs.builder()
                .serviceName("XXX")
                .engine("kafka")
                .id("ZZZ")
                .build());
    
            var topic = new KafkaTopic("topic", KafkaTopicArgs.builder()
                .serviceName(kafka.applyValue(getDatabaseResult -> getDatabaseResult.serviceName()))
                .clusterId(kafka.applyValue(getDatabaseResult -> getDatabaseResult.id()))
                .minInsyncReplicas(1)
                .partitions(3)
                .replication(2)
                .retentionBytes(4)
                .retentionHours(5)
                .build());
    
        }
    }
    
    resources:
      topic:
        type: ovh:CloudProjectDatabase:KafkaTopic
        properties:
          serviceName: ${kafka.serviceName}
          clusterId: ${kafka.id}
          minInsyncReplicas: 1
          partitions: 3
          replication: 2
          retentionBytes: 4
          retentionHours: 5
    variables:
      kafka:
        fn::invoke:
          Function: ovh:CloudProjectDatabase:getDatabase
          Arguments:
            serviceName: XXX
            engine: kafka
            id: ZZZ
    

    Create KafkaTopic Resource

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

    Constructor syntax

    new KafkaTopic(name: string, args: KafkaTopicArgs, opts?: CustomResourceOptions);
    @overload
    def KafkaTopic(resource_name: str,
                   args: KafkaTopicArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def KafkaTopic(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   cluster_id: Optional[str] = None,
                   service_name: Optional[str] = None,
                   min_insync_replicas: Optional[int] = None,
                   name: Optional[str] = None,
                   partitions: Optional[int] = None,
                   replication: Optional[int] = None,
                   retention_bytes: Optional[int] = None,
                   retention_hours: Optional[int] = None)
    func NewKafkaTopic(ctx *Context, name string, args KafkaTopicArgs, opts ...ResourceOption) (*KafkaTopic, error)
    public KafkaTopic(string name, KafkaTopicArgs args, CustomResourceOptions? opts = null)
    public KafkaTopic(String name, KafkaTopicArgs args)
    public KafkaTopic(String name, KafkaTopicArgs args, CustomResourceOptions options)
    
    type: ovh:CloudProjectDatabase:KafkaTopic
    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 KafkaTopicArgs
    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 KafkaTopicArgs
    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 KafkaTopicArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args KafkaTopicArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args KafkaTopicArgs
    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 kafkaTopicResource = new Ovh.CloudProjectDatabase.KafkaTopic("kafkaTopicResource", new()
    {
        ClusterId = "string",
        ServiceName = "string",
        MinInsyncReplicas = 0,
        Name = "string",
        Partitions = 0,
        Replication = 0,
        RetentionBytes = 0,
        RetentionHours = 0,
    });
    
    example, err := CloudProjectDatabase.NewKafkaTopic(ctx, "kafkaTopicResource", &CloudProjectDatabase.KafkaTopicArgs{
    	ClusterId:         pulumi.String("string"),
    	ServiceName:       pulumi.String("string"),
    	MinInsyncReplicas: pulumi.Int(0),
    	Name:              pulumi.String("string"),
    	Partitions:        pulumi.Int(0),
    	Replication:       pulumi.Int(0),
    	RetentionBytes:    pulumi.Int(0),
    	RetentionHours:    pulumi.Int(0),
    })
    
    var kafkaTopicResource = new KafkaTopic("kafkaTopicResource", KafkaTopicArgs.builder()
        .clusterId("string")
        .serviceName("string")
        .minInsyncReplicas(0)
        .name("string")
        .partitions(0)
        .replication(0)
        .retentionBytes(0)
        .retentionHours(0)
        .build());
    
    kafka_topic_resource = ovh.cloud_project_database.KafkaTopic("kafkaTopicResource",
        cluster_id="string",
        service_name="string",
        min_insync_replicas=0,
        name="string",
        partitions=0,
        replication=0,
        retention_bytes=0,
        retention_hours=0)
    
    const kafkaTopicResource = new ovh.cloudprojectdatabase.KafkaTopic("kafkaTopicResource", {
        clusterId: "string",
        serviceName: "string",
        minInsyncReplicas: 0,
        name: "string",
        partitions: 0,
        replication: 0,
        retentionBytes: 0,
        retentionHours: 0,
    });
    
    type: ovh:CloudProjectDatabase:KafkaTopic
    properties:
        clusterId: string
        minInsyncReplicas: 0
        name: string
        partitions: 0
        replication: 0
        retentionBytes: 0
        retentionHours: 0
        serviceName: string
    

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

    ClusterId string
    Cluster ID.
    ServiceName string
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    MinInsyncReplicas int
    Minimum insync replica accepted for this topic. Should be superior to 0
    Name string
    Name of the topic. No spaces allowed.
    Partitions int
    Number of partitions for this topic. Should be superior to 0
    Replication int
    Number of replication for this topic. Should be superior to 1
    RetentionBytes int
    Number of bytes for the retention of the data for this topic. Inferior to 0 means unlimited
    RetentionHours int
    Number of hours for the retention of the data for this topic. Should be superior to -2. Inferior to 0 means unlimited
    ClusterId string
    Cluster ID.
    ServiceName string
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    MinInsyncReplicas int
    Minimum insync replica accepted for this topic. Should be superior to 0
    Name string
    Name of the topic. No spaces allowed.
    Partitions int
    Number of partitions for this topic. Should be superior to 0
    Replication int
    Number of replication for this topic. Should be superior to 1
    RetentionBytes int
    Number of bytes for the retention of the data for this topic. Inferior to 0 means unlimited
    RetentionHours int
    Number of hours for the retention of the data for this topic. Should be superior to -2. Inferior to 0 means unlimited
    clusterId String
    Cluster ID.
    serviceName String
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    minInsyncReplicas Integer
    Minimum insync replica accepted for this topic. Should be superior to 0
    name String
    Name of the topic. No spaces allowed.
    partitions Integer
    Number of partitions for this topic. Should be superior to 0
    replication Integer
    Number of replication for this topic. Should be superior to 1
    retentionBytes Integer
    Number of bytes for the retention of the data for this topic. Inferior to 0 means unlimited
    retentionHours Integer
    Number of hours for the retention of the data for this topic. Should be superior to -2. Inferior to 0 means unlimited
    clusterId string
    Cluster ID.
    serviceName string
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    minInsyncReplicas number
    Minimum insync replica accepted for this topic. Should be superior to 0
    name string
    Name of the topic. No spaces allowed.
    partitions number
    Number of partitions for this topic. Should be superior to 0
    replication number
    Number of replication for this topic. Should be superior to 1
    retentionBytes number
    Number of bytes for the retention of the data for this topic. Inferior to 0 means unlimited
    retentionHours number
    Number of hours for the retention of the data for this topic. Should be superior to -2. Inferior to 0 means unlimited
    cluster_id str
    Cluster ID.
    service_name str
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    min_insync_replicas int
    Minimum insync replica accepted for this topic. Should be superior to 0
    name str
    Name of the topic. No spaces allowed.
    partitions int
    Number of partitions for this topic. Should be superior to 0
    replication int
    Number of replication for this topic. Should be superior to 1
    retention_bytes int
    Number of bytes for the retention of the data for this topic. Inferior to 0 means unlimited
    retention_hours int
    Number of hours for the retention of the data for this topic. Should be superior to -2. Inferior to 0 means unlimited
    clusterId String
    Cluster ID.
    serviceName String
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    minInsyncReplicas Number
    Minimum insync replica accepted for this topic. Should be superior to 0
    name String
    Name of the topic. No spaces allowed.
    partitions Number
    Number of partitions for this topic. Should be superior to 0
    replication Number
    Number of replication for this topic. Should be superior to 1
    retentionBytes Number
    Number of bytes for the retention of the data for this topic. Inferior to 0 means unlimited
    retentionHours Number
    Number of hours for the retention of the data for this topic. Should be superior to -2. Inferior to 0 means unlimited

    Outputs

    All input properties are implicitly available as output properties. Additionally, the KafkaTopic 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 KafkaTopic Resource

    Get an existing KafkaTopic 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?: KafkaTopicState, opts?: CustomResourceOptions): KafkaTopic
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cluster_id: Optional[str] = None,
            min_insync_replicas: Optional[int] = None,
            name: Optional[str] = None,
            partitions: Optional[int] = None,
            replication: Optional[int] = None,
            retention_bytes: Optional[int] = None,
            retention_hours: Optional[int] = None,
            service_name: Optional[str] = None) -> KafkaTopic
    func GetKafkaTopic(ctx *Context, name string, id IDInput, state *KafkaTopicState, opts ...ResourceOption) (*KafkaTopic, error)
    public static KafkaTopic Get(string name, Input<string> id, KafkaTopicState? state, CustomResourceOptions? opts = null)
    public static KafkaTopic get(String name, Output<String> id, KafkaTopicState 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.
    The following state arguments are supported:
    ClusterId string
    Cluster ID.
    MinInsyncReplicas int
    Minimum insync replica accepted for this topic. Should be superior to 0
    Name string
    Name of the topic. No spaces allowed.
    Partitions int
    Number of partitions for this topic. Should be superior to 0
    Replication int
    Number of replication for this topic. Should be superior to 1
    RetentionBytes int
    Number of bytes for the retention of the data for this topic. Inferior to 0 means unlimited
    RetentionHours int
    Number of hours for the retention of the data for this topic. Should be superior to -2. Inferior to 0 means unlimited
    ServiceName string
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    ClusterId string
    Cluster ID.
    MinInsyncReplicas int
    Minimum insync replica accepted for this topic. Should be superior to 0
    Name string
    Name of the topic. No spaces allowed.
    Partitions int
    Number of partitions for this topic. Should be superior to 0
    Replication int
    Number of replication for this topic. Should be superior to 1
    RetentionBytes int
    Number of bytes for the retention of the data for this topic. Inferior to 0 means unlimited
    RetentionHours int
    Number of hours for the retention of the data for this topic. Should be superior to -2. Inferior to 0 means unlimited
    ServiceName string
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    clusterId String
    Cluster ID.
    minInsyncReplicas Integer
    Minimum insync replica accepted for this topic. Should be superior to 0
    name String
    Name of the topic. No spaces allowed.
    partitions Integer
    Number of partitions for this topic. Should be superior to 0
    replication Integer
    Number of replication for this topic. Should be superior to 1
    retentionBytes Integer
    Number of bytes for the retention of the data for this topic. Inferior to 0 means unlimited
    retentionHours Integer
    Number of hours for the retention of the data for this topic. Should be superior to -2. Inferior to 0 means unlimited
    serviceName String
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    clusterId string
    Cluster ID.
    minInsyncReplicas number
    Minimum insync replica accepted for this topic. Should be superior to 0
    name string
    Name of the topic. No spaces allowed.
    partitions number
    Number of partitions for this topic. Should be superior to 0
    replication number
    Number of replication for this topic. Should be superior to 1
    retentionBytes number
    Number of bytes for the retention of the data for this topic. Inferior to 0 means unlimited
    retentionHours number
    Number of hours for the retention of the data for this topic. Should be superior to -2. Inferior to 0 means unlimited
    serviceName string
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    cluster_id str
    Cluster ID.
    min_insync_replicas int
    Minimum insync replica accepted for this topic. Should be superior to 0
    name str
    Name of the topic. No spaces allowed.
    partitions int
    Number of partitions for this topic. Should be superior to 0
    replication int
    Number of replication for this topic. Should be superior to 1
    retention_bytes int
    Number of bytes for the retention of the data for this topic. Inferior to 0 means unlimited
    retention_hours int
    Number of hours for the retention of the data for this topic. Should be superior to -2. Inferior to 0 means unlimited
    service_name str
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.
    clusterId String
    Cluster ID.
    minInsyncReplicas Number
    Minimum insync replica accepted for this topic. Should be superior to 0
    name String
    Name of the topic. No spaces allowed.
    partitions Number
    Number of partitions for this topic. Should be superior to 0
    replication Number
    Number of replication for this topic. Should be superior to 1
    retentionBytes Number
    Number of bytes for the retention of the data for this topic. Inferior to 0 means unlimited
    retentionHours Number
    Number of hours for the retention of the data for this topic. Should be superior to -2. Inferior to 0 means unlimited
    serviceName String
    The id of the public cloud project. If omitted, the OVH_CLOUD_PROJECT_SERVICE environment variable is used.

    Import

    OVHcloud Managed kafka clusters topics can be imported using the service_name, cluster_id and id of the topic, separated by “/” E.g.,

    bash

    $ pulumi import ovh:CloudProjectDatabase/kafkaTopic:KafkaTopic my_topic service_name/cluster_id/id
    

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

    Package Details

    Repository
    ovh ovh/pulumi-ovh
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the ovh Terraform Provider.
    ovh logo
    OVHCloud v1.0.0 published on Wednesday, Oct 30, 2024 by OVHcloud