A resource represents a Dataform workflow configuration
To get more information about RepositoryWorkflowConfig, see:
resource "google_sourcerepo_repository" "git_repository" {
provider = google-beta
name = "my/repository"
}
resource "google_secret_manager_secret" "secret" {
provider = google-beta
secret_id = "my_secret"
replication {
auto {}
}
}
resource "google_secret_manager_secret_version" "secret_version" {
provider = google-beta
secret = google_secret_manager_secret.secret.id
secret_data = "secret-data"
}
resource "google_dataform_repository" "repository" {
provider = google-beta
name = "dataform_repository"
region = "us-central1"
git_remote_settings {
url = google_sourcerepo_repository.git_repository.url
default_branch = "main"
authentication_token_secret_version = google_secret_manager_secret_version.secret_version.id
}
workspace_compilation_overrides {
default_database = "database"
schema_suffix = "_suffix"
table_prefix = "prefix_"
}
}
resource "google_dataform_repository_release_config" "release_config" {
provider = google-beta
project = google_dataform_repository.repository.project
region = google_dataform_repository.repository.region
repository = google_dataform_repository.repository.name
name = "my_release"
git_commitish = "main"
cron_schedule = "0 7 * * *"
time_zone = "America/New_York"
code_compilation_config {
default_database = "gcp-example-project"
default_schema = "example-dataset"
default_location = "us-central1"
assertion_schema = "example-assertion-dataset"
database_suffix = ""
schema_suffix = ""
table_prefix = ""
vars = {
var1 = "value"
}
}
}
resource "google_service_account" "dataform_sa" {
provider = google-beta
account_id = "dataform-sa"
display_name = "Dataform Service Account"
}
resource "google_dataform_repository_workflow_config" "workflow" {
provider = google-beta
project = google_dataform_repository.repository.project
region = google_dataform_repository.repository.region
repository = google_dataform_repository.repository.name
name = "my_workflow"
release_config = google_dataform_repository_release_config.release_config.id
invocation_config {
included_targets {
database = "gcp-example-project"
schema = "example-dataset"
name = "target_1"
}
included_targets {
database = "gcp-example-project"
schema = "example-dataset"
name = "target_2"
}
included_tags = ["tag_1"]
transitive_dependencies_included = true
transitive_dependents_included = true
fully_refresh_incremental_tables_enabled = false
service_account = google_service_account.dataform_sa.email
}
cron_schedule = "0 7 * * *"
time_zone = "America/New_York"
}
The following arguments are supported:
name
-
(Required)
The workflow's name.
release_config
-
(Required)
The name of the release config whose releaseCompilationResult should be executed. Must be in the format projects//locations//repositories//releaseConfigs/.
invocation_config
-
(Optional)
Optional. If left unset, a default InvocationConfig will be used.
Structure is documented below.
cron_schedule
-
(Optional)
Optional. Optional schedule (in cron format) for automatic creation of compilation results.
time_zone
-
(Optional)
Optional. Specifies the time zone to be used when interpreting cronSchedule. Must be a time zone name from the time zone database (https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). If left unspecified, the default is UTC.
region
-
(Optional)
A reference to the region
repository
-
(Optional)
A reference to the Dataform repository
project
- (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
The invocation_config
block supports:
included_targets
-
(Optional)
Optional. The set of action identifiers to include.
Structure is documented below.
included_tags
-
(Optional)
Optional. The set of tags to include.
transitive_dependencies_included
-
(Optional)
Optional. When set to true, transitive dependencies of included actions will be executed.
transitive_dependents_included
-
(Optional)
Optional. When set to true, transitive dependents of included actions will be executed.
fully_refresh_incremental_tables_enabled
-
(Optional)
Optional. When set to true, any incremental tables will be fully refreshed.
service_account
-
(Optional)
Optional. The service account to run workflow invocations under.
The included_targets
block supports:
database
-
(Optional)
The action's database (Google Cloud project ID).
schema
-
(Optional)
The action's schema (BigQuery dataset ID), within database.
name
-
(Optional)
The action's name, within database and schema.
In addition to the arguments listed above, the following computed attributes are exported:
id
- an identifier for the resource with format projects/{{project}}/locations/{{region}}/repositories/{{repository}}/workflowConfigs/{{name}}
recent_scheduled_execution_records
-
Records of the 10 most recent scheduled execution attempts, ordered in in descending order of executionTime. Updated whenever automatic creation of a workflow invocation is triggered by cronSchedule.
Structure is documented below.
The recent_scheduled_execution_records
block contains:
execution_time
-
(Output)
The timestamp of this workflow attempt.
workflow_invocation
-
(Output)
The name of the created workflow invocation, if one was successfully created. In the format projects//locations//repositories//workflowInvocations/.
error_status
-
(Output)
The error status encountered upon this attempt to create the workflow invocation, if the attempt was unsuccessful.
Structure is documented below.
The error_status
block contains:
code
-
(Output)
The status code, which should be an enum value of google.rpc.Code.
message
-
(Output)
A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
This resource provides the following Timeouts configuration options:
create
- Default is 20 minutes.update
- Default is 20 minutes.delete
- Default is 20 minutes.RepositoryWorkflowConfig can be imported using any of these accepted formats:
projects/{{project}}/locations/{{region}}/repositories/{{repository}}/workflowConfigs/{{name}}
{{project}}/{{region}}/{{repository}}/{{name}}
{{region}}/{{repository}}/{{name}}
{{repository}}/{{name}}
In Terraform v1.5.0 and later, use an import
block to import RepositoryWorkflowConfig using one of the formats above. For example:
import {
id = "projects/{{project}}/locations/{{region}}/repositories/{{repository}}/workflowConfigs/{{name}}"
to = google_dataform_repository_workflow_config.default
}
When using the terraform import
command, RepositoryWorkflowConfig can be imported using one of the formats above. For example:
$ terraform import google_dataform_repository_workflow_config.default projects/{{project}}/locations/{{region}}/repositories/{{repository}}/workflowConfigs/{{name}}
$ terraform import google_dataform_repository_workflow_config.default {{project}}/{{region}}/{{repository}}/{{name}}
$ terraform import google_dataform_repository_workflow_config.default {{region}}/{{repository}}/{{name}}
$ terraform import google_dataform_repository_workflow_config.default {{repository}}/{{name}}
This resource supports User Project Overrides.