| --- |
| # ---------------------------------------------------------------------------- |
| # |
| # *** AUTO GENERATED CODE *** Type: MMv1 *** |
| # |
| # ---------------------------------------------------------------------------- |
| # |
| # This file is automatically generated by Magic Modules and manual |
| # changes will be clobbered when the file is regenerated. |
| # |
| # Please read more about how to change this file in |
| # .github/CONTRIBUTING.md. |
| # |
| # ---------------------------------------------------------------------------- |
| subcategory: "Cloud Pub/Sub" |
| description: |- |
| A named resource representing the stream of messages from a single, |
| specific topic, to be delivered to the subscribing application. |
| --- |
| |
| # google\_pubsub\_lite\_subscription |
| |
| A named resource representing the stream of messages from a single, |
| specific topic, to be delivered to the subscribing application. |
| |
| |
| To get more information about Subscription, see: |
| |
| * [API documentation](https://cloud.google.com/pubsub/lite/docs/reference/rest/v1/admin.projects.locations.subscriptions) |
| * How-to Guides |
| * [Managing Subscriptions](https://cloud.google.com/pubsub/lite/docs/subscriptions) |
| |
| <div class = "oics-button" style="float: right; margin: 0 0 -15px"> |
| <a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=pubsub_lite_subscription_basic&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank"> |
| <img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;"> |
| </a> |
| </div> |
| ## Example Usage - Pubsub Lite Subscription Basic |
| |
| |
| ```hcl |
| resource "google_pubsub_lite_topic" "example" { |
| name = "example-topic" |
| project = data.google_project.project.number |
| partition_config { |
| count = 1 |
| capacity { |
| publish_mib_per_sec = 4 |
| subscribe_mib_per_sec = 8 |
| } |
| } |
| |
| retention_config { |
| per_partition_bytes = 32212254720 |
| } |
| } |
| |
| resource "google_pubsub_lite_subscription" "example" { |
| name = "example-subscription" |
| topic = google_pubsub_lite_topic.example.name |
| delivery_config { |
| delivery_requirement = "DELIVER_AFTER_STORED" |
| } |
| } |
| |
| data "google_project" "project" { |
| } |
| ``` |
| |
| ## Argument Reference |
| |
| The following arguments are supported: |
| |
| |
| * `topic` - |
| (Required) |
| A reference to a Topic resource. |
| |
| * `name` - |
| (Required) |
| Name of the subscription. |
| |
| |
| - - - |
| |
| |
| * `delivery_config` - |
| (Optional) |
| The settings for this subscription's message delivery. |
| Structure is [documented below](#nested_delivery_config). |
| |
| * `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. |
| |
| |
| <a name="nested_delivery_config"></a>The `delivery_config` block supports: |
| |
| * `delivery_requirement` - |
| (Required) |
| When this subscription should send messages to subscribers relative to messages persistence in storage. |
| Possible values are: `DELIVER_IMMEDIATELY`, `DELIVER_AFTER_STORED`, `DELIVERY_REQUIREMENT_UNSPECIFIED`. |
| |
| ## 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}}/subscriptions/{{name}}` |
| |
| |
| ## Timeouts |
| |
| This resource provides the following |
| [Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options: |
| |
| - `create` - Default is 20 minutes. |
| - `update` - Default is 20 minutes. |
| - `delete` - Default is 20 minutes. |
| |
| ## Import |
| |
| |
| Subscription can be imported using any of these accepted formats: |
| |
| * `projects/{{project}}/locations/{{zone}}/subscriptions/{{name}}` |
| * `{{project}}/{{zone}}/{{name}}` |
| * `{{zone}}/{{name}}` |
| * `{{name}}` |
| |
| |
| In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Subscription using one of the formats above. For example: |
| |
| ```tf |
| import { |
| id = "projects/{{project}}/locations/{{zone}}/subscriptions/{{name}}" |
| to = google_pubsub_lite_subscription.default |
| } |
| ``` |
| |
| When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), Subscription can be imported using one of the formats above. For example: |
| |
| ``` |
| $ terraform import google_pubsub_lite_subscription.default projects/{{project}}/locations/{{zone}}/subscriptions/{{name}} |
| $ terraform import google_pubsub_lite_subscription.default {{project}}/{{zone}}/{{name}} |
| $ terraform import google_pubsub_lite_subscription.default {{zone}}/{{name}} |
| $ terraform import google_pubsub_lite_subscription.default {{name}} |
| ``` |
| |
| ## User Project Overrides |
| |
| This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override). |