Skip to content

googlePubsubLiteTopic

A named resource to which messages are sent by publishers.

To get more information about Topic, see:

Example Usage - Pubsub Lite Topic Basic

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const dataGoogleProjectProject = new google.dataGoogleProject.DataGoogleProject(
  this,
  "project",
  {}
);
const googlePubsubLiteReservationExample =
  new google.pubsubLiteReservation.PubsubLiteReservation(this, "example", {
    name: "example-reservation",
    project: dataGoogleProjectProject.number,
    throughput_capacity: 2,
  });
const googlePubsubLiteTopicExample = new google.pubsubLiteTopic.PubsubLiteTopic(
  this,
  "example_2",
  {
    name: "example-topic",
    partition_config: [
      {
        capacity: [
          {
            publish_mib_per_sec: 4,
            subscribe_mib_per_sec: 8,
          },
        ],
        count: 1,
      },
    ],
    project: dataGoogleProjectProject.number,
    reservation_config: [
      {
        throughput_reservation: googlePubsubLiteReservationExample.name,
      },
    ],
    retention_config: [
      {
        per_partition_bytes: 32212254720,
      },
    ],
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
googlePubsubLiteTopicExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • name - (Required) Name of the topic.

  • partitionConfig - (Optional) The settings for this topic's partitions. Structure is documented below.

  • retentionConfig - (Optional) The settings for a topic's message retention. Structure is documented below.

  • reservationConfig - (Optional) The settings for this topic's Reservation usage. Structure is documented below.

  • region - (Optional) The region of the pubsub lite topic.

  • zone - (Optional) The zone of the pubsub lite topic.

  • project - (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

The partitionConfig block supports:

  • count - (Required) The number of partitions in the topic. Must be at least 1.

  • capacity - (Optional) The capacity configuration. Structure is documented below.

The capacity block supports:

  • publishMibPerSec - (Required) Subscribe throughput capacity per partition in MiB/s. Must be >= 4 and <= 16.

  • subscribeMibPerSec - (Required) Publish throughput capacity per partition in MiB/s. Must be >= 4 and <= 16.

The retentionConfig block supports:

  • perPartitionBytes - (Required) The provisioned storage, in bytes, per partition. If the number of bytes stored in any of the topic's partitions grows beyond this value, older messages will be dropped to make room for newer ones, regardless of the value of period.

  • period - (Optional) How long a published message is retained. If unset, messages will be retained as long as the bytes retained for each partition is below perPartitionBytes. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

The reservationConfig block supports:

  • throughputReservation - (Optional) The Reservation to use for this topic's throughput capacity.

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

  • id - an identifier for the resource with format projects/{{project}}/locations/{{zone}}/topics/{{name}}

Timeouts

This resource provides the following Timeouts configuration options:

  • create - Default is 20 minutes.
  • update - Default is 20 minutes.
  • delete - Default is 20 minutes.

Import

Topic can be imported using any of these accepted formats:

$ terraform import google_pubsub_lite_topic.default projects/{{project}}/locations/{{zone}}/topics/{{name}}
$ terraform import google_pubsub_lite_topic.default {{project}}/{{zone}}/{{name}}
$ terraform import google_pubsub_lite_topic.default {{zone}}/{{name}}
$ terraform import google_pubsub_lite_topic.default {{name}}

User Project Overrides

This resource supports User Project Overrides.