A named resource to which messages are sent by publishers.
resource "google_cloud_tasks_queue" "default" {
name = "cloud-tasks-queue-test"
location = "us-central1"
}
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
}
}
The following arguments are supported:
location
-
(Required)
The location of the queuename
-
(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.
rate_limits
-
(Optional)
Rate limits for task dispatches.
The queue's actual dispatch rate is the result of:
retry_config
-
(Optional)
Settings that determine the retry behavior.
Structure is documented below.
stackdriver_logging_config
-
(Optional)
Configuration options for writing logs to Stackdriver Logging.
Structure is documented below.
project
- (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
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.
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.
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.
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.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}}
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.update
- Default is 20 minutes.delete
- Default is 20 minutes.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 to import Queue using one of the formats above. For example:
import {
id = "projects/{{project}}/locations/{{location}}/queues/{{name}}"
to = google_cloud_tasks_queue.default
}
When using the terraform import
command, 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}}
This resource supports User Project Overrides.