Loading...
Loading...
### Terraform Version ```shell 1.3.5 ``` ### Terraform Configuration Files ```terraform # Source code ---------------------------------------------------------------------------------------------------------- # Creates a bucket to upload source code to. resource "google_storage_bucket" "source" { name = "ramowka-357-schedule-code-bucket" location = "US" uniform_bucket_level_access = true } # Generates an archive of the source code compressed as a .zip file. data "archive_file" "source" { type = "zip" source_dir = "../src" output_path = "/tmp/function.zip" } # Add source code zip to the Cloud Function's bucket. resource "google_storage_bucket_object" "zip" { source = data.archive_file.source.output_path content_type = "application/zip" # Append to the MD5 checksum of the files's content # to force the zip to be updated as soon as a change occurs name = "src-${data.archive_file.source.output_md5}.zip" bucket = google_storage_bucket.source.name } # Function ------------------------------------------------------------------------------------------------------------- resource "google_cloudfunctions2_function" "default" { name = "ramowka-357-schedule" location = "us-central1" build_config { runtime = "python38" entry_point = var.function_name source { storage_source { bucket = google_storage_bucket.source.name object = google_storage_bucket_object.zip.name } } } service_config { max_instance_count = 1 available_memory = "128Mi" timeout_seconds = 120 environment_variables = { USER_EMAIL = var.user_email SCHEDULE_URL = var.schedule_url DRY_RUN = var.dry_run } } event_trigger { trigger_region = "us-central1" event_type = "google.cloud.pubsub.topic.v1.messagePublished" pubsub_topic = google_pubsub_topic.default.id retry_policy = "RETRY_POLICY_RETRY" } depends_on = [ google_pubsub_topic.default ] } # Trigger Job ---------------------------------------------------------------------------------------------------------- resource "google_pubsub_topic" "default" { name = "ramowka-357-schedule" } resource "google_cloud_scheduler_job" "default" { name = "ramowka-357-schedule-sync-trigger" schedule = var.sync_schedule pubsub_target { topic_name = google_pubsub_topic.default.id data = base64encode("trigger") } } ``` ### Debug Output https://gist.github.com/mgorsk1/79ab04e91e8ffe0d09e48ea563e67805 ### Expected Behavior Function is deployed on GCP and triggered via pubsub message. ### Actual Behavior Function appears in Google Cloud Console UI but with state `Failed`. ### Steps to Reproduce 1. terraform init 2. terraform apply ### Additional Context _No response_ ### References _No response_
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.