LoginSignup
0
0

[Terraform] CloudSchedularの状態有効化

Last updated at Posted at 2023-12-12

結論

paused = trueを指定してスケジューラを止めた状態で作成すると、pausedの記述を消しただけでは再開されない

記述変更

resource "google_cloud_scheduler_job" "sample" {
+ paused           = false
- paused           = true
  name             = "sample-schedular"
  description      = "定期実行サンプル"
  schedule         = "0 19 * * *"
  time_zone        = "Asia/Tokyo"
  attempt_deadline = "100s"
  retry_config {
    retry_count          = 1
    min_backoff_duration = "60s"
  }
  http_target {
    http_method = "POST"
    uri         = "https://workflowexecutions.googleapis.com/v1/projects/${var.pid}/locations/${var.region}/workflows/${google_workflows_workflow.sample.name}/executions"
    oauth_token {
      service_account_email = google_service_account.sample.email
    }
  }
}

差分が認識されない

pausedはoptionalなんですけどね....

resource "google_cloud_scheduler_job" "sample" {
+ # paused           = true
  name             = "sample-schedular"
  description      = "定期実行サンプル"
  schedule         = "0 19 * * *"
  time_zone        = "Asia/Tokyo"
  attempt_deadline = "100s"
  retry_config {
    retry_count          = 1
    min_backoff_duration = "60s"
  }
  http_target {
    http_method = "POST"
    uri         = "https://workflowexecutions.googleapis.com/v1/projects/${var.pid}/locations/${var.region}/workflows/${google_workflows_workflow.sample.name}/executions"
    oauth_token {
      service_account_email = google_service_account.sample.email
    }
  }
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0