| page_title | dbtcloud_jobs Data Source - dbtcloud |
|---|---|
| subcategory | |
| description | Retrieve all the jobs for a given dbt Cloud project or environment along with the environment details for the jobs. This will return both the jobs created from Terraform but also the jobs created in the dbt Cloud UI. |
Retrieve all the jobs for a given dbt Cloud project or environment along with the environment details for the jobs. This will return both the jobs created from Terraform but also the jobs created in the dbt Cloud UI.
// we can search all jobs by project
data dbtcloud_jobs test_all_jobs_in_project {
project_id = 1234
}
// or by environment
data dbtcloud_jobs test_all_jobs_in_environment {
environment_id = 1234
}
// we can then retrieve all the jobs from the environment flagged as production
// this would include the jobs created by Terraform and the jobs created from the dbt Cloud UI
locals {
my_jobs_prod = [for job in data.dbtcloud_jobs.test_all_jobs_in_project.jobs : job if job.environment.deployment_type == "production"]
}environment_id(Number) The ID of the environment for which we want to retrieve the jobs (one ofproject_idorenvironment_idmust be set)project_id(Number) The ID of the project for which we want to retrieve the jobs (one ofproject_idorenvironment_idmust be set)
jobs(Attributes Set) Set of jobs with their details (see below for nested schema)
Optional:
job_completion_trigger_condition(Attributes) Whether the job is triggered by the completion of another job (see below for nested schema)
Read-Only:
dbt_version(String) The version of dbt used for the job. If not set, the environment version will be used.deferring_environment_id(Number) The ID of the environment this job defers todescription(String) The description of the jobenvironment(Attributes) Details of the environment the job is running in (see below for nested schema)environment_id(Number) The ID of environmentexecute_steps(List of String) The list of steps to run in the jobexecution(Attributes) (see below for nested schema)force_node_selection(Boolean) Whether force node selection (SAO) is enabled for this jobgenerate_docs(Boolean) Whether the job generate docsid(Number) The ID of the jobjob_id(Number) The ID of the jobjob_type(String) The type of job (e.g. CI, scheduled)name(String) The name of the jobproject_id(Number) The ID of the projectrun_compare_changes(Boolean) Whether the job should compare data changes introduced by the code change in the PRrun_generate_sources(Boolean) Whether the job test source freshnessschedule(Attributes) (see below for nested schema)settings(Attributes) (see below for nested schema)triggers(Attributes) (see below for nested schema)triggers_on_draft_pr(Boolean) Whether the CI job should be automatically triggered on draft PRs
Read-Only:
condition(Attributes) (see below for nested schema)
Read-Only:
job_id(Number)project_id(Number)statuses(Set of String)
Read-Only:
deployment_type(String) Type of deployment environment: staging, productionid(Number) ID of the environmentname(String) Name of the environmentproject_id(Number)type(String) Environment type: development or deployment
Read-Only:
timeout_seconds(Number) The number of seconds before the job times out
Read-Only:
cron(String) The cron schedule for the job. Only used if triggers.schedule is true
Read-Only:
target_name(String) Value fortarget.namein the Jinja contextthreads(Number) Number of threads to run dbt with
Read-Only:
git_provider_webhook(Boolean) Whether the job runs automatically on PR creationgithub_webhook(Boolean) Whether the job runs automatically on PR creationon_merge(Boolean) Whether the job runs automatically once a PR is mergedschedule(Boolean) Whether the job runs on a schedule