Skip to content

googleCloudTasksQueue

A named resource to which messages are sent by publishers.

\~> Warning: This resource requires an App Engine application to be created on the project you're provisioning it on. If you haven't already enabled it, you can create a googleAppEngineApplication resource to do so. This resource's location will be the same as the App Engine location specified.

Example Usage - Queue 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.*/
new google.cloudTasksQueue.CloudTasksQueue(this, "default", {
  location: "us-central1",
  name: "cloud-tasks-queue-test",
});

Example Usage - Cloud Tasks Queue Advanced

/*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.*/
new google.cloudTasksQueue.CloudTasksQueue(this, "advanced_configuration", {
  app_engine_routing_override: [
    {
      instance: "test",
      service: "worker",
      version: "1.0",
    },
  ],
  location: "us-central1",
  name: "instance-name",
  rate_limits: [
    {
      max_concurrent_dispatches: 3,
      max_dispatches_per_second: 2,
    },
  ],
  retry_config: [
    {
      max_attempts: 5,
      max_backoff: "3s",
      max_doublings: 1,
      max_retry_duration: "4s",
      min_backoff: "2s",
    },
  ],
  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.

  • appEngineRoutingOverride - (Optional) Overrides for task-level appEngineRouting. These settings apply only to App Engine tasks in this queue Structure is documented below.

  • rateLimits - (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.
  • retryConfig - (Optional) Settings that determine the retry behavior. Structure is documented below.

  • stackdriverLoggingConfig - (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 appEngineRoutingOverride 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 rateLimits block supports:

  • maxDispatchesPerSecond - (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.

  • maxConcurrentDispatches - (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.

  • maxBurstSize - (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 retryConfig block supports:

  • maxAttempts - (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.

  • maxRetryDuration - (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.

  • minBackoff - (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.

  • maxBackoff - (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.

  • maxDoublings - (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 stackdriverLoggingConfig block supports:

  • samplingRatio - (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 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:

$ 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.