Skip to content

Instantly share code, notes, and snippets.

@Nogbit
Created May 21, 2022 19:13
Show Gist options
  • Save Nogbit/29f5f7e906082de9b9fcb9ea7b5b78f2 to your computer and use it in GitHub Desktop.
Save Nogbit/29f5f7e906082de9b9fcb9ea7b5b78f2 to your computer and use it in GitHub Desktop.
SCC Article - GCF
###
# Cloud Scheduler
#
data "google_compute_default_service_account" "default" {
}
resource "google_cloud_scheduler_job" "job" {
name = "Golden-Image-Scanner"
description = "A job that scans the image family ${var.image_family}"
region = var.region
schedule = "0 1 * * *" # daily at 1am
time_zone = "America/Los_Angeles"
attempt_deadline = "320s"
retry_config {
retry_count = 1
}
http_target {
http_method = "POST"
uri = google_cloudfunctions_function.scanner.https_trigger_url
body = base64encode("{\"org_id\":\"${var.org_id}\",\"scc_source_name\":\"${google_scc_source.custom_source.name}\",\"image_family\":\"${var.image_family}\"}")
headers = tomap({
Content-Type = "application/json"
})
oidc_token {
service_account_email = data.google_compute_default_service_account.default.email
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment