{% set config = merged_configs.get('google_cloud_tasks_queue', {}) %}
# Compliance: {{ compliance_comments.get('google_cloud_tasks_queue', []) | join(', ') }}
resource "google_cloud_tasks_queue" "main" {
  name     = "{{ config.get('name', 'main-queue') }}"
  project  = var.project_id
  location = var.region

  rate_limits {
    max_dispatches_per_second = {{ config.get('max_dispatches_per_second', 500) }}
    max_concurrent_dispatches = {{ config.get('max_concurrent_dispatches', 1000) }}
  }

  retry_config {
    max_attempts       = {{ config.get('max_attempts', 5) }}
    min_backoff        = "{{ config.get('min_backoff', '0.1s') }}"
    max_backoff        = "{{ config.get('max_backoff', '3600s') }}"
    max_retry_duration = "{{ config.get('max_retry_duration', '0s') }}"
    max_doublings      = {{ config.get('max_doublings', 16) }}
  }
}
