mirror of
https://github.com/letic/terraform-provider-google.git
synced 2024-10-14 23:17:15 +00:00
3afd2373df
Signed-off-by: Modular Magician <magic-modules@google.com>
306 lines
9.9 KiB
Markdown
306 lines
9.9 KiB
Markdown
---
|
|
# ----------------------------------------------------------------------------
|
|
#
|
|
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
|
|
#
|
|
# ----------------------------------------------------------------------------
|
|
#
|
|
# This file is automatically generated by Magic Modules and manual
|
|
# changes will be clobbered when the file is regenerated.
|
|
#
|
|
# Please read more about how to change this file in
|
|
# .github/CONTRIBUTING.md.
|
|
#
|
|
# ----------------------------------------------------------------------------
|
|
layout: "google"
|
|
page_title: "Google: google_cloud_scheduler_job"
|
|
sidebar_current: "docs-google-cloud-scheduler-job"
|
|
description: |-
|
|
A scheduled job that can publish a pubsub message or a http request
|
|
every X interval of time, using crontab format string
|
|
---
|
|
|
|
# google\_cloud\_scheduler\_job
|
|
|
|
A scheduled job that can publish a pubsub message or a http request
|
|
every X interval of time, using crontab format string
|
|
|
|
|
|
To get more information about Job, see:
|
|
|
|
* [API documentation](https://cloud.google.com/scheduler/docs/reference/rest/)
|
|
* How-to Guides
|
|
* [Official Documentation](https://cloud.google.com/scheduler/)
|
|
|
|
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
|
|
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=scheduler_job_pubsub&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
|
|
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
|
|
</a>
|
|
</div>
|
|
## Example Usage - Scheduler Job Pubsub
|
|
|
|
|
|
```hcl
|
|
resource "google_pubsub_topic" "topic" {
|
|
name = "job-topic"
|
|
}
|
|
|
|
resource "google_cloud_scheduler_job" "job" {
|
|
name = "test-job"
|
|
description = "test job"
|
|
schedule = "*/2 * * * *"
|
|
|
|
pubsub_target {
|
|
topic_name = "${google_pubsub_topic.topic.id}"
|
|
data = "${base64encode("test")}"
|
|
}
|
|
}
|
|
```
|
|
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
|
|
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=scheduler_job_http&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
|
|
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
|
|
</a>
|
|
</div>
|
|
## Example Usage - Scheduler Job Http
|
|
|
|
|
|
```hcl
|
|
resource "google_cloud_scheduler_job" "job" {
|
|
name = "test-job"
|
|
description = "test http job"
|
|
schedule = "*/8 * * * *"
|
|
time_zone = "America/New_York"
|
|
|
|
http_target {
|
|
http_method = "POST"
|
|
uri = "https://example.com/ping"
|
|
}
|
|
}
|
|
```
|
|
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
|
|
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=scheduler_job_app_engine&cloudshell_image=gcr.io%2Fgraphite-cloud-shell-images%2Fterraform%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
|
|
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
|
|
</a>
|
|
</div>
|
|
## Example Usage - Scheduler Job App Engine
|
|
|
|
|
|
```hcl
|
|
resource "google_cloud_scheduler_job" "job" {
|
|
name = "test-job"
|
|
schedule = "*/4 * * * *"
|
|
description = "test app engine job"
|
|
time_zone = "Europe/London"
|
|
|
|
app_engine_http_target {
|
|
http_method = "POST"
|
|
|
|
app_engine_routing {
|
|
service = "web"
|
|
version = "prod"
|
|
instance = "my-instance-001"
|
|
}
|
|
|
|
relative_uri = "/ping"
|
|
}
|
|
}
|
|
```
|
|
|
|
## Argument Reference
|
|
|
|
The following arguments are supported:
|
|
|
|
|
|
* `name` -
|
|
(Required)
|
|
The name of the job.
|
|
|
|
* `region` -
|
|
(Required)
|
|
Region where the scheduler job resides
|
|
|
|
|
|
- - -
|
|
|
|
|
|
* `description` -
|
|
(Optional)
|
|
A human-readable description for the job.
|
|
This string must not contain more than 500 characters.
|
|
|
|
* `schedule` -
|
|
(Optional)
|
|
Describes the schedule on which the job will be executed.
|
|
|
|
* `time_zone` -
|
|
(Optional)
|
|
Specifies the time zone to be used in interpreting schedule.
|
|
The value of this field must be a time zone name from the tz database.
|
|
|
|
* `retry_config` -
|
|
(Optional)
|
|
By default, if a job does not complete successfully,
|
|
meaning that an acknowledgement is not received from the handler,
|
|
then it will be retried with exponential backoff according to the settings Structure is documented below.
|
|
|
|
* `pubsub_target` -
|
|
(Optional)
|
|
Pub/Sub target
|
|
If the job providers a Pub/Sub target the cron will publish
|
|
a message to the provided topic Structure is documented below.
|
|
|
|
* `app_engine_http_target` -
|
|
(Optional)
|
|
App Engine HTTP target.
|
|
If the job providers a App Engine HTTP target the cron will
|
|
send a request to the service instance Structure is documented below.
|
|
|
|
* `http_target` -
|
|
(Optional)
|
|
HTTP target.
|
|
If the job providers a http_target the cron will
|
|
send a request to the targeted url Structure is documented below.
|
|
* `project` - (Optional) The ID of the project in which the resource belongs.
|
|
If it is not provided, the provider project is used.
|
|
|
|
|
|
The `retry_config` block supports:
|
|
|
|
* `retry_count` -
|
|
(Optional)
|
|
The number of attempts that the system will make to run a
|
|
job using the exponential backoff procedure described by maxDoublings.
|
|
Values greater than 5 and negative values are not allowed.
|
|
|
|
* `max_retry_duration` -
|
|
(Optional)
|
|
The time limit for retrying a failed job, measured from time when an execution was first attempted.
|
|
If specified with retryCount, the job will be retried until both limits are reached.
|
|
A duration in seconds with up to nine fractional digits, terminated by 's'.
|
|
|
|
* `min_backoff_duration` -
|
|
(Optional)
|
|
The minimum amount of time to wait before retrying a job after it fails.
|
|
A duration in seconds with up to nine fractional digits, terminated by 's'.
|
|
|
|
* `max_backoff_duration` -
|
|
(Optional)
|
|
The maximum amount of time to wait before retrying a job after it fails.
|
|
A duration in seconds with up to nine fractional digits, terminated by 's'.
|
|
|
|
* `max_doublings` -
|
|
(Optional)
|
|
The time between retries will double maxDoublings times.
|
|
A job's retry interval starts at minBackoffDuration,
|
|
then doubles maxDoublings times, then increases linearly,
|
|
and finally retries retries at intervals of maxBackoffDuration up to retryCount times.
|
|
|
|
The `pubsub_target` block supports:
|
|
|
|
* `topic_name` -
|
|
(Required)
|
|
The name of the Cloud Pub/Sub topic to which messages will be published when a job is delivered.
|
|
The topic name must be in the same format as required by PubSub's PublishRequest.name,
|
|
for example projects/PROJECT_ID/topics/TOPIC_ID.
|
|
|
|
* `data` -
|
|
(Optional)
|
|
The message payload for PubsubMessage.
|
|
Pubsub message must contain either non-empty data, or at least one attribute.
|
|
|
|
* `attributes` -
|
|
(Optional)
|
|
Attributes for PubsubMessage.
|
|
Pubsub message must contain either non-empty data, or at least one attribute.
|
|
|
|
The `app_engine_http_target` block supports:
|
|
|
|
* `http_method` -
|
|
(Optional)
|
|
Which HTTP method to use for the request.
|
|
|
|
* `app_engine_routing` -
|
|
(Optional)
|
|
App Engine Routing setting for the job. Structure is documented below.
|
|
|
|
* `relative_uri` -
|
|
(Required)
|
|
The relative URI.
|
|
The relative URL must begin with "/" and must be a valid HTTP relative URL.
|
|
It can contain a path, query string arguments, and \# fragments.
|
|
If the relative URL is empty, then the root path "/" will be used.
|
|
No spaces are allowed, and the maximum length allowed is 2083 characters
|
|
|
|
* `body` -
|
|
(Optional)
|
|
HTTP request body.
|
|
A request body is allowed only if the HTTP method is POST or PUT.
|
|
It will result in invalid argument error to set a body on a job with an incompatible HttpMethod.
|
|
|
|
* `headers` -
|
|
(Optional)
|
|
HTTP request headers.
|
|
This map contains the header field names and values.
|
|
Headers can be set when the job is created.
|
|
|
|
|
|
The `app_engine_routing` block supports:
|
|
|
|
* `service` -
|
|
(Optional)
|
|
App service.
|
|
By default, the job is sent to the service which is the default service when the job is attempted.
|
|
|
|
* `version` -
|
|
(Optional)
|
|
App version.
|
|
By default, the job is sent to the version which is the default version when the job is attempted.
|
|
|
|
* `instance` -
|
|
(Optional)
|
|
App instance.
|
|
By default, the job is sent to an instance which is available when the job is attempted.
|
|
|
|
The `http_target` block supports:
|
|
|
|
* `uri` -
|
|
(Required)
|
|
The full URI path that the request will be sent to.
|
|
|
|
* `http_method` -
|
|
(Optional)
|
|
Which HTTP method to use for the request.
|
|
|
|
* `body` -
|
|
(Optional)
|
|
HTTP request body.
|
|
A request body is allowed only if the HTTP method is POST, PUT, or PATCH.
|
|
It is an error to set body on a job with an incompatible HttpMethod.
|
|
|
|
* `headers` -
|
|
(Optional)
|
|
This map contains the header field names and values.
|
|
Repeated headers are not supported, but a header value can contain commas.
|
|
|
|
|
|
## Timeouts
|
|
|
|
This resource provides the following
|
|
[Timeouts](/docs/configuration/resources.html#timeouts) configuration options:
|
|
|
|
- `create` - Default is 4 minutes.
|
|
- `delete` - Default is 4 minutes.
|
|
|
|
## Import
|
|
|
|
Job can be imported using any of these accepted formats:
|
|
|
|
```
|
|
$ terraform import google_cloud_scheduler_job.default projects/{{project}}/locations/{{region}}/jobs/{{name}}
|
|
$ terraform import google_cloud_scheduler_job.default {{project}}/{{region}}/{{name}}
|
|
$ terraform import google_cloud_scheduler_job.default {{name}}
|
|
```
|
|
|
|
-> If you're importing a resource with beta features, make sure to include `-provider=google-beta`
|
|
as an argument so that Terraform uses the correct provider to import your resource.
|