Last active
May 3, 2024 20:02
-
-
Save bukzor/9a98be34d66eb8efd211f62cc0be7cac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
related docs | |
https://cloud.google.com/functions/docs/bestpractices/retries#configure_the_retry_policy | |
--- | |
resource "google_cloudfunctions2_function" "collect_metrics" { | |
name = "collect_metrics" | |
location = var.region | |
build_config { | |
entry_point = "collect_metrics" | |
runtime = "python312" | |
source { | |
storage_source { | |
bucket = google_storage_bucket_object.cloudfunctions_source.bucket | |
object = google_storage_bucket_object.cloudfunctions_source.name | |
generation = local.cloudfunctions_source_generation | |
} | |
} | |
} | |
# applying this removal results in the below error | |
# event_trigger { | |
# pubsub_topic = google_pubsub_topic.collect_metrics.id | |
# event_type = "google.cloud.pubsub.topic.v1.messagePublished" | |
# retry_policy = "RETRY_POLICY_RETRY" | |
# service_account_email = var.service_accounts.collect_metrics.email | |
# trigger_region = var.region | |
# } | |
labels = { | |
deployment-tool = "terraform" | |
} | |
service_config { | |
all_traffic_on_latest_revision = true | |
available_cpu = "0.1666" | |
available_memory = "256M" | |
ingress_settings = "ALLOW_ALL" | |
max_instance_count = 100 | |
max_instance_request_concurrency = 1 | |
service_account_email = var.service_accounts.collect_metrics.email | |
timeout_seconds = 60 | |
environment_variables = { | |
DEBUG = (var.deploy_environ == "dev" ? 1 : 0) | |
GOOGLE_CLOUD_PROJECT = var.project_id | |
} | |
} | |
} | |
--- | |
(venv:dim) ~/repo/getsentry/devinfra-metrics/terraform/env/buck/80--devinfra_metrics | |
[2024-05-03 Fri PM 02:30-0500] [email protected] $ tg-apply --refresh=false --target='google_cloudfunctions2_function.collect_metrics' | |
$ env GETSENTRY_SAC_VERB=apply sudo-gcp terragrunt run-all apply --terragrunt-ignore-external-dependencies --refresh=false --target=google_cloudfunctions2_function.collect_metrics | |
You are authenticated for the next hour as: [email protected] | |
INFO[0000] The stack at /Users/buck/repo/getsentry/devinfra-metrics/terraform/env/buck/80--devinfra_metrics will be processed in the following order for command apply: | |
Group 1 | |
- Module /Users/buck/repo/getsentry/devinfra-metrics/terraform/env/buck/80--devinfra_metrics | |
Are you sure you want to run 'terragrunt apply' in each folder of the stack described above? (y/n) y | |
data.archive_file.function_source: Reading... | |
module.iam_policy--crypto_key_gcs.data.google_iam_policy._: Reading... | |
module.iam_policy--crypto_key_gcs.data.google_iam_policy._: Read complete after 0s [id=833848020] | |
data.archive_file.function_source: Read complete after 1s [id=667852d04fb55a3856f098108e62e6a33f459e82] | |
Terraform used the selected providers to generate the following execution | |
plan. Resource actions are indicated with the following symbols: | |
~ update in-place | |
Terraform will perform the following actions: | |
# google_cloudfunctions2_function.collect_metrics will be updated in-place | |
~ resource "google_cloudfunctions2_function" "collect_metrics" { | |
id = "projects/di-dev-mtr--buck-5/locations/us-west1/functions/collect_metrics" | |
name = "collect_metrics" | |
# (11 unchanged attributes hidden) | |
- event_trigger { | |
- event_type = "this-will-never-match-a-real-event-type" -> null | |
- pubsub_topic = "projects/di-dev-mtr--buck-5/topics/collect_metrics" -> null | |
- retry_policy = "RETRY_POLICY_DO_NOT_RETRY" -> null | |
- service_account_email = "[email protected]" -> null | |
- trigger_region = "us-west1" -> null | |
# (1 unchanged attribute hidden) | |
} | |
# (2 unchanged blocks hidden) | |
} | |
Plan: 0 to add, 1 to change, 0 to destroy. | |
Changes to Outputs: | |
~ collect_metrics_cloudfunction = { | |
~ event_trigger = [ | |
- { | |
- event_filters = [] | |
- event_type = "this-will-never-match-a-real-event-type" | |
- pubsub_topic = "projects/di-dev-mtr--buck-5/topics/collect_metrics" | |
- retry_policy = "RETRY_POLICY_DO_NOT_RETRY" | |
- service_account_email = "[email protected]" | |
- trigger = "" | |
- trigger_region = "us-west1" | |
}, | |
] | |
id = "projects/di-dev-mtr--buck-5/locations/us-west1/functions/collect_metrics" | |
name = "collect_metrics" | |
# (14 unchanged attributes hidden) | |
} | |
google_cloudfunctions2_function.collect_metrics: Modifying... [id=projects/di-dev-mtr--buck-5/locations/us-west1/functions/collect_metrics] | |
╷ | |
│ Warning: Resource targeting is in effect | |
│ | |
│ You are creating a plan with the -target option, which means that the | |
│ result of this plan may not represent all of the changes requested by the | |
│ current configuration. | |
│ | |
│ The -target option is not for routine use, and is provided only for | |
│ exceptional situations such as recovering from errors or mistakes, or when | |
│ Terraform specifically suggests to use it as part of an error message. | |
╵ | |
╷ | |
│ Warning: Applied changes may be incomplete | |
│ | |
│ The plan was created with the -target option in effect, so some changes | |
│ requested in the configuration may have been ignored and the output values | |
│ may not be fully updated. Run the following command to verify that no other | |
│ changes are pending: | |
│ terraform plan | |
│ | |
│ Note that the -target option is not suitable for routine use, and is | |
│ provided only for exceptional situations such as recovering from errors or | |
│ mistakes, or when Terraform specifically suggests to use it as part of an | |
│ error message. | |
╵ | |
╷ | |
│ Error: Error updating function "projects/di-dev-mtr--buck-5/locations/us-west1/functions/collect_metrics": googleapi: Error 400: Trigger event type must be specified. | |
│ | |
│ with google_cloudfunctions2_function.collect_metrics, | |
│ on cloudfunction.tf line 1, in resource "google_cloudfunctions2_function" "collect_metrics": | |
│ 1: resource "google_cloudfunctions2_function" "collect_metrics" { | |
│ | |
╵ | |
ERRO[0007] terraform invocation failed in /Users/buck/repo/getsentry/devinfra-metrics/terraform/env/buck/80--devinfra_metrics prefix=[/Users/buck/repo/getsentry/devinfra-metrics/terraform/env/buck/80--devinfra_metrics] | |
ERRO[0007] Module /Users/buck/repo/getsentry/devinfra-metrics/terraform/env/buck/80--devinfra_metrics has finished with an error: 1 error occurred: | |
* [/Users/buck/repo/getsentry/devinfra-metrics/terraform/env/buck/80--devinfra_metrics] exit status 1 | |
prefix=[/Users/buck/repo/getsentry/devinfra-metrics/terraform/env/buck/80--devinfra_metrics] | |
ERRO[0007] 1 error occurred: | |
* [/Users/buck/repo/getsentry/devinfra-metrics/terraform/env/buck/80--devinfra_metrics] exit status 1 | |
exit code: 1 | |
duration: 8.459 seconds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment