1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. pubsub
  5. Topic
Google Cloud Classic v7.20.0 published on Wednesday, Apr 24, 2024 by Pulumi

gcp.pubsub.Topic

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.20.0 published on Wednesday, Apr 24, 2024 by Pulumi

    A named resource to which messages are sent by publishers.

    To get more information about Topic, see:

    Note: You can retrieve the email of the Google Managed Pub/Sub Service Account used for forwarding by using the gcp.projects.ServiceIdentity resource.

    Example Usage

    Pubsub Topic Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const example = new gcp.pubsub.Topic("example", {
        name: "example-topic",
        labels: {
            foo: "bar",
        },
        messageRetentionDuration: "86600s",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    example = gcp.pubsub.Topic("example",
        name="example-topic",
        labels={
            "foo": "bar",
        },
        message_retention_duration="86600s")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
    			Name: pulumi.String("example-topic"),
    			Labels: pulumi.StringMap{
    				"foo": pulumi.String("bar"),
    			},
    			MessageRetentionDuration: pulumi.String("86600s"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Gcp.PubSub.Topic("example", new()
        {
            Name = "example-topic",
            Labels = 
            {
                { "foo", "bar" },
            },
            MessageRetentionDuration = "86600s",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.pubsub.Topic;
    import com.pulumi.gcp.pubsub.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) {
            var example = new Topic("example", TopicArgs.builder()        
                .name("example-topic")
                .labels(Map.of("foo", "bar"))
                .messageRetentionDuration("86600s")
                .build());
    
        }
    }
    
    resources:
      example:
        type: gcp:pubsub:Topic
        properties:
          name: example-topic
          labels:
            foo: bar
          messageRetentionDuration: 86600s
    

    Pubsub Topic Cmek

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const keyRing = new gcp.kms.KeyRing("key_ring", {
        name: "example-keyring",
        location: "global",
    });
    const cryptoKey = new gcp.kms.CryptoKey("crypto_key", {
        name: "example-key",
        keyRing: keyRing.id,
    });
    const example = new gcp.pubsub.Topic("example", {
        name: "example-topic",
        kmsKeyName: cryptoKey.id,
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    key_ring = gcp.kms.KeyRing("key_ring",
        name="example-keyring",
        location="global")
    crypto_key = gcp.kms.CryptoKey("crypto_key",
        name="example-key",
        key_ring=key_ring.id)
    example = gcp.pubsub.Topic("example",
        name="example-topic",
        kms_key_name=crypto_key.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/kms"
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		keyRing, err := kms.NewKeyRing(ctx, "key_ring", &kms.KeyRingArgs{
    			Name:     pulumi.String("example-keyring"),
    			Location: pulumi.String("global"),
    		})
    		if err != nil {
    			return err
    		}
    		cryptoKey, err := kms.NewCryptoKey(ctx, "crypto_key", &kms.CryptoKeyArgs{
    			Name:    pulumi.String("example-key"),
    			KeyRing: keyRing.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
    			Name:       pulumi.String("example-topic"),
    			KmsKeyName: cryptoKey.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var keyRing = new Gcp.Kms.KeyRing("key_ring", new()
        {
            Name = "example-keyring",
            Location = "global",
        });
    
        var cryptoKey = new Gcp.Kms.CryptoKey("crypto_key", new()
        {
            Name = "example-key",
            KeyRing = keyRing.Id,
        });
    
        var example = new Gcp.PubSub.Topic("example", new()
        {
            Name = "example-topic",
            KmsKeyName = cryptoKey.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.kms.KeyRing;
    import com.pulumi.gcp.kms.KeyRingArgs;
    import com.pulumi.gcp.kms.CryptoKey;
    import com.pulumi.gcp.kms.CryptoKeyArgs;
    import com.pulumi.gcp.pubsub.Topic;
    import com.pulumi.gcp.pubsub.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) {
            var keyRing = new KeyRing("keyRing", KeyRingArgs.builder()        
                .name("example-keyring")
                .location("global")
                .build());
    
            var cryptoKey = new CryptoKey("cryptoKey", CryptoKeyArgs.builder()        
                .name("example-key")
                .keyRing(keyRing.id())
                .build());
    
            var example = new Topic("example", TopicArgs.builder()        
                .name("example-topic")
                .kmsKeyName(cryptoKey.id())
                .build());
    
        }
    }
    
    resources:
      example:
        type: gcp:pubsub:Topic
        properties:
          name: example-topic
          kmsKeyName: ${cryptoKey.id}
      cryptoKey:
        type: gcp:kms:CryptoKey
        name: crypto_key
        properties:
          name: example-key
          keyRing: ${keyRing.id}
      keyRing:
        type: gcp:kms:KeyRing
        name: key_ring
        properties:
          name: example-keyring
          location: global
    

    Pubsub Topic Geo Restricted

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const example = new gcp.pubsub.Topic("example", {
        name: "example-topic",
        messageStoragePolicy: {
            allowedPersistenceRegions: ["europe-west3"],
        },
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    example = gcp.pubsub.Topic("example",
        name="example-topic",
        message_storage_policy=gcp.pubsub.TopicMessageStoragePolicyArgs(
            allowed_persistence_regions=["europe-west3"],
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
    			Name: pulumi.String("example-topic"),
    			MessageStoragePolicy: &pubsub.TopicMessageStoragePolicyArgs{
    				AllowedPersistenceRegions: pulumi.StringArray{
    					pulumi.String("europe-west3"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Gcp.PubSub.Topic("example", new()
        {
            Name = "example-topic",
            MessageStoragePolicy = new Gcp.PubSub.Inputs.TopicMessageStoragePolicyArgs
            {
                AllowedPersistenceRegions = new[]
                {
                    "europe-west3",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.pubsub.Topic;
    import com.pulumi.gcp.pubsub.TopicArgs;
    import com.pulumi.gcp.pubsub.inputs.TopicMessageStoragePolicyArgs;
    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) {
            var example = new Topic("example", TopicArgs.builder()        
                .name("example-topic")
                .messageStoragePolicy(TopicMessageStoragePolicyArgs.builder()
                    .allowedPersistenceRegions("europe-west3")
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: gcp:pubsub:Topic
        properties:
          name: example-topic
          messageStoragePolicy:
            allowedPersistenceRegions:
              - europe-west3
    

    Pubsub Topic Schema Settings

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const example = new gcp.pubsub.Schema("example", {
        name: "example",
        type: "AVRO",
        definition: `{
      "type" : "record",
      "name" : "Avro",
      "fields" : [
        {
          "name" : "StringField",
          "type" : "string"
        },
        {
          "name" : "IntField",
          "type" : "int"
        }
      ]
    }
    `,
    });
    const exampleTopic = new gcp.pubsub.Topic("example", {
        name: "example-topic",
        schemaSettings: {
            schema: "projects/my-project-name/schemas/example",
            encoding: "JSON",
        },
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    example = gcp.pubsub.Schema("example",
        name="example",
        type="AVRO",
        definition="""{
      "type" : "record",
      "name" : "Avro",
      "fields" : [
        {
          "name" : "StringField",
          "type" : "string"
        },
        {
          "name" : "IntField",
          "type" : "int"
        }
      ]
    }
    """)
    example_topic = gcp.pubsub.Topic("example",
        name="example-topic",
        schema_settings=gcp.pubsub.TopicSchemaSettingsArgs(
            schema="projects/my-project-name/schemas/example",
            encoding="JSON",
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := pubsub.NewSchema(ctx, "example", &pubsub.SchemaArgs{
    			Name: pulumi.String("example"),
    			Type: pulumi.String("AVRO"),
    			Definition: pulumi.String(`{
      "type" : "record",
      "name" : "Avro",
      "fields" : [
        {
          "name" : "StringField",
          "type" : "string"
        },
        {
          "name" : "IntField",
          "type" : "int"
        }
      ]
    }
    `),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
    			Name: pulumi.String("example-topic"),
    			SchemaSettings: &pubsub.TopicSchemaSettingsArgs{
    				Schema:   pulumi.String("projects/my-project-name/schemas/example"),
    				Encoding: pulumi.String("JSON"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Gcp.PubSub.Schema("example", new()
        {
            Name = "example",
            Type = "AVRO",
            Definition = @"{
      ""type"" : ""record"",
      ""name"" : ""Avro"",
      ""fields"" : [
        {
          ""name"" : ""StringField"",
          ""type"" : ""string""
        },
        {
          ""name"" : ""IntField"",
          ""type"" : ""int""
        }
      ]
    }
    ",
        });
    
        var exampleTopic = new Gcp.PubSub.Topic("example", new()
        {
            Name = "example-topic",
            SchemaSettings = new Gcp.PubSub.Inputs.TopicSchemaSettingsArgs
            {
                Schema = "projects/my-project-name/schemas/example",
                Encoding = "JSON",
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.pubsub.Schema;
    import com.pulumi.gcp.pubsub.SchemaArgs;
    import com.pulumi.gcp.pubsub.Topic;
    import com.pulumi.gcp.pubsub.TopicArgs;
    import com.pulumi.gcp.pubsub.inputs.TopicSchemaSettingsArgs;
    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) {
            var example = new Schema("example", SchemaArgs.builder()        
                .name("example")
                .type("AVRO")
                .definition("""
    {
      "type" : "record",
      "name" : "Avro",
      "fields" : [
        {
          "name" : "StringField",
          "type" : "string"
        },
        {
          "name" : "IntField",
          "type" : "int"
        }
      ]
    }
                """)
                .build());
    
            var exampleTopic = new Topic("exampleTopic", TopicArgs.builder()        
                .name("example-topic")
                .schemaSettings(TopicSchemaSettingsArgs.builder()
                    .schema("projects/my-project-name/schemas/example")
                    .encoding("JSON")
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: gcp:pubsub:Schema
        properties:
          name: example
          type: AVRO
          definition: |
            {
              "type" : "record",
              "name" : "Avro",
              "fields" : [
                {
                  "name" : "StringField",
                  "type" : "string"
                },
                {
                  "name" : "IntField",
                  "type" : "int"
                }
              ]
            }        
      exampleTopic:
        type: gcp:pubsub:Topic
        name: example
        properties:
          name: example-topic
          schemaSettings:
            schema: projects/my-project-name/schemas/example
            encoding: JSON
    

    Pubsub Topic Ingestion Kinesis

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const example = new gcp.pubsub.Topic("example", {
        name: "example-topic",
        ingestionDataSourceSettings: {
            awsKinesis: {
                streamArn: "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name",
                consumerArn: "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111",
                awsRoleArn: "arn:aws:iam::111111111111:role/fake-role-name",
                gcpServiceAccount: "fake-service-account@fake-gcp-project.iam.gserviceaccount.com",
            },
        },
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    example = gcp.pubsub.Topic("example",
        name="example-topic",
        ingestion_data_source_settings=gcp.pubsub.TopicIngestionDataSourceSettingsArgs(
            aws_kinesis=gcp.pubsub.TopicIngestionDataSourceSettingsAwsKinesisArgs(
                stream_arn="arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name",
                consumer_arn="arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111",
                aws_role_arn="arn:aws:iam::111111111111:role/fake-role-name",
                gcp_service_account="fake-service-account@fake-gcp-project.iam.gserviceaccount.com",
            ),
        ))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
    			Name: pulumi.String("example-topic"),
    			IngestionDataSourceSettings: &pubsub.TopicIngestionDataSourceSettingsArgs{
    				AwsKinesis: &pubsub.TopicIngestionDataSourceSettingsAwsKinesisArgs{
    					StreamArn:         pulumi.String("arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name"),
    					ConsumerArn:       pulumi.String("arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111"),
    					AwsRoleArn:        pulumi.String("arn:aws:iam::111111111111:role/fake-role-name"),
    					GcpServiceAccount: pulumi.String("fake-service-account@fake-gcp-project.iam.gserviceaccount.com"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Gcp.PubSub.Topic("example", new()
        {
            Name = "example-topic",
            IngestionDataSourceSettings = new Gcp.PubSub.Inputs.TopicIngestionDataSourceSettingsArgs
            {
                AwsKinesis = new Gcp.PubSub.Inputs.TopicIngestionDataSourceSettingsAwsKinesisArgs
                {
                    StreamArn = "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name",
                    ConsumerArn = "arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111",
                    AwsRoleArn = "arn:aws:iam::111111111111:role/fake-role-name",
                    GcpServiceAccount = "fake-service-account@fake-gcp-project.iam.gserviceaccount.com",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.pubsub.Topic;
    import com.pulumi.gcp.pubsub.TopicArgs;
    import com.pulumi.gcp.pubsub.inputs.TopicIngestionDataSourceSettingsArgs;
    import com.pulumi.gcp.pubsub.inputs.TopicIngestionDataSourceSettingsAwsKinesisArgs;
    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) {
            var example = new Topic("example", TopicArgs.builder()        
                .name("example-topic")
                .ingestionDataSourceSettings(TopicIngestionDataSourceSettingsArgs.builder()
                    .awsKinesis(TopicIngestionDataSourceSettingsAwsKinesisArgs.builder()
                        .streamArn("arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name")
                        .consumerArn("arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111")
                        .awsRoleArn("arn:aws:iam::111111111111:role/fake-role-name")
                        .gcpServiceAccount("fake-service-account@fake-gcp-project.iam.gserviceaccount.com")
                        .build())
                    .build())
                .build());
    
        }
    }
    
    resources:
      example:
        type: gcp:pubsub:Topic
        properties:
          name: example-topic
          ingestionDataSourceSettings:
            awsKinesis:
              streamArn: arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name
              consumerArn: arn:aws:kinesis:us-west-2:111111111111:stream/fake-stream-name/consumer/consumer-1:1111111111
              awsRoleArn: arn:aws:iam::111111111111:role/fake-role-name
              gcpServiceAccount: fake-service-account@fake-gcp-project.iam.gserviceaccount.com
    

    Create Topic Resource

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

    Constructor syntax

    new Topic(name: string, args?: TopicArgs, opts?: CustomResourceOptions);
    @overload
    def Topic(resource_name: str,
              args: Optional[TopicArgs] = None,
              opts: Optional[ResourceOptions] = None)
    
    @overload
    def Topic(resource_name: str,
              opts: Optional[ResourceOptions] = None,
              ingestion_data_source_settings: Optional[TopicIngestionDataSourceSettingsArgs] = None,
              kms_key_name: Optional[str] = None,
              labels: Optional[Mapping[str, str]] = None,
              message_retention_duration: Optional[str] = None,
              message_storage_policy: Optional[TopicMessageStoragePolicyArgs] = None,
              name: Optional[str] = None,
              project: Optional[str] = None,
              schema_settings: Optional[TopicSchemaSettingsArgs] = None)
    func NewTopic(ctx *Context, name string, args *TopicArgs, opts ...ResourceOption) (*Topic, error)
    public Topic(string name, TopicArgs? args = null, CustomResourceOptions? opts = null)
    public Topic(String name, TopicArgs args)
    public Topic(String name, TopicArgs args, CustomResourceOptions options)
    
    type: gcp:pubsub:Topic
    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 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.

    Example

    The following reference example uses placeholder values for all input properties.

    var topicResource = new Gcp.PubSub.Topic("topicResource", new()
    {
        IngestionDataSourceSettings = new Gcp.PubSub.Inputs.TopicIngestionDataSourceSettingsArgs
        {
            AwsKinesis = new Gcp.PubSub.Inputs.TopicIngestionDataSourceSettingsAwsKinesisArgs
            {
                AwsRoleArn = "string",
                ConsumerArn = "string",
                GcpServiceAccount = "string",
                StreamArn = "string",
            },
        },
        KmsKeyName = "string",
        Labels = 
        {
            { "string", "string" },
        },
        MessageRetentionDuration = "string",
        MessageStoragePolicy = new Gcp.PubSub.Inputs.TopicMessageStoragePolicyArgs
        {
            AllowedPersistenceRegions = new[]
            {
                "string",
            },
        },
        Name = "string",
        Project = "string",
        SchemaSettings = new Gcp.PubSub.Inputs.TopicSchemaSettingsArgs
        {
            Schema = "string",
            Encoding = "string",
        },
    });
    
    example, err := pubsub.NewTopic(ctx, "topicResource", &pubsub.TopicArgs{
    	IngestionDataSourceSettings: &pubsub.TopicIngestionDataSourceSettingsArgs{
    		AwsKinesis: &pubsub.TopicIngestionDataSourceSettingsAwsKinesisArgs{
    			AwsRoleArn:        pulumi.String("string"),
    			ConsumerArn:       pulumi.String("string"),
    			GcpServiceAccount: pulumi.String("string"),
    			StreamArn:         pulumi.String("string"),
    		},
    	},
    	KmsKeyName: pulumi.String("string"),
    	Labels: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	MessageRetentionDuration: pulumi.String("string"),
    	MessageStoragePolicy: &pubsub.TopicMessageStoragePolicyArgs{
    		AllowedPersistenceRegions: pulumi.StringArray{
    			pulumi.String("string"),
    		},
    	},
    	Name:    pulumi.String("string"),
    	Project: pulumi.String("string"),
    	SchemaSettings: &pubsub.TopicSchemaSettingsArgs{
    		Schema:   pulumi.String("string"),
    		Encoding: pulumi.String("string"),
    	},
    })
    
    var topicResource = new Topic("topicResource", TopicArgs.builder()        
        .ingestionDataSourceSettings(TopicIngestionDataSourceSettingsArgs.builder()
            .awsKinesis(TopicIngestionDataSourceSettingsAwsKinesisArgs.builder()
                .awsRoleArn("string")
                .consumerArn("string")
                .gcpServiceAccount("string")
                .streamArn("string")
                .build())
            .build())
        .kmsKeyName("string")
        .labels(Map.of("string", "string"))
        .messageRetentionDuration("string")
        .messageStoragePolicy(TopicMessageStoragePolicyArgs.builder()
            .allowedPersistenceRegions("string")
            .build())
        .name("string")
        .project("string")
        .schemaSettings(TopicSchemaSettingsArgs.builder()
            .schema("string")
            .encoding("string")
            .build())
        .build());
    
    topic_resource = gcp.pubsub.Topic("topicResource",
        ingestion_data_source_settings=gcp.pubsub.TopicIngestionDataSourceSettingsArgs(
            aws_kinesis=gcp.pubsub.TopicIngestionDataSourceSettingsAwsKinesisArgs(
                aws_role_arn="string",
                consumer_arn="string",
                gcp_service_account="string",
                stream_arn="string",
            ),
        ),
        kms_key_name="string",
        labels={
            "string": "string",
        },
        message_retention_duration="string",
        message_storage_policy=gcp.pubsub.TopicMessageStoragePolicyArgs(
            allowed_persistence_regions=["string"],
        ),
        name="string",
        project="string",
        schema_settings=gcp.pubsub.TopicSchemaSettingsArgs(
            schema="string",
            encoding="string",
        ))
    
    const topicResource = new gcp.pubsub.Topic("topicResource", {
        ingestionDataSourceSettings: {
            awsKinesis: {
                awsRoleArn: "string",
                consumerArn: "string",
                gcpServiceAccount: "string",
                streamArn: "string",
            },
        },
        kmsKeyName: "string",
        labels: {
            string: "string",
        },
        messageRetentionDuration: "string",
        messageStoragePolicy: {
            allowedPersistenceRegions: ["string"],
        },
        name: "string",
        project: "string",
        schemaSettings: {
            schema: "string",
            encoding: "string",
        },
    });
    
    type: gcp:pubsub:Topic
    properties:
        ingestionDataSourceSettings:
            awsKinesis:
                awsRoleArn: string
                consumerArn: string
                gcpServiceAccount: string
                streamArn: string
        kmsKeyName: string
        labels:
            string: string
        messageRetentionDuration: string
        messageStoragePolicy:
            allowedPersistenceRegions:
                - string
        name: string
        project: string
        schemaSettings:
            encoding: string
            schema: string
    

    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:

    IngestionDataSourceSettings TopicIngestionDataSourceSettings
    Settings for ingestion from a data source into this topic. Structure is documented below.
    KmsKeyName string
    The resource name of the Cloud KMS CryptoKey to be used to protect access to messages published on this topic. Your project's PubSub service account (service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com) must have roles/cloudkms.cryptoKeyEncrypterDecrypter to use this feature. The expected format is projects/*/locations/*/keyRings/*/cryptoKeys/*
    Labels Dictionary<string, string>

    A set of key/value label pairs to assign to this Topic.

    Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.

    MessageRetentionDuration string
    Indicates the minimum duration to retain a message after it is published to the topic. If this field is set, messages published to the topic in the last messageRetentionDuration are always available to subscribers. For instance, it allows any attached subscription to seek to a timestamp that is up to messageRetentionDuration in the past. If this field is not set, message retention is controlled by settings on individual subscriptions. The rotation period has the format of a decimal number, followed by the letter s (seconds). Cannot be more than 31 days or less than 10 minutes.
    MessageStoragePolicy TopicMessageStoragePolicy
    Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored. If not present, then no constraints are in effect. Structure is documented below.
    Name string
    Name of the topic.


    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    SchemaSettings TopicSchemaSettings
    Settings for validating messages published against a schema. Structure is documented below.
    IngestionDataSourceSettings TopicIngestionDataSourceSettingsArgs
    Settings for ingestion from a data source into this topic. Structure is documented below.
    KmsKeyName string
    The resource name of the Cloud KMS CryptoKey to be used to protect access to messages published on this topic. Your project's PubSub service account (service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com) must have roles/cloudkms.cryptoKeyEncrypterDecrypter to use this feature. The expected format is projects/*/locations/*/keyRings/*/cryptoKeys/*
    Labels map[string]string

    A set of key/value label pairs to assign to this Topic.

    Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.

    MessageRetentionDuration string
    Indicates the minimum duration to retain a message after it is published to the topic. If this field is set, messages published to the topic in the last messageRetentionDuration are always available to subscribers. For instance, it allows any attached subscription to seek to a timestamp that is up to messageRetentionDuration in the past. If this field is not set, message retention is controlled by settings on individual subscriptions. The rotation period has the format of a decimal number, followed by the letter s (seconds). Cannot be more than 31 days or less than 10 minutes.
    MessageStoragePolicy TopicMessageStoragePolicyArgs
    Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored. If not present, then no constraints are in effect. Structure is documented below.
    Name string
    Name of the topic.


    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    SchemaSettings TopicSchemaSettingsArgs
    Settings for validating messages published against a schema. Structure is documented below.
    ingestionDataSourceSettings TopicIngestionDataSourceSettings
    Settings for ingestion from a data source into this topic. Structure is documented below.
    kmsKeyName String
    The resource name of the Cloud KMS CryptoKey to be used to protect access to messages published on this topic. Your project's PubSub service account (service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com) must have roles/cloudkms.cryptoKeyEncrypterDecrypter to use this feature. The expected format is projects/*/locations/*/keyRings/*/cryptoKeys/*
    labels Map<String,String>

    A set of key/value label pairs to assign to this Topic.

    Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.

    messageRetentionDuration String
    Indicates the minimum duration to retain a message after it is published to the topic. If this field is set, messages published to the topic in the last messageRetentionDuration are always available to subscribers. For instance, it allows any attached subscription to seek to a timestamp that is up to messageRetentionDuration in the past. If this field is not set, message retention is controlled by settings on individual subscriptions. The rotation period has the format of a decimal number, followed by the letter s (seconds). Cannot be more than 31 days or less than 10 minutes.
    messageStoragePolicy TopicMessageStoragePolicy
    Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored. If not present, then no constraints are in effect. Structure is documented below.
    name String
    Name of the topic.


    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    schemaSettings TopicSchemaSettings
    Settings for validating messages published against a schema. Structure is documented below.
    ingestionDataSourceSettings TopicIngestionDataSourceSettings
    Settings for ingestion from a data source into this topic. Structure is documented below.
    kmsKeyName string
    The resource name of the Cloud KMS CryptoKey to be used to protect access to messages published on this topic. Your project's PubSub service account (service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com) must have roles/cloudkms.cryptoKeyEncrypterDecrypter to use this feature. The expected format is projects/*/locations/*/keyRings/*/cryptoKeys/*
    labels {[key: string]: string}

    A set of key/value label pairs to assign to this Topic.

    Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.

    messageRetentionDuration string
    Indicates the minimum duration to retain a message after it is published to the topic. If this field is set, messages published to the topic in the last messageRetentionDuration are always available to subscribers. For instance, it allows any attached subscription to seek to a timestamp that is up to messageRetentionDuration in the past. If this field is not set, message retention is controlled by settings on individual subscriptions. The rotation period has the format of a decimal number, followed by the letter s (seconds). Cannot be more than 31 days or less than 10 minutes.
    messageStoragePolicy TopicMessageStoragePolicy
    Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored. If not present, then no constraints are in effect. Structure is documented below.
    name string
    Name of the topic.


    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    schemaSettings TopicSchemaSettings
    Settings for validating messages published against a schema. Structure is documented below.
    ingestion_data_source_settings TopicIngestionDataSourceSettingsArgs
    Settings for ingestion from a data source into this topic. Structure is documented below.
    kms_key_name str
    The resource name of the Cloud KMS CryptoKey to be used to protect access to messages published on this topic. Your project's PubSub service account (service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com) must have roles/cloudkms.cryptoKeyEncrypterDecrypter to use this feature. The expected format is projects/*/locations/*/keyRings/*/cryptoKeys/*
    labels Mapping[str, str]

    A set of key/value label pairs to assign to this Topic.

    Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.

    message_retention_duration str
    Indicates the minimum duration to retain a message after it is published to the topic. If this field is set, messages published to the topic in the last messageRetentionDuration are always available to subscribers. For instance, it allows any attached subscription to seek to a timestamp that is up to messageRetentionDuration in the past. If this field is not set, message retention is controlled by settings on individual subscriptions. The rotation period has the format of a decimal number, followed by the letter s (seconds). Cannot be more than 31 days or less than 10 minutes.
    message_storage_policy TopicMessageStoragePolicyArgs
    Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored. If not present, then no constraints are in effect. Structure is documented below.
    name str
    Name of the topic.


    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    schema_settings TopicSchemaSettingsArgs
    Settings for validating messages published against a schema. Structure is documented below.
    ingestionDataSourceSettings Property Map
    Settings for ingestion from a data source into this topic. Structure is documented below.
    kmsKeyName String
    The resource name of the Cloud KMS CryptoKey to be used to protect access to messages published on this topic. Your project's PubSub service account (service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com) must have roles/cloudkms.cryptoKeyEncrypterDecrypter to use this feature. The expected format is projects/*/locations/*/keyRings/*/cryptoKeys/*
    labels Map<String>

    A set of key/value label pairs to assign to this Topic.

    Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.

    messageRetentionDuration String
    Indicates the minimum duration to retain a message after it is published to the topic. If this field is set, messages published to the topic in the last messageRetentionDuration are always available to subscribers. For instance, it allows any attached subscription to seek to a timestamp that is up to messageRetentionDuration in the past. If this field is not set, message retention is controlled by settings on individual subscriptions. The rotation period has the format of a decimal number, followed by the letter s (seconds). Cannot be more than 31 days or less than 10 minutes.
    messageStoragePolicy Property Map
    Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored. If not present, then no constraints are in effect. Structure is documented below.
    name String
    Name of the topic.


    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    schemaSettings Property Map
    Settings for validating messages published against a schema. Structure is documented below.

    Outputs

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

    EffectiveLabels Dictionary<string, string>
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    Id string
    The provider-assigned unique ID for this managed resource.
    PulumiLabels Dictionary<string, string>
    The combination of labels configured directly on the resource and default labels configured on the provider.
    EffectiveLabels map[string]string
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    Id string
    The provider-assigned unique ID for this managed resource.
    PulumiLabels map[string]string
    The combination of labels configured directly on the resource and default labels configured on the provider.
    effectiveLabels Map<String,String>
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    id String
    The provider-assigned unique ID for this managed resource.
    pulumiLabels Map<String,String>
    The combination of labels configured directly on the resource and default labels configured on the provider.
    effectiveLabels {[key: string]: string}
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    id string
    The provider-assigned unique ID for this managed resource.
    pulumiLabels {[key: string]: string}
    The combination of labels configured directly on the resource and default labels configured on the provider.
    effective_labels Mapping[str, str]
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    id str
    The provider-assigned unique ID for this managed resource.
    pulumi_labels Mapping[str, str]
    The combination of labels configured directly on the resource and default labels configured on the provider.
    effectiveLabels Map<String>
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    id String
    The provider-assigned unique ID for this managed resource.
    pulumiLabels Map<String>
    The combination of labels configured directly on the resource and default labels configured on the provider.

    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,
            effective_labels: Optional[Mapping[str, str]] = None,
            ingestion_data_source_settings: Optional[TopicIngestionDataSourceSettingsArgs] = None,
            kms_key_name: Optional[str] = None,
            labels: Optional[Mapping[str, str]] = None,
            message_retention_duration: Optional[str] = None,
            message_storage_policy: Optional[TopicMessageStoragePolicyArgs] = None,
            name: Optional[str] = None,
            project: Optional[str] = None,
            pulumi_labels: Optional[Mapping[str, str]] = None,
            schema_settings: Optional[TopicSchemaSettingsArgs] = 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.
    The following state arguments are supported:
    EffectiveLabels Dictionary<string, string>
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    IngestionDataSourceSettings TopicIngestionDataSourceSettings
    Settings for ingestion from a data source into this topic. Structure is documented below.
    KmsKeyName string
    The resource name of the Cloud KMS CryptoKey to be used to protect access to messages published on this topic. Your project's PubSub service account (service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com) must have roles/cloudkms.cryptoKeyEncrypterDecrypter to use this feature. The expected format is projects/*/locations/*/keyRings/*/cryptoKeys/*
    Labels Dictionary<string, string>

    A set of key/value label pairs to assign to this Topic.

    Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.

    MessageRetentionDuration string
    Indicates the minimum duration to retain a message after it is published to the topic. If this field is set, messages published to the topic in the last messageRetentionDuration are always available to subscribers. For instance, it allows any attached subscription to seek to a timestamp that is up to messageRetentionDuration in the past. If this field is not set, message retention is controlled by settings on individual subscriptions. The rotation period has the format of a decimal number, followed by the letter s (seconds). Cannot be more than 31 days or less than 10 minutes.
    MessageStoragePolicy TopicMessageStoragePolicy
    Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored. If not present, then no constraints are in effect. Structure is documented below.
    Name string
    Name of the topic.


    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    PulumiLabels Dictionary<string, string>
    The combination of labels configured directly on the resource and default labels configured on the provider.
    SchemaSettings TopicSchemaSettings
    Settings for validating messages published against a schema. Structure is documented below.
    EffectiveLabels map[string]string
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    IngestionDataSourceSettings TopicIngestionDataSourceSettingsArgs
    Settings for ingestion from a data source into this topic. Structure is documented below.
    KmsKeyName string
    The resource name of the Cloud KMS CryptoKey to be used to protect access to messages published on this topic. Your project's PubSub service account (service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com) must have roles/cloudkms.cryptoKeyEncrypterDecrypter to use this feature. The expected format is projects/*/locations/*/keyRings/*/cryptoKeys/*
    Labels map[string]string

    A set of key/value label pairs to assign to this Topic.

    Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.

    MessageRetentionDuration string
    Indicates the minimum duration to retain a message after it is published to the topic. If this field is set, messages published to the topic in the last messageRetentionDuration are always available to subscribers. For instance, it allows any attached subscription to seek to a timestamp that is up to messageRetentionDuration in the past. If this field is not set, message retention is controlled by settings on individual subscriptions. The rotation period has the format of a decimal number, followed by the letter s (seconds). Cannot be more than 31 days or less than 10 minutes.
    MessageStoragePolicy TopicMessageStoragePolicyArgs
    Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored. If not present, then no constraints are in effect. Structure is documented below.
    Name string
    Name of the topic.


    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    PulumiLabels map[string]string
    The combination of labels configured directly on the resource and default labels configured on the provider.
    SchemaSettings TopicSchemaSettingsArgs
    Settings for validating messages published against a schema. Structure is documented below.
    effectiveLabels Map<String,String>
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    ingestionDataSourceSettings TopicIngestionDataSourceSettings
    Settings for ingestion from a data source into this topic. Structure is documented below.
    kmsKeyName String
    The resource name of the Cloud KMS CryptoKey to be used to protect access to messages published on this topic. Your project's PubSub service account (service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com) must have roles/cloudkms.cryptoKeyEncrypterDecrypter to use this feature. The expected format is projects/*/locations/*/keyRings/*/cryptoKeys/*
    labels Map<String,String>

    A set of key/value label pairs to assign to this Topic.

    Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.

    messageRetentionDuration String
    Indicates the minimum duration to retain a message after it is published to the topic. If this field is set, messages published to the topic in the last messageRetentionDuration are always available to subscribers. For instance, it allows any attached subscription to seek to a timestamp that is up to messageRetentionDuration in the past. If this field is not set, message retention is controlled by settings on individual subscriptions. The rotation period has the format of a decimal number, followed by the letter s (seconds). Cannot be more than 31 days or less than 10 minutes.
    messageStoragePolicy TopicMessageStoragePolicy
    Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored. If not present, then no constraints are in effect. Structure is documented below.
    name String
    Name of the topic.


    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    pulumiLabels Map<String,String>
    The combination of labels configured directly on the resource and default labels configured on the provider.
    schemaSettings TopicSchemaSettings
    Settings for validating messages published against a schema. Structure is documented below.
    effectiveLabels {[key: string]: string}
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    ingestionDataSourceSettings TopicIngestionDataSourceSettings
    Settings for ingestion from a data source into this topic. Structure is documented below.
    kmsKeyName string
    The resource name of the Cloud KMS CryptoKey to be used to protect access to messages published on this topic. Your project's PubSub service account (service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com) must have roles/cloudkms.cryptoKeyEncrypterDecrypter to use this feature. The expected format is projects/*/locations/*/keyRings/*/cryptoKeys/*
    labels {[key: string]: string}

    A set of key/value label pairs to assign to this Topic.

    Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.

    messageRetentionDuration string
    Indicates the minimum duration to retain a message after it is published to the topic. If this field is set, messages published to the topic in the last messageRetentionDuration are always available to subscribers. For instance, it allows any attached subscription to seek to a timestamp that is up to messageRetentionDuration in the past. If this field is not set, message retention is controlled by settings on individual subscriptions. The rotation period has the format of a decimal number, followed by the letter s (seconds). Cannot be more than 31 days or less than 10 minutes.
    messageStoragePolicy TopicMessageStoragePolicy
    Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored. If not present, then no constraints are in effect. Structure is documented below.
    name string
    Name of the topic.


    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    pulumiLabels {[key: string]: string}
    The combination of labels configured directly on the resource and default labels configured on the provider.
    schemaSettings TopicSchemaSettings
    Settings for validating messages published against a schema. Structure is documented below.
    effective_labels Mapping[str, str]
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    ingestion_data_source_settings TopicIngestionDataSourceSettingsArgs
    Settings for ingestion from a data source into this topic. Structure is documented below.
    kms_key_name str
    The resource name of the Cloud KMS CryptoKey to be used to protect access to messages published on this topic. Your project's PubSub service account (service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com) must have roles/cloudkms.cryptoKeyEncrypterDecrypter to use this feature. The expected format is projects/*/locations/*/keyRings/*/cryptoKeys/*
    labels Mapping[str, str]

    A set of key/value label pairs to assign to this Topic.

    Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.

    message_retention_duration str
    Indicates the minimum duration to retain a message after it is published to the topic. If this field is set, messages published to the topic in the last messageRetentionDuration are always available to subscribers. For instance, it allows any attached subscription to seek to a timestamp that is up to messageRetentionDuration in the past. If this field is not set, message retention is controlled by settings on individual subscriptions. The rotation period has the format of a decimal number, followed by the letter s (seconds). Cannot be more than 31 days or less than 10 minutes.
    message_storage_policy TopicMessageStoragePolicyArgs
    Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored. If not present, then no constraints are in effect. Structure is documented below.
    name str
    Name of the topic.


    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    pulumi_labels Mapping[str, str]
    The combination of labels configured directly on the resource and default labels configured on the provider.
    schema_settings TopicSchemaSettingsArgs
    Settings for validating messages published against a schema. Structure is documented below.
    effectiveLabels Map<String>
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    ingestionDataSourceSettings Property Map
    Settings for ingestion from a data source into this topic. Structure is documented below.
    kmsKeyName String
    The resource name of the Cloud KMS CryptoKey to be used to protect access to messages published on this topic. Your project's PubSub service account (service-{{PROJECT_NUMBER}}@gcp-sa-pubsub.iam.gserviceaccount.com) must have roles/cloudkms.cryptoKeyEncrypterDecrypter to use this feature. The expected format is projects/*/locations/*/keyRings/*/cryptoKeys/*
    labels Map<String>

    A set of key/value label pairs to assign to this Topic.

    Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.

    messageRetentionDuration String
    Indicates the minimum duration to retain a message after it is published to the topic. If this field is set, messages published to the topic in the last messageRetentionDuration are always available to subscribers. For instance, it allows any attached subscription to seek to a timestamp that is up to messageRetentionDuration in the past. If this field is not set, message retention is controlled by settings on individual subscriptions. The rotation period has the format of a decimal number, followed by the letter s (seconds). Cannot be more than 31 days or less than 10 minutes.
    messageStoragePolicy Property Map
    Policy constraining the set of Google Cloud Platform regions where messages published to the topic may be stored. If not present, then no constraints are in effect. Structure is documented below.
    name String
    Name of the topic.


    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    pulumiLabels Map<String>
    The combination of labels configured directly on the resource and default labels configured on the provider.
    schemaSettings Property Map
    Settings for validating messages published against a schema. Structure is documented below.

    Supporting Types

    TopicIngestionDataSourceSettings, TopicIngestionDataSourceSettingsArgs

    AwsKinesis TopicIngestionDataSourceSettingsAwsKinesis
    Settings for ingestion from Amazon Kinesis Data Streams. Structure is documented below.
    AwsKinesis TopicIngestionDataSourceSettingsAwsKinesis
    Settings for ingestion from Amazon Kinesis Data Streams. Structure is documented below.
    awsKinesis TopicIngestionDataSourceSettingsAwsKinesis
    Settings for ingestion from Amazon Kinesis Data Streams. Structure is documented below.
    awsKinesis TopicIngestionDataSourceSettingsAwsKinesis
    Settings for ingestion from Amazon Kinesis Data Streams. Structure is documented below.
    aws_kinesis TopicIngestionDataSourceSettingsAwsKinesis
    Settings for ingestion from Amazon Kinesis Data Streams. Structure is documented below.
    awsKinesis Property Map
    Settings for ingestion from Amazon Kinesis Data Streams. Structure is documented below.

    TopicIngestionDataSourceSettingsAwsKinesis, TopicIngestionDataSourceSettingsAwsKinesisArgs

    AwsRoleArn string
    AWS role ARN to be used for Federated Identity authentication with Kinesis. Check the Pub/Sub docs for how to set up this role and the required permissions that need to be attached to it.
    ConsumerArn string
    The Kinesis consumer ARN to used for ingestion in Enhanced Fan-Out mode. The consumer must be already created and ready to be used.
    GcpServiceAccount string
    The GCP service account to be used for Federated Identity authentication with Kinesis (via a AssumeRoleWithWebIdentity call for the provided role). The awsRoleArn must be set up with accounts.google.com:sub equals to this service account number.
    StreamArn string
    The Kinesis stream ARN to ingest data from.
    AwsRoleArn string
    AWS role ARN to be used for Federated Identity authentication with Kinesis. Check the Pub/Sub docs for how to set up this role and the required permissions that need to be attached to it.
    ConsumerArn string
    The Kinesis consumer ARN to used for ingestion in Enhanced Fan-Out mode. The consumer must be already created and ready to be used.
    GcpServiceAccount string
    The GCP service account to be used for Federated Identity authentication with Kinesis (via a AssumeRoleWithWebIdentity call for the provided role). The awsRoleArn must be set up with accounts.google.com:sub equals to this service account number.
    StreamArn string
    The Kinesis stream ARN to ingest data from.
    awsRoleArn String
    AWS role ARN to be used for Federated Identity authentication with Kinesis. Check the Pub/Sub docs for how to set up this role and the required permissions that need to be attached to it.
    consumerArn String
    The Kinesis consumer ARN to used for ingestion in Enhanced Fan-Out mode. The consumer must be already created and ready to be used.
    gcpServiceAccount String
    The GCP service account to be used for Federated Identity authentication with Kinesis (via a AssumeRoleWithWebIdentity call for the provided role). The awsRoleArn must be set up with accounts.google.com:sub equals to this service account number.
    streamArn String
    The Kinesis stream ARN to ingest data from.
    awsRoleArn string
    AWS role ARN to be used for Federated Identity authentication with Kinesis. Check the Pub/Sub docs for how to set up this role and the required permissions that need to be attached to it.
    consumerArn string
    The Kinesis consumer ARN to used for ingestion in Enhanced Fan-Out mode. The consumer must be already created and ready to be used.
    gcpServiceAccount string
    The GCP service account to be used for Federated Identity authentication with Kinesis (via a AssumeRoleWithWebIdentity call for the provided role). The awsRoleArn must be set up with accounts.google.com:sub equals to this service account number.
    streamArn string
    The Kinesis stream ARN to ingest data from.
    aws_role_arn str
    AWS role ARN to be used for Federated Identity authentication with Kinesis. Check the Pub/Sub docs for how to set up this role and the required permissions that need to be attached to it.
    consumer_arn str
    The Kinesis consumer ARN to used for ingestion in Enhanced Fan-Out mode. The consumer must be already created and ready to be used.
    gcp_service_account str
    The GCP service account to be used for Federated Identity authentication with Kinesis (via a AssumeRoleWithWebIdentity call for the provided role). The awsRoleArn must be set up with accounts.google.com:sub equals to this service account number.
    stream_arn str
    The Kinesis stream ARN to ingest data from.
    awsRoleArn String
    AWS role ARN to be used for Federated Identity authentication with Kinesis. Check the Pub/Sub docs for how to set up this role and the required permissions that need to be attached to it.
    consumerArn String
    The Kinesis consumer ARN to used for ingestion in Enhanced Fan-Out mode. The consumer must be already created and ready to be used.
    gcpServiceAccount String
    The GCP service account to be used for Federated Identity authentication with Kinesis (via a AssumeRoleWithWebIdentity call for the provided role). The awsRoleArn must be set up with accounts.google.com:sub equals to this service account number.
    streamArn String
    The Kinesis stream ARN to ingest data from.

    TopicMessageStoragePolicy, TopicMessageStoragePolicyArgs

    AllowedPersistenceRegions List<string>
    A list of IDs of GCP regions where messages that are published to the topic may be persisted in storage. Messages published by publishers running in non-allowed GCP regions (or running outside of GCP altogether) will be routed for storage in one of the allowed regions. An empty list means that no regions are allowed, and is not a valid configuration.
    AllowedPersistenceRegions []string
    A list of IDs of GCP regions where messages that are published to the topic may be persisted in storage. Messages published by publishers running in non-allowed GCP regions (or running outside of GCP altogether) will be routed for storage in one of the allowed regions. An empty list means that no regions are allowed, and is not a valid configuration.
    allowedPersistenceRegions List<String>
    A list of IDs of GCP regions where messages that are published to the topic may be persisted in storage. Messages published by publishers running in non-allowed GCP regions (or running outside of GCP altogether) will be routed for storage in one of the allowed regions. An empty list means that no regions are allowed, and is not a valid configuration.
    allowedPersistenceRegions string[]
    A list of IDs of GCP regions where messages that are published to the topic may be persisted in storage. Messages published by publishers running in non-allowed GCP regions (or running outside of GCP altogether) will be routed for storage in one of the allowed regions. An empty list means that no regions are allowed, and is not a valid configuration.
    allowed_persistence_regions Sequence[str]
    A list of IDs of GCP regions where messages that are published to the topic may be persisted in storage. Messages published by publishers running in non-allowed GCP regions (or running outside of GCP altogether) will be routed for storage in one of the allowed regions. An empty list means that no regions are allowed, and is not a valid configuration.
    allowedPersistenceRegions List<String>
    A list of IDs of GCP regions where messages that are published to the topic may be persisted in storage. Messages published by publishers running in non-allowed GCP regions (or running outside of GCP altogether) will be routed for storage in one of the allowed regions. An empty list means that no regions are allowed, and is not a valid configuration.

    TopicSchemaSettings, TopicSchemaSettingsArgs

    Schema string
    The name of the schema that messages published should be validated against. Format is projects/{project}/schemas/{schema}. The value of this field will be deleted-schema if the schema has been deleted.
    Encoding string
    The encoding of messages validated against schema. Default value is ENCODING_UNSPECIFIED. Possible values are: ENCODING_UNSPECIFIED, JSON, BINARY.
    Schema string
    The name of the schema that messages published should be validated against. Format is projects/{project}/schemas/{schema}. The value of this field will be deleted-schema if the schema has been deleted.
    Encoding string
    The encoding of messages validated against schema. Default value is ENCODING_UNSPECIFIED. Possible values are: ENCODING_UNSPECIFIED, JSON, BINARY.
    schema String
    The name of the schema that messages published should be validated against. Format is projects/{project}/schemas/{schema}. The value of this field will be deleted-schema if the schema has been deleted.
    encoding String
    The encoding of messages validated against schema. Default value is ENCODING_UNSPECIFIED. Possible values are: ENCODING_UNSPECIFIED, JSON, BINARY.
    schema string
    The name of the schema that messages published should be validated against. Format is projects/{project}/schemas/{schema}. The value of this field will be deleted-schema if the schema has been deleted.
    encoding string
    The encoding of messages validated against schema. Default value is ENCODING_UNSPECIFIED. Possible values are: ENCODING_UNSPECIFIED, JSON, BINARY.
    schema str
    The name of the schema that messages published should be validated against. Format is projects/{project}/schemas/{schema}. The value of this field will be deleted-schema if the schema has been deleted.
    encoding str
    The encoding of messages validated against schema. Default value is ENCODING_UNSPECIFIED. Possible values are: ENCODING_UNSPECIFIED, JSON, BINARY.
    schema String
    The name of the schema that messages published should be validated against. Format is projects/{project}/schemas/{schema}. The value of this field will be deleted-schema if the schema has been deleted.
    encoding String
    The encoding of messages validated against schema. Default value is ENCODING_UNSPECIFIED. Possible values are: ENCODING_UNSPECIFIED, JSON, BINARY.

    Import

    Topic can be imported using any of these accepted formats:

    • projects/{{project}}/topics/{{name}}

    • {{project}}/{{name}}

    • {{name}}

    When using the pulumi import command, Topic can be imported using one of the formats above. For example:

    $ pulumi import gcp:pubsub/topic:Topic default projects/{{project}}/topics/{{name}}
    
    $ pulumi import gcp:pubsub/topic:Topic default {{project}}/{{name}}
    
    $ pulumi import gcp:pubsub/topic:Topic default {{name}}
    

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

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v7.20.0 published on Wednesday, Apr 24, 2024 by Pulumi