{% set config = merged_configs.get('google_cloud_scheduler_job', {}) %}
# Compliance: {{ compliance_comments.get('google_cloud_scheduler_job', []) | join(', ') }}
resource "google_cloud_scheduler_job" "main" {
  name     = "{{ config.get('name', '${var.project_id}-scheduled-job') }}"
  project  = var.project_id
  region   = var.region
  schedule = "{{ config.get('schedule', '0 */6 * * *') }}"

  time_zone         = "{{ config.get('time_zone', 'UTC') }}"
  attempt_deadline  = "{{ config.get('attempt_deadline', '300s') }}"

  retry_config {
    retry_count          = {{ config.get('retry_count', 3) }}
    min_backoff_duration = "{{ config.get('min_backoff_duration', '5s') }}"
    max_backoff_duration = "{{ config.get('max_backoff_duration', '3600s') }}"
    max_doublings        = {{ config.get('max_doublings', 5) }}
  }

  http_target {
    http_method = "{{ config.get('http_method', 'POST') }}"
    uri         = "{{ config.get('uri', '') }}"
  }
}
