blob: 86af48f3e84f65ae97cf5d56df27fde9c3a7739c [file] [log] [blame] [edit]
---
# ----------------------------------------------------------------------------
#
# *** 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 Tasks"
description: |-
A named resource to which messages are sent by publishers.
---
# google\_cloud\_tasks\_queue
A named resource to which messages are sent by publishers.
<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=queue_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 - Queue Basic
```hcl
resource "google_cloud_tasks_queue" "default" {
name = "cloud-tasks-queue-test"
location = "us-central1"
}
```
<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=cloud_tasks_queue_advanced&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 - Cloud Tasks Queue Advanced
```hcl
resource "google_cloud_tasks_queue" "advanced_configuration" {
name = "instance-name"
location = "us-central1"
app_engine_routing_override {
service = "worker"
version = "1.0"
instance = "test"
}
rate_limits {
max_concurrent_dispatches = 3
max_dispatches_per_second = 2
}
retry_config {
max_attempts = 5
max_retry_duration = "4s"
max_backoff = "3s"
min_backoff = "2s"
max_doublings = 1
}
stackdriver_logging_config {
sampling_ratio = 0.9
}
}
```
## Argument Reference
The following arguments are supported:
* `location` -
(Required)
The location of the queue
- - -
* `name` -
(Optional)
The queue name.
* `app_engine_routing_override` -
(Optional)
Overrides for task-level appEngineRouting. These settings apply only
to App Engine tasks in this queue
Structure is [documented below](#nested_app_engine_routing_override).
* `rate_limits` -
(Optional)
Rate limits for task dispatches.
The queue's actual dispatch rate is the result of:
* Number of tasks in the queue
* User-specified throttling: rateLimits, retryConfig, and the queue's state.
* System throttling due to 429 (Too Many Requests) or 503 (Service
Unavailable) responses from the worker, high error rates, or to
smooth sudden large traffic spikes.
Structure is [documented below](#nested_rate_limits).
* `retry_config` -
(Optional)
Settings that determine the retry behavior.
Structure is [documented below](#nested_retry_config).
* `stackdriver_logging_config` -
(Optional)
Configuration options for writing logs to Stackdriver Logging.
Structure is [documented below](#nested_stackdriver_logging_config).
* `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_app_engine_routing_override"></a>The `app_engine_routing_override` block supports:
* `service` -
(Optional)
App service.
By default, the task is sent to the service which is the default service when the task is attempted.
* `version` -
(Optional)
App version.
By default, the task is sent to the version which is the default version when the task is attempted.
* `instance` -
(Optional)
App instance.
By default, the task is sent to an instance which is available when the task is attempted.
* `host` -
(Output)
The host that the task is sent to.
<a name="nested_rate_limits"></a>The `rate_limits` block supports:
* `max_dispatches_per_second` -
(Optional)
The maximum rate at which tasks are dispatched from this queue.
If unspecified when the queue is created, Cloud Tasks will pick the default.
* `max_concurrent_dispatches` -
(Optional)
The maximum number of concurrent tasks that Cloud Tasks allows to
be dispatched for this queue. After this threshold has been
reached, Cloud Tasks stops dispatching tasks until the number of
concurrent requests decreases.
* `max_burst_size` -
(Output)
The max burst size.
Max burst size limits how fast tasks in queue are processed when many tasks are
in the queue and the rate is high. This field allows the queue to have a high
rate so processing starts shortly after a task is enqueued, but still limits
resource usage when many tasks are enqueued in a short period of time.
<a name="nested_retry_config"></a>The `retry_config` block supports:
* `max_attempts` -
(Optional)
Number of attempts per task.
Cloud Tasks will attempt the task maxAttempts times (that is, if
the first attempt fails, then there will be maxAttempts - 1
retries). Must be >= -1.
If unspecified when the queue is created, Cloud Tasks will pick
the default.
-1 indicates unlimited attempts.
* `max_retry_duration` -
(Optional)
If positive, maxRetryDuration specifies the time limit for
retrying a failed task, measured from when the task was first
attempted. Once maxRetryDuration time has passed and the task has
been attempted maxAttempts times, no further attempts will be
made and the task will be deleted.
If zero, then the task age is unlimited.
* `min_backoff` -
(Optional)
A task will be scheduled for retry between minBackoff and
maxBackoff duration after it fails, if the queue's RetryConfig
specifies that the task should be retried.
* `max_backoff` -
(Optional)
A task will be scheduled for retry between minBackoff and
maxBackoff duration after it fails, if the queue's RetryConfig
specifies that the task should be retried.
* `max_doublings` -
(Optional)
The time between retries will double maxDoublings times.
A task's retry interval starts at minBackoff, then doubles maxDoublings times,
then increases linearly, and finally retries retries at intervals of maxBackoff
up to maxAttempts times.
<a name="nested_stackdriver_logging_config"></a>The `stackdriver_logging_config` block supports:
* `sampling_ratio` -
(Required)
Specifies the fraction of operations to write to Stackdriver Logging.
This field may contain any value between 0.0 and 1.0, inclusive. 0.0 is the
default and means that no operations are logged.
## 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/{{location}}/queues/{{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
Queue can be imported using any of these accepted formats:
* `projects/{{project}}/locations/{{location}}/queues/{{name}}`
* `{{project}}/{{location}}/{{name}}`
* `{{location}}/{{name}}`
In Terraform v1.5.0 and later, use an [`import` block](https://developer.hashicorp.com/terraform/language/import) to import Queue using one of the formats above. For example:
```tf
import {
id = "projects/{{project}}/locations/{{location}}/queues/{{name}}"
to = google_cloud_tasks_queue.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), Queue can be imported using one of the formats above. For example:
```
$ terraform import google_cloud_tasks_queue.default projects/{{project}}/locations/{{location}}/queues/{{name}}
$ terraform import google_cloud_tasks_queue.default {{project}}/{{location}}/{{name}}
$ terraform import google_cloud_tasks_queue.default {{location}}/{{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).