diff --git a/README.md b/README.md index 2544825..5ff7f1e 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,7 @@ No modules. | [env](#input\_env) | A map of custom environment variables (e.g. key=value) | `map` | `{}` | no | | [execution\_environment](#input\_execution\_environment) | The execution environment to use for the job. | `string` | `""` | no | | [importpath](#input\_importpath) | The import path that contains the cron application. | `string` | n/a | yes | +| [max\_retries](#input\_max\_retries) | The maximum number of times to retry the job. | `number` | `3` | no | | [name](#input\_name) | Name to prefix to created resources. | `any` | n/a | yes | | [project\_id](#input\_project\_id) | The project that will host the cron job. | `string` | n/a | yes | | [region](#input\_region) | The region to run the job. | `string` | `"us-east4"` | no | diff --git a/main.tf b/main.tf index ea161a5..9984e4a 100644 --- a/main.tf +++ b/main.tf @@ -41,6 +41,7 @@ resource "google_cloud_run_v2_job" "job" { template { execution_environment = var.execution_environment service_account = var.service_account + max_retries = var.max_retries containers { image = ko_build.image.image_ref diff --git a/variables.tf b/variables.tf index 6a61352..ded2326 100644 --- a/variables.tf +++ b/variables.tf @@ -57,4 +57,10 @@ variable "execution_environment" { default = "" type = string description = "The execution environment to use for the job." +} + +variable "max_retries" { + default = 3 # 3 retries is the default for Cloud Run jobs + type = number + description = "The maximum number of times to retry the job." } \ No newline at end of file