From 977aa3c57ee342047360e712ee34c1bc32a0802b Mon Sep 17 00:00:00 2001 From: Modular Magician Date: Tue, 20 Apr 2021 22:31:48 +0000 Subject: [PATCH] Dataproc workflow template (#4693) * Update eventarc trigger yaml, markdown to allow setting transport * Update test, add handwritten utils * Update handwritten * Updating eventarc test * Updating trigger * Adding dataproc workflow * Updating expanders * Updates to prop, resource to handle refs * Add support for workflow in GA * fix merge issues * Add template markdown Signed-off-by: Modular Magician --- .changelog/4693.txt | 3 + google/config.go | 3 + google/expanders.go | 17 + google/provider.go | 1 + google/resource_dataproc_workflow_template.go | 3352 +++++++++++++++++ ...dataproc_workflow_template_sweeper_test.go | 56 + ...esource_dataproc_workflow_template_test.go | 129 + google/utils.go | 16 +- .../dataproc_workflow_template.html.markdown | 895 +++++ website/google.erb | 4 + 10 files changed, 4468 insertions(+), 8 deletions(-) create mode 100644 .changelog/4693.txt create mode 100644 google/expanders.go create mode 100644 google/resource_dataproc_workflow_template.go create mode 100644 google/resource_dataproc_workflow_template_sweeper_test.go create mode 100644 google/resource_dataproc_workflow_template_test.go create mode 100644 website/docs/r/dataproc_workflow_template.html.markdown diff --git a/.changelog/4693.txt b/.changelog/4693.txt new file mode 100644 index 00000000000..bcb4fbae88f --- /dev/null +++ b/.changelog/4693.txt @@ -0,0 +1,3 @@ +```release-note:new-resource +google_dataproc_workflow_template +``` diff --git a/google/config.go b/google/config.go index 96ca0b297a3..c447168dcff 100644 --- a/google/config.go +++ b/google/config.go @@ -14,6 +14,7 @@ import ( "google.golang.org/api/option" dcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl" + dataprocDcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/dataproc" eventarcDcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/eventarc" "golang.org/x/oauth2" googleoauth "golang.org/x/oauth2/google" @@ -163,6 +164,7 @@ type Config struct { // start DCL clients dclConfig *dcl.Config + clientDataprocDCL *dataprocDcl.Client clientEventarcDCL *eventarcDcl.Client } @@ -284,6 +286,7 @@ func (c *Config) LoadAndValidate(ctx context.Context) error { // Start DCL client instantiation // TODO(slevenick): handle user agents c.dclConfig = dcl.NewConfig(dcl.WithHTTPClient(client), dcl.WithUserAgent(c.userAgent), dcl.WithLogger(dclLogger{})) + c.clientDataprocDCL = dataprocDcl.NewClient(c.dclConfig) c.clientEventarcDCL = eventarcDcl.NewClient(c.dclConfig) return nil diff --git a/google/expanders.go b/google/expanders.go new file mode 100644 index 00000000000..c84756ba8c5 --- /dev/null +++ b/google/expanders.go @@ -0,0 +1,17 @@ +package google + +import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + +func expandStringArray(v interface{}) []string { + arr, ok := v.([]string) + + if ok { + return arr + } + + if arr, ok := v.(*schema.Set); ok { + return convertStringSet(arr) + } + + return convertStringArr(v.([]interface{})) +} diff --git a/google/provider.go b/google/provider.go index dd1b56fcff4..e8a49476220 100644 --- a/google/provider.go +++ b/google/provider.go @@ -1049,6 +1049,7 @@ func ResourceMapWithErrors() (map[string]*schema.Resource, error) { "google_dataflow_job": resourceDataflowJob(), "google_dataproc_cluster": resourceDataprocCluster(), "google_dataproc_job": resourceDataprocJob(), + "google_dataproc_workflow_template": resourceDataprocWorkflowTemplate(), "google_endpoints_service": resourceEndpointsService(), "google_eventarc_trigger": resourceEventarcTrigger(), "google_folder": resourceGoogleFolder(), diff --git a/google/resource_dataproc_workflow_template.go b/google/resource_dataproc_workflow_template.go new file mode 100644 index 00000000000..4004ae14c55 --- /dev/null +++ b/google/resource_dataproc_workflow_template.go @@ -0,0 +1,3352 @@ +// ---------------------------------------------------------------------------- +// +// *** 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. +// +// ---------------------------------------------------------------------------- + +package google + +import ( + "context" + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" + + dcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl" + dataproc "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/dataproc" +) + +func resourceDataprocWorkflowTemplate() *schema.Resource { + return &schema.Resource{ + Create: resourceDataprocWorkflowTemplateCreate, + Read: resourceDataprocWorkflowTemplateRead, + Delete: resourceDataprocWorkflowTemplateDelete, + + Importer: &schema.ResourceImporter{ + State: resourceDataprocWorkflowTemplateImport, + }, + + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(10 * time.Minute), + Delete: schema.DefaultTimeout(10 * time.Minute), + }, + + Schema: map[string]*schema.Schema{ + "jobs": { + Type: schema.TypeList, + Required: true, + ForceNew: true, + Description: ``, + Elem: DataprocWorkflowTemplateJobsSchema(), + }, + + "location": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: ``, + }, + + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: ``, + }, + + "placement": { + Type: schema.TypeList, + Required: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplatePlacementSchema(), + }, + + "labels": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "parameters": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: DataprocWorkflowTemplateParametersSchema(), + }, + + "project": { + Type: schema.TypeString, + Computed: true, + Optional: true, + ForceNew: true, + DiffSuppressFunc: compareSelfLinkOrResourceName, + Description: ``, + }, + + "version": { + Type: schema.TypeInt, + Computed: true, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "create_time": { + Type: schema.TypeString, + Computed: true, + Description: ``, + }, + + "update_time": { + Type: schema.TypeString, + Computed: true, + Description: ``, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "step_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: ``, + }, + + "hadoop_job": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsHadoopJobSchema(), + }, + + "hive_job": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsHiveJobSchema(), + }, + + "labels": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "pig_job": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsPigJobSchema(), + }, + + "prerequisite_step_ids": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "presto_job": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsPrestoJobSchema(), + }, + + "pyspark_job": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsPysparkJobSchema(), + }, + + "scheduling": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsSchedulingSchema(), + }, + + "spark_job": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsSparkJobSchema(), + }, + + "spark_r_job": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsSparkRJobSchema(), + }, + + "spark_sql_job": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsSparkSqlJobSchema(), + }, + }, + } +} + +func DataprocWorkflowTemplateJobsHadoopJobSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "archive_uris": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "args": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "file_uris": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "jar_file_uris": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "logging_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsHadoopJobLoggingConfigSchema(), + }, + + "main_class": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "main_jar_file_uri": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "properties": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsHadoopJobLoggingConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "driver_log_levels": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsHiveJobSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "continue_on_failure": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "jar_file_uris": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "properties": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "query_file_uri": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "query_list": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsHiveJobQueryListSchema(), + }, + + "script_variables": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsHiveJobQueryListSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "queries": { + Type: schema.TypeList, + Required: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsPigJobSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "continue_on_failure": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "jar_file_uris": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "logging_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsPigJobLoggingConfigSchema(), + }, + + "properties": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "query_file_uri": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "query_list": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsPigJobQueryListSchema(), + }, + + "script_variables": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsPigJobLoggingConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "driver_log_levels": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsPigJobQueryListSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "queries": { + Type: schema.TypeList, + Required: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsPrestoJobSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "client_tags": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "continue_on_failure": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "logging_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsPrestoJobLoggingConfigSchema(), + }, + + "output_format": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "properties": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "query_file_uri": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "query_list": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsPrestoJobQueryListSchema(), + }, + }, + } +} + +func DataprocWorkflowTemplateJobsPrestoJobLoggingConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "driver_log_levels": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsPrestoJobQueryListSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "queries": { + Type: schema.TypeList, + Required: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsPysparkJobSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "main_python_file_uri": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: ``, + }, + + "archive_uris": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "args": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "file_uris": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "jar_file_uris": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "logging_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsPysparkJobLoggingConfigSchema(), + }, + + "properties": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "python_file_uris": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsPysparkJobLoggingConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "driver_log_levels": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsSchedulingSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "max_failures_per_hour": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "max_failures_total": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + Description: ``, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsSparkJobSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "archive_uris": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "args": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "file_uris": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "jar_file_uris": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "logging_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsSparkJobLoggingConfigSchema(), + }, + + "main_class": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "main_jar_file_uri": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "properties": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsSparkJobLoggingConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "driver_log_levels": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsSparkRJobSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "main_r_file_uri": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: ``, + }, + + "archive_uris": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "args": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "file_uris": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "logging_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsSparkRJobLoggingConfigSchema(), + }, + + "properties": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsSparkRJobLoggingConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "driver_log_levels": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsSparkSqlJobSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "jar_file_uris": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "logging_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsSparkSqlJobLoggingConfigSchema(), + }, + + "properties": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "query_file_uri": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "query_list": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateJobsSparkSqlJobQueryListSchema(), + }, + + "script_variables": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsSparkSqlJobLoggingConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "driver_log_levels": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateJobsSparkSqlJobQueryListSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "queries": { + Type: schema.TypeList, + Required: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplatePlacementSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cluster_selector": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplatePlacementClusterSelectorSchema(), + }, + + "managed_cluster": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplatePlacementManagedClusterSchema(), + }, + }, + } +} + +func DataprocWorkflowTemplatePlacementClusterSelectorSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cluster_labels": { + Type: schema.TypeMap, + Required: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "zone": { + Type: schema.TypeString, + Computed: true, + Optional: true, + ForceNew: true, + Description: ``, + }, + }, + } +} + +func DataprocWorkflowTemplatePlacementManagedClusterSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cluster_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: ``, + }, + + "config": { + Type: schema.TypeList, + Required: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateClusterClusterConfigSchema(), + }, + + "labels": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateParametersSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "fields": { + Type: schema.TypeList, + Required: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: ``, + }, + + "description": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "validation": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateParametersValidationSchema(), + }, + }, + } +} + +func DataprocWorkflowTemplateParametersValidationSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "regex": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateParametersValidationRegexSchema(), + }, + + "values": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateParametersValidationValuesSchema(), + }, + }, + } +} + +func DataprocWorkflowTemplateParametersValidationRegexSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "regexes": { + Type: schema.TypeList, + Required: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateParametersValidationValuesSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "values": { + Type: schema.TypeList, + Required: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateClusterInstanceGroupConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "accelerators": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: DataprocWorkflowTemplateClusterInstanceGroupConfigAcceleratorsSchema(), + }, + + "disk_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateClusterInstanceGroupConfigDiskConfigSchema(), + }, + + "image": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + DiffSuppressFunc: compareSelfLinkOrResourceName, + Description: ``, + }, + + "machine_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "min_cpu_platform": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "num_instances": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "preemptibility": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + ValidateFunc: validation.StringInSlice([]string{"PREEMPTIBILITY_UNSPECIFIED", "NON_PREEMPTIBLE", "PREEMPTIBLE", ""}, false), + }, + + "instance_names": { + Type: schema.TypeList, + Computed: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "is_preemptible": { + Type: schema.TypeBool, + Computed: true, + Description: ``, + }, + + "managed_group_config": { + Type: schema.TypeList, + Computed: true, + Description: ``, + Elem: DataprocWorkflowTemplateClusterInstanceGroupConfigManagedGroupConfigSchema(), + }, + }, + } +} + +func DataprocWorkflowTemplateClusterInstanceGroupConfigAcceleratorsSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "accelerator_count": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "accelerator_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + }, + } +} + +func DataprocWorkflowTemplateClusterInstanceGroupConfigDiskConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "boot_disk_size_gb": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "boot_disk_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "num_local_ssds": { + Type: schema.TypeInt, + Computed: true, + Optional: true, + ForceNew: true, + Description: ``, + }, + }, + } +} + +func DataprocWorkflowTemplateClusterInstanceGroupConfigManagedGroupConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "instance_group_manager_name": { + Type: schema.TypeString, + Computed: true, + Description: ``, + }, + + "instance_template_name": { + Type: schema.TypeString, + Computed: true, + Description: ``, + }, + }, + } +} + +func DataprocWorkflowTemplateClusterClusterConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "autoscaling_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateClusterClusterConfigAutoscalingConfigSchema(), + }, + + "encryption_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateClusterClusterConfigEncryptionConfigSchema(), + }, + + "endpoint_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateClusterClusterConfigEndpointConfigSchema(), + }, + + "gce_cluster_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateClusterClusterConfigGceClusterConfigSchema(), + }, + + "initialization_actions": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: DataprocWorkflowTemplateClusterClusterConfigInitializationActionsSchema(), + }, + + "lifecycle_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateClusterClusterConfigLifecycleConfigSchema(), + }, + + "master_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateClusterInstanceGroupConfigSchema(), + }, + + "secondary_worker_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateClusterInstanceGroupConfigSchema(), + }, + + "security_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateClusterClusterConfigSecurityConfigSchema(), + }, + + "software_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateClusterClusterConfigSoftwareConfigSchema(), + }, + + "staging_bucket": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + DiffSuppressFunc: compareSelfLinkOrResourceName, + Description: ``, + }, + + "temp_bucket": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + DiffSuppressFunc: compareSelfLinkOrResourceName, + Description: ``, + }, + + "worker_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateClusterInstanceGroupConfigSchema(), + }, + }, + } +} + +func DataprocWorkflowTemplateClusterClusterConfigAutoscalingConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "policy": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + DiffSuppressFunc: compareSelfLinkOrResourceName, + Description: ``, + }, + }, + } +} + +func DataprocWorkflowTemplateClusterClusterConfigEncryptionConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "gce_pd_kms_key_name": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + DiffSuppressFunc: compareSelfLinkOrResourceName, + Description: ``, + }, + }, + } +} + +func DataprocWorkflowTemplateClusterClusterConfigEndpointConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enable_http_port_access": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "http_ports": { + Type: schema.TypeMap, + Computed: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateClusterClusterConfigGceClusterConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "internal_ip_only": { + Type: schema.TypeBool, + Computed: true, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "metadata": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "network": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + DiffSuppressFunc: compareSelfLinkOrResourceName, + Description: ``, + }, + + "node_group_affinity": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateClusterClusterConfigGceClusterConfigNodeGroupAffinitySchema(), + }, + + "private_ipv6_google_access": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + ValidateFunc: validation.StringInSlice([]string{"PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED", "INHERIT_FROM_SUBNETWORK", "OUTBOUND", "BIDIRECTIONAL", ""}, false), + }, + + "reservation_affinity": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateClusterClusterConfigGceClusterConfigReservationAffinitySchema(), + }, + + "service_account": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + DiffSuppressFunc: compareSelfLinkOrResourceName, + Description: ``, + }, + + "service_account_scopes": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + + "subnetwork": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + DiffSuppressFunc: compareSelfLinkOrResourceName, + Description: ``, + }, + + "tags": { + Type: schema.TypeSet, + Optional: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + }, + + "zone": { + Type: schema.TypeString, + Computed: true, + Optional: true, + ForceNew: true, + Description: ``, + }, + }, + } +} + +func DataprocWorkflowTemplateClusterClusterConfigGceClusterConfigNodeGroupAffinitySchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "node_group": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + DiffSuppressFunc: compareSelfLinkOrResourceName, + Description: ``, + }, + }, + } +} + +func DataprocWorkflowTemplateClusterClusterConfigGceClusterConfigReservationAffinitySchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "consume_reservation_type": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + ValidateFunc: validation.StringInSlice([]string{"TYPE_UNSPECIFIED", "NO_RESERVATION", "ANY_RESERVATION", "SPECIFIC_RESERVATION", ""}, false), + }, + + "key": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "values": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func DataprocWorkflowTemplateClusterClusterConfigInitializationActionsSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "executable_file": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "execution_timeout": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + }, + } +} + +func DataprocWorkflowTemplateClusterClusterConfigLifecycleConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "auto_delete_time": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "auto_delete_ttl": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "idle_delete_ttl": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "idle_start_time": { + Type: schema.TypeString, + Computed: true, + Description: ``, + }, + }, + } +} + +func DataprocWorkflowTemplateClusterClusterConfigSecurityConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "kerberos_config": { + Type: schema.TypeList, + Optional: true, + ForceNew: true, + Description: ``, + MaxItems: 1, + Elem: DataprocWorkflowTemplateClusterClusterConfigSecurityConfigKerberosConfigSchema(), + }, + }, + } +} + +func DataprocWorkflowTemplateClusterClusterConfigSecurityConfigKerberosConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "cross_realm_trust_admin_server": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "cross_realm_trust_kdc": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "cross_realm_trust_realm": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "cross_realm_trust_shared_password": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "enable_kerberos": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "kdc_db_key": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "key_password": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "keystore": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "keystore_password": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "kms_key": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + DiffSuppressFunc: compareSelfLinkOrResourceName, + Description: ``, + }, + + "realm": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "root_principal_password": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "tgt_lifetime_hours": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "truststore": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "truststore_password": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + }, + } +} + +func DataprocWorkflowTemplateClusterClusterConfigSoftwareConfigSchema() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "image_version": { + Type: schema.TypeString, + Optional: true, + ForceNew: true, + Description: ``, + }, + + "properties": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + Description: ``, + Elem: &schema.Schema{Type: schema.TypeString}, + }, + }, + } +} + +func resourceDataprocWorkflowTemplateCreate(d *schema.ResourceData, meta interface{}) error { + config := meta.(*Config) + project, err := getProject(d, config) + if err != nil { + return err + } + + obj := &dataproc.WorkflowTemplate{ + Jobs: expandDataprocWorkflowTemplateJobsArray(d.Get("jobs")), + Location: dcl.StringOrNil(d.Get("location").(string)), + Name: dcl.StringOrNil(d.Get("name").(string)), + Placement: expandDataprocWorkflowTemplatePlacement(d.Get("placement")), + Labels: checkStringMap(d.Get("labels")), + Parameters: expandDataprocWorkflowTemplateParametersArray(d.Get("parameters")), + Project: dcl.String(project), + Version: dcl.Int64OrNil(int64(d.Get("version").(int))), + } + + id, err := replaceVarsForId(d, config, "projects/{{project}}/locations/{{location}}/workflowTemplates/{{name}}") + if err != nil { + return fmt.Errorf("Error constructing id: %s", err) + } + d.SetId(id) + createDirective := CreateDirective + res, err := config.clientDataprocDCL.ApplyWorkflowTemplate(context.Background(), obj, createDirective...) + if err != nil { + // The resource didn't actually create + d.SetId("") + return fmt.Errorf("Error creating WorkflowTemplate: %s", err) + } + + log.Printf("[DEBUG] Finished creating WorkflowTemplate %q: %#v", d.Id(), res) + + return resourceDataprocWorkflowTemplateRead(d, meta) +} + +func resourceDataprocWorkflowTemplateRead(d *schema.ResourceData, meta interface{}) error { + config := meta.(*Config) + project, err := getProject(d, config) + if err != nil { + return err + } + + obj := &dataproc.WorkflowTemplate{ + Jobs: expandDataprocWorkflowTemplateJobsArray(d.Get("jobs")), + Location: dcl.StringOrNil(d.Get("location").(string)), + Name: dcl.StringOrNil(d.Get("name").(string)), + Placement: expandDataprocWorkflowTemplatePlacement(d.Get("placement")), + Labels: checkStringMap(d.Get("labels")), + Parameters: expandDataprocWorkflowTemplateParametersArray(d.Get("parameters")), + Project: dcl.String(project), + Version: dcl.Int64OrNil(int64(d.Get("version").(int))), + } + + res, err := config.clientDataprocDCL.GetWorkflowTemplate(context.Background(), obj) + if err != nil { + // Resource not found + d.SetId("") + return err + } + + if err = d.Set("jobs", flattenDataprocWorkflowTemplateJobsArray(res.Jobs)); err != nil { + return fmt.Errorf("error setting jobs in state: %s", err) + } + if err = d.Set("location", res.Location); err != nil { + return fmt.Errorf("error setting location in state: %s", err) + } + if err = d.Set("name", res.Name); err != nil { + return fmt.Errorf("error setting name in state: %s", err) + } + if err = d.Set("placement", flattenDataprocWorkflowTemplatePlacement(res.Placement)); err != nil { + return fmt.Errorf("error setting placement in state: %s", err) + } + if err = d.Set("labels", res.Labels); err != nil { + return fmt.Errorf("error setting labels in state: %s", err) + } + if err = d.Set("parameters", flattenDataprocWorkflowTemplateParametersArray(res.Parameters)); err != nil { + return fmt.Errorf("error setting parameters in state: %s", err) + } + if err = d.Set("project", res.Project); err != nil { + return fmt.Errorf("error setting project in state: %s", err) + } + if err = d.Set("version", res.Version); err != nil { + return fmt.Errorf("error setting version in state: %s", err) + } + if err = d.Set("create_time", res.CreateTime); err != nil { + return fmt.Errorf("error setting create_time in state: %s", err) + } + if err = d.Set("update_time", res.UpdateTime); err != nil { + return fmt.Errorf("error setting update_time in state: %s", err) + } + + return nil +} + +func resourceDataprocWorkflowTemplateDelete(d *schema.ResourceData, meta interface{}) error { + config := meta.(*Config) + project, err := getProject(d, config) + if err != nil { + return err + } + + obj := &dataproc.WorkflowTemplate{ + Jobs: expandDataprocWorkflowTemplateJobsArray(d.Get("jobs")), + Location: dcl.StringOrNil(d.Get("location").(string)), + Name: dcl.StringOrNil(d.Get("name").(string)), + Placement: expandDataprocWorkflowTemplatePlacement(d.Get("placement")), + Labels: checkStringMap(d.Get("labels")), + Parameters: expandDataprocWorkflowTemplateParametersArray(d.Get("parameters")), + Project: dcl.String(project), + Version: dcl.Int64OrNil(int64(d.Get("version").(int))), + } + + log.Printf("[DEBUG] Deleting WorkflowTemplate %q", d.Id()) + if err := config.clientDataprocDCL.DeleteWorkflowTemplate(context.Background(), obj); err != nil { + return fmt.Errorf("Error deleting WorkflowTemplate: %s", err) + } + + log.Printf("[DEBUG] Finished deleting WorkflowTemplate %q", d.Id()) + return nil +} + +func resourceDataprocWorkflowTemplateImport(d *schema.ResourceData, meta interface{}) ([]*schema.ResourceData, error) { + config := meta.(*Config) + if err := parseImportId([]string{ + "projects/(?P[^/]+)/locations/(?P[^/]+)/workflowTemplates/(?P[^/]+)", + "(?P[^/]+)/(?P[^/]+)/(?P[^/]+)", + "(?P[^/]+)/(?P[^/]+)", + }, d, config); err != nil { + return nil, err + } + + // Replace import id for the resource id + id, err := replaceVarsForId(d, config, "projects/{{project}}/locations/{{location}}/workflowTemplates/{{name}}") + if err != nil { + return nil, fmt.Errorf("Error constructing id: %s", err) + } + d.SetId(id) + + return []*schema.ResourceData{d}, nil +} + +func expandDataprocWorkflowTemplateJobsArray(o interface{}) []dataproc.WorkflowTemplateJobs { + if o == nil { + return nil + } + + objs := o.([]interface{}) + if len(objs) == 0 { + return nil + } + + items := make([]dataproc.WorkflowTemplateJobs, 0, len(objs)) + for _, item := range objs { + i := expandDataprocWorkflowTemplateJobs(item) + items = append(items, *i) + } + + return items +} + +func expandDataprocWorkflowTemplateJobs(o interface{}) *dataproc.WorkflowTemplateJobs { + if o == nil { + return nil + } + + obj := o.(map[string]interface{}) + return &dataproc.WorkflowTemplateJobs{ + StepId: dcl.StringOrNil(obj["step_id"].(string)), + HadoopJob: expandDataprocWorkflowTemplateJobsHadoopJob(obj["hadoop_job"]), + HiveJob: expandDataprocWorkflowTemplateJobsHiveJob(obj["hive_job"]), + Labels: checkStringMap(obj["labels"]), + PigJob: expandDataprocWorkflowTemplateJobsPigJob(obj["pig_job"]), + PrerequisiteStepIds: expandStringArray(obj["prerequisite_step_ids"]), + PrestoJob: expandDataprocWorkflowTemplateJobsPrestoJob(obj["presto_job"]), + PysparkJob: expandDataprocWorkflowTemplateJobsPysparkJob(obj["pyspark_job"]), + Scheduling: expandDataprocWorkflowTemplateJobsScheduling(obj["scheduling"]), + SparkJob: expandDataprocWorkflowTemplateJobsSparkJob(obj["spark_job"]), + SparkRJob: expandDataprocWorkflowTemplateJobsSparkRJob(obj["spark_r_job"]), + SparkSqlJob: expandDataprocWorkflowTemplateJobsSparkSqlJob(obj["spark_sql_job"]), + } +} + +func flattenDataprocWorkflowTemplateJobsArray(objs []dataproc.WorkflowTemplateJobs) []interface{} { + if objs == nil { + return nil + } + + items := []interface{}{} + for _, item := range objs { + i := flattenDataprocWorkflowTemplateJobs(&item) + items = append(items, i) + } + + return items +} + +func flattenDataprocWorkflowTemplateJobs(obj *dataproc.WorkflowTemplateJobs) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "step_id": obj.StepId, + "hadoop_job": flattenDataprocWorkflowTemplateJobsHadoopJob(obj.HadoopJob), + "hive_job": flattenDataprocWorkflowTemplateJobsHiveJob(obj.HiveJob), + "labels": obj.Labels, + "pig_job": flattenDataprocWorkflowTemplateJobsPigJob(obj.PigJob), + "prerequisite_step_ids": obj.PrerequisiteStepIds, + "presto_job": flattenDataprocWorkflowTemplateJobsPrestoJob(obj.PrestoJob), + "pyspark_job": flattenDataprocWorkflowTemplateJobsPysparkJob(obj.PysparkJob), + "scheduling": flattenDataprocWorkflowTemplateJobsScheduling(obj.Scheduling), + "spark_job": flattenDataprocWorkflowTemplateJobsSparkJob(obj.SparkJob), + "spark_r_job": flattenDataprocWorkflowTemplateJobsSparkRJob(obj.SparkRJob), + "spark_sql_job": flattenDataprocWorkflowTemplateJobsSparkSqlJob(obj.SparkSqlJob), + } + + return transformed + +} + +func expandDataprocWorkflowTemplateJobsHadoopJob(o interface{}) *dataproc.WorkflowTemplateJobsHadoopJob { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsHadoopJob{ + ArchiveUris: expandStringArray(obj["archive_uris"]), + Args: expandStringArray(obj["args"]), + FileUris: expandStringArray(obj["file_uris"]), + JarFileUris: expandStringArray(obj["jar_file_uris"]), + LoggingConfig: expandDataprocWorkflowTemplateJobsHadoopJobLoggingConfig(obj["logging_config"]), + MainClass: dcl.StringOrNil(obj["main_class"].(string)), + MainJarFileUri: dcl.StringOrNil(obj["main_jar_file_uri"].(string)), + Properties: checkStringMap(obj["properties"]), + } +} + +func flattenDataprocWorkflowTemplateJobsHadoopJob(obj *dataproc.WorkflowTemplateJobsHadoopJob) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "archive_uris": obj.ArchiveUris, + "args": obj.Args, + "file_uris": obj.FileUris, + "jar_file_uris": obj.JarFileUris, + "logging_config": flattenDataprocWorkflowTemplateJobsHadoopJobLoggingConfig(obj.LoggingConfig), + "main_class": obj.MainClass, + "main_jar_file_uri": obj.MainJarFileUri, + "properties": obj.Properties, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsHadoopJobLoggingConfig(o interface{}) *dataproc.WorkflowTemplateJobsHadoopJobLoggingConfig { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsHadoopJobLoggingConfig{ + DriverLogLevels: checkStringMap(obj["driver_log_levels"]), + } +} + +func flattenDataprocWorkflowTemplateJobsHadoopJobLoggingConfig(obj *dataproc.WorkflowTemplateJobsHadoopJobLoggingConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "driver_log_levels": obj.DriverLogLevels, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsHiveJob(o interface{}) *dataproc.WorkflowTemplateJobsHiveJob { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsHiveJob{ + ContinueOnFailure: dcl.Bool(obj["continue_on_failure"].(bool)), + JarFileUris: expandStringArray(obj["jar_file_uris"]), + Properties: checkStringMap(obj["properties"]), + QueryFileUri: dcl.StringOrNil(obj["query_file_uri"].(string)), + QueryList: expandDataprocWorkflowTemplateJobsHiveJobQueryList(obj["query_list"]), + ScriptVariables: checkStringMap(obj["script_variables"]), + } +} + +func flattenDataprocWorkflowTemplateJobsHiveJob(obj *dataproc.WorkflowTemplateJobsHiveJob) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "continue_on_failure": obj.ContinueOnFailure, + "jar_file_uris": obj.JarFileUris, + "properties": obj.Properties, + "query_file_uri": obj.QueryFileUri, + "query_list": flattenDataprocWorkflowTemplateJobsHiveJobQueryList(obj.QueryList), + "script_variables": obj.ScriptVariables, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsHiveJobQueryList(o interface{}) *dataproc.WorkflowTemplateJobsHiveJobQueryList { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsHiveJobQueryList{ + Queries: expandStringArray(obj["queries"]), + } +} + +func flattenDataprocWorkflowTemplateJobsHiveJobQueryList(obj *dataproc.WorkflowTemplateJobsHiveJobQueryList) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "queries": obj.Queries, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsPigJob(o interface{}) *dataproc.WorkflowTemplateJobsPigJob { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsPigJob{ + ContinueOnFailure: dcl.Bool(obj["continue_on_failure"].(bool)), + JarFileUris: expandStringArray(obj["jar_file_uris"]), + LoggingConfig: expandDataprocWorkflowTemplateJobsPigJobLoggingConfig(obj["logging_config"]), + Properties: checkStringMap(obj["properties"]), + QueryFileUri: dcl.StringOrNil(obj["query_file_uri"].(string)), + QueryList: expandDataprocWorkflowTemplateJobsPigJobQueryList(obj["query_list"]), + ScriptVariables: checkStringMap(obj["script_variables"]), + } +} + +func flattenDataprocWorkflowTemplateJobsPigJob(obj *dataproc.WorkflowTemplateJobsPigJob) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "continue_on_failure": obj.ContinueOnFailure, + "jar_file_uris": obj.JarFileUris, + "logging_config": flattenDataprocWorkflowTemplateJobsPigJobLoggingConfig(obj.LoggingConfig), + "properties": obj.Properties, + "query_file_uri": obj.QueryFileUri, + "query_list": flattenDataprocWorkflowTemplateJobsPigJobQueryList(obj.QueryList), + "script_variables": obj.ScriptVariables, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsPigJobLoggingConfig(o interface{}) *dataproc.WorkflowTemplateJobsPigJobLoggingConfig { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsPigJobLoggingConfig{ + DriverLogLevels: checkStringMap(obj["driver_log_levels"]), + } +} + +func flattenDataprocWorkflowTemplateJobsPigJobLoggingConfig(obj *dataproc.WorkflowTemplateJobsPigJobLoggingConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "driver_log_levels": obj.DriverLogLevels, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsPigJobQueryList(o interface{}) *dataproc.WorkflowTemplateJobsPigJobQueryList { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsPigJobQueryList{ + Queries: expandStringArray(obj["queries"]), + } +} + +func flattenDataprocWorkflowTemplateJobsPigJobQueryList(obj *dataproc.WorkflowTemplateJobsPigJobQueryList) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "queries": obj.Queries, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsPrestoJob(o interface{}) *dataproc.WorkflowTemplateJobsPrestoJob { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsPrestoJob{ + ClientTags: expandStringArray(obj["client_tags"]), + ContinueOnFailure: dcl.Bool(obj["continue_on_failure"].(bool)), + LoggingConfig: expandDataprocWorkflowTemplateJobsPrestoJobLoggingConfig(obj["logging_config"]), + OutputFormat: dcl.StringOrNil(obj["output_format"].(string)), + Properties: checkStringMap(obj["properties"]), + QueryFileUri: dcl.StringOrNil(obj["query_file_uri"].(string)), + QueryList: expandDataprocWorkflowTemplateJobsPrestoJobQueryList(obj["query_list"]), + } +} + +func flattenDataprocWorkflowTemplateJobsPrestoJob(obj *dataproc.WorkflowTemplateJobsPrestoJob) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "client_tags": obj.ClientTags, + "continue_on_failure": obj.ContinueOnFailure, + "logging_config": flattenDataprocWorkflowTemplateJobsPrestoJobLoggingConfig(obj.LoggingConfig), + "output_format": obj.OutputFormat, + "properties": obj.Properties, + "query_file_uri": obj.QueryFileUri, + "query_list": flattenDataprocWorkflowTemplateJobsPrestoJobQueryList(obj.QueryList), + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsPrestoJobLoggingConfig(o interface{}) *dataproc.WorkflowTemplateJobsPrestoJobLoggingConfig { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsPrestoJobLoggingConfig{ + DriverLogLevels: checkStringMap(obj["driver_log_levels"]), + } +} + +func flattenDataprocWorkflowTemplateJobsPrestoJobLoggingConfig(obj *dataproc.WorkflowTemplateJobsPrestoJobLoggingConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "driver_log_levels": obj.DriverLogLevels, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsPrestoJobQueryList(o interface{}) *dataproc.WorkflowTemplateJobsPrestoJobQueryList { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsPrestoJobQueryList{ + Queries: expandStringArray(obj["queries"]), + } +} + +func flattenDataprocWorkflowTemplateJobsPrestoJobQueryList(obj *dataproc.WorkflowTemplateJobsPrestoJobQueryList) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "queries": obj.Queries, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsPysparkJob(o interface{}) *dataproc.WorkflowTemplateJobsPysparkJob { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsPysparkJob{ + MainPythonFileUri: dcl.StringOrNil(obj["main_python_file_uri"].(string)), + ArchiveUris: expandStringArray(obj["archive_uris"]), + Args: expandStringArray(obj["args"]), + FileUris: expandStringArray(obj["file_uris"]), + JarFileUris: expandStringArray(obj["jar_file_uris"]), + LoggingConfig: expandDataprocWorkflowTemplateJobsPysparkJobLoggingConfig(obj["logging_config"]), + Properties: checkStringMap(obj["properties"]), + PythonFileUris: expandStringArray(obj["python_file_uris"]), + } +} + +func flattenDataprocWorkflowTemplateJobsPysparkJob(obj *dataproc.WorkflowTemplateJobsPysparkJob) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "main_python_file_uri": obj.MainPythonFileUri, + "archive_uris": obj.ArchiveUris, + "args": obj.Args, + "file_uris": obj.FileUris, + "jar_file_uris": obj.JarFileUris, + "logging_config": flattenDataprocWorkflowTemplateJobsPysparkJobLoggingConfig(obj.LoggingConfig), + "properties": obj.Properties, + "python_file_uris": obj.PythonFileUris, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsPysparkJobLoggingConfig(o interface{}) *dataproc.WorkflowTemplateJobsPysparkJobLoggingConfig { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsPysparkJobLoggingConfig{ + DriverLogLevels: checkStringMap(obj["driver_log_levels"]), + } +} + +func flattenDataprocWorkflowTemplateJobsPysparkJobLoggingConfig(obj *dataproc.WorkflowTemplateJobsPysparkJobLoggingConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "driver_log_levels": obj.DriverLogLevels, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsScheduling(o interface{}) *dataproc.WorkflowTemplateJobsScheduling { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsScheduling{ + MaxFailuresPerHour: dcl.Int64OrNil(int64(obj["max_failures_per_hour"].(int))), + MaxFailuresTotal: dcl.Int64OrNil(int64(obj["max_failures_total"].(int))), + } +} + +func flattenDataprocWorkflowTemplateJobsScheduling(obj *dataproc.WorkflowTemplateJobsScheduling) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "max_failures_per_hour": obj.MaxFailuresPerHour, + "max_failures_total": obj.MaxFailuresTotal, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsSparkJob(o interface{}) *dataproc.WorkflowTemplateJobsSparkJob { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsSparkJob{ + ArchiveUris: expandStringArray(obj["archive_uris"]), + Args: expandStringArray(obj["args"]), + FileUris: expandStringArray(obj["file_uris"]), + JarFileUris: expandStringArray(obj["jar_file_uris"]), + LoggingConfig: expandDataprocWorkflowTemplateJobsSparkJobLoggingConfig(obj["logging_config"]), + MainClass: dcl.StringOrNil(obj["main_class"].(string)), + MainJarFileUri: dcl.StringOrNil(obj["main_jar_file_uri"].(string)), + Properties: checkStringMap(obj["properties"]), + } +} + +func flattenDataprocWorkflowTemplateJobsSparkJob(obj *dataproc.WorkflowTemplateJobsSparkJob) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "archive_uris": obj.ArchiveUris, + "args": obj.Args, + "file_uris": obj.FileUris, + "jar_file_uris": obj.JarFileUris, + "logging_config": flattenDataprocWorkflowTemplateJobsSparkJobLoggingConfig(obj.LoggingConfig), + "main_class": obj.MainClass, + "main_jar_file_uri": obj.MainJarFileUri, + "properties": obj.Properties, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsSparkJobLoggingConfig(o interface{}) *dataproc.WorkflowTemplateJobsSparkJobLoggingConfig { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsSparkJobLoggingConfig{ + DriverLogLevels: checkStringMap(obj["driver_log_levels"]), + } +} + +func flattenDataprocWorkflowTemplateJobsSparkJobLoggingConfig(obj *dataproc.WorkflowTemplateJobsSparkJobLoggingConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "driver_log_levels": obj.DriverLogLevels, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsSparkRJob(o interface{}) *dataproc.WorkflowTemplateJobsSparkRJob { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsSparkRJob{ + MainRFileUri: dcl.StringOrNil(obj["main_r_file_uri"].(string)), + ArchiveUris: expandStringArray(obj["archive_uris"]), + Args: expandStringArray(obj["args"]), + FileUris: expandStringArray(obj["file_uris"]), + LoggingConfig: expandDataprocWorkflowTemplateJobsSparkRJobLoggingConfig(obj["logging_config"]), + Properties: checkStringMap(obj["properties"]), + } +} + +func flattenDataprocWorkflowTemplateJobsSparkRJob(obj *dataproc.WorkflowTemplateJobsSparkRJob) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "main_r_file_uri": obj.MainRFileUri, + "archive_uris": obj.ArchiveUris, + "args": obj.Args, + "file_uris": obj.FileUris, + "logging_config": flattenDataprocWorkflowTemplateJobsSparkRJobLoggingConfig(obj.LoggingConfig), + "properties": obj.Properties, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsSparkRJobLoggingConfig(o interface{}) *dataproc.WorkflowTemplateJobsSparkRJobLoggingConfig { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsSparkRJobLoggingConfig{ + DriverLogLevels: checkStringMap(obj["driver_log_levels"]), + } +} + +func flattenDataprocWorkflowTemplateJobsSparkRJobLoggingConfig(obj *dataproc.WorkflowTemplateJobsSparkRJobLoggingConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "driver_log_levels": obj.DriverLogLevels, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsSparkSqlJob(o interface{}) *dataproc.WorkflowTemplateJobsSparkSqlJob { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsSparkSqlJob{ + JarFileUris: expandStringArray(obj["jar_file_uris"]), + LoggingConfig: expandDataprocWorkflowTemplateJobsSparkSqlJobLoggingConfig(obj["logging_config"]), + Properties: checkStringMap(obj["properties"]), + QueryFileUri: dcl.StringOrNil(obj["query_file_uri"].(string)), + QueryList: expandDataprocWorkflowTemplateJobsSparkSqlJobQueryList(obj["query_list"]), + ScriptVariables: checkStringMap(obj["script_variables"]), + } +} + +func flattenDataprocWorkflowTemplateJobsSparkSqlJob(obj *dataproc.WorkflowTemplateJobsSparkSqlJob) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "jar_file_uris": obj.JarFileUris, + "logging_config": flattenDataprocWorkflowTemplateJobsSparkSqlJobLoggingConfig(obj.LoggingConfig), + "properties": obj.Properties, + "query_file_uri": obj.QueryFileUri, + "query_list": flattenDataprocWorkflowTemplateJobsSparkSqlJobQueryList(obj.QueryList), + "script_variables": obj.ScriptVariables, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsSparkSqlJobLoggingConfig(o interface{}) *dataproc.WorkflowTemplateJobsSparkSqlJobLoggingConfig { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsSparkSqlJobLoggingConfig{ + DriverLogLevels: checkStringMap(obj["driver_log_levels"]), + } +} + +func flattenDataprocWorkflowTemplateJobsSparkSqlJobLoggingConfig(obj *dataproc.WorkflowTemplateJobsSparkSqlJobLoggingConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "driver_log_levels": obj.DriverLogLevels, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateJobsSparkSqlJobQueryList(o interface{}) *dataproc.WorkflowTemplateJobsSparkSqlJobQueryList { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateJobsSparkSqlJobQueryList{ + Queries: expandStringArray(obj["queries"]), + } +} + +func flattenDataprocWorkflowTemplateJobsSparkSqlJobQueryList(obj *dataproc.WorkflowTemplateJobsSparkSqlJobQueryList) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "queries": obj.Queries, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplatePlacement(o interface{}) *dataproc.WorkflowTemplatePlacement { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplatePlacement{ + ClusterSelector: expandDataprocWorkflowTemplatePlacementClusterSelector(obj["cluster_selector"]), + ManagedCluster: expandDataprocWorkflowTemplatePlacementManagedCluster(obj["managed_cluster"]), + } +} + +func flattenDataprocWorkflowTemplatePlacement(obj *dataproc.WorkflowTemplatePlacement) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "cluster_selector": flattenDataprocWorkflowTemplatePlacementClusterSelector(obj.ClusterSelector), + "managed_cluster": flattenDataprocWorkflowTemplatePlacementManagedCluster(obj.ManagedCluster), + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplatePlacementClusterSelector(o interface{}) *dataproc.WorkflowTemplatePlacementClusterSelector { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplatePlacementClusterSelector{ + ClusterLabels: checkStringMap(obj["cluster_labels"]), + Zone: dcl.StringOrNil(obj["zone"].(string)), + } +} + +func flattenDataprocWorkflowTemplatePlacementClusterSelector(obj *dataproc.WorkflowTemplatePlacementClusterSelector) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "cluster_labels": obj.ClusterLabels, + "zone": obj.Zone, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplatePlacementManagedCluster(o interface{}) *dataproc.WorkflowTemplatePlacementManagedCluster { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplatePlacementManagedCluster{ + ClusterName: dcl.StringOrNil(obj["cluster_name"].(string)), + Config: expandDataprocWorkflowTemplateClusterClusterConfig(obj["config"]), + Labels: checkStringMap(obj["labels"]), + } +} + +func flattenDataprocWorkflowTemplatePlacementManagedCluster(obj *dataproc.WorkflowTemplatePlacementManagedCluster) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "cluster_name": obj.ClusterName, + "config": flattenDataprocWorkflowTemplateClusterClusterConfig(obj.Config), + "labels": obj.Labels, + } + + return []interface{}{transformed} + +} +func expandDataprocWorkflowTemplateParametersArray(o interface{}) []dataproc.WorkflowTemplateParameters { + if o == nil { + return nil + } + + objs := o.([]interface{}) + if len(objs) == 0 { + return nil + } + + items := make([]dataproc.WorkflowTemplateParameters, 0, len(objs)) + for _, item := range objs { + i := expandDataprocWorkflowTemplateParameters(item) + items = append(items, *i) + } + + return items +} + +func expandDataprocWorkflowTemplateParameters(o interface{}) *dataproc.WorkflowTemplateParameters { + if o == nil { + return nil + } + + obj := o.(map[string]interface{}) + return &dataproc.WorkflowTemplateParameters{ + Fields: expandStringArray(obj["fields"]), + Name: dcl.StringOrNil(obj["name"].(string)), + Description: dcl.StringOrNil(obj["description"].(string)), + Validation: expandDataprocWorkflowTemplateParametersValidation(obj["validation"]), + } +} + +func flattenDataprocWorkflowTemplateParametersArray(objs []dataproc.WorkflowTemplateParameters) []interface{} { + if objs == nil { + return nil + } + + items := []interface{}{} + for _, item := range objs { + i := flattenDataprocWorkflowTemplateParameters(&item) + items = append(items, i) + } + + return items +} + +func flattenDataprocWorkflowTemplateParameters(obj *dataproc.WorkflowTemplateParameters) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "fields": obj.Fields, + "name": obj.Name, + "description": obj.Description, + "validation": flattenDataprocWorkflowTemplateParametersValidation(obj.Validation), + } + + return transformed + +} + +func expandDataprocWorkflowTemplateParametersValidation(o interface{}) *dataproc.WorkflowTemplateParametersValidation { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateParametersValidation{ + Regex: expandDataprocWorkflowTemplateParametersValidationRegex(obj["regex"]), + Values: expandDataprocWorkflowTemplateParametersValidationValues(obj["values"]), + } +} + +func flattenDataprocWorkflowTemplateParametersValidation(obj *dataproc.WorkflowTemplateParametersValidation) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "regex": flattenDataprocWorkflowTemplateParametersValidationRegex(obj.Regex), + "values": flattenDataprocWorkflowTemplateParametersValidationValues(obj.Values), + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateParametersValidationRegex(o interface{}) *dataproc.WorkflowTemplateParametersValidationRegex { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateParametersValidationRegex{ + Regexes: expandStringArray(obj["regexes"]), + } +} + +func flattenDataprocWorkflowTemplateParametersValidationRegex(obj *dataproc.WorkflowTemplateParametersValidationRegex) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "regexes": obj.Regexes, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateParametersValidationValues(o interface{}) *dataproc.WorkflowTemplateParametersValidationValues { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.WorkflowTemplateParametersValidationValues{ + Values: expandStringArray(obj["values"]), + } +} + +func flattenDataprocWorkflowTemplateParametersValidationValues(obj *dataproc.WorkflowTemplateParametersValidationValues) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "values": obj.Values, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateClusterInstanceGroupConfig(o interface{}) *dataproc.ClusterInstanceGroupConfig { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.ClusterInstanceGroupConfig{ + Accelerators: expandDataprocWorkflowTemplateClusterInstanceGroupConfigAcceleratorsArray(obj["accelerators"]), + DiskConfig: expandDataprocWorkflowTemplateClusterInstanceGroupConfigDiskConfig(obj["disk_config"]), + Image: dcl.StringOrNil(obj["image"].(string)), + MachineType: dcl.StringOrNil(obj["machine_type"].(string)), + MinCpuPlatform: dcl.StringOrNil(obj["min_cpu_platform"].(string)), + NumInstances: dcl.Int64OrNil(int64(obj["num_instances"].(int))), + Preemptibility: dataproc.ClusterInstanceGroupConfigPreemptibilityEnumRef(obj["preemptibility"].(string)), + } +} + +func flattenDataprocWorkflowTemplateClusterInstanceGroupConfig(obj *dataproc.ClusterInstanceGroupConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "accelerators": flattenDataprocWorkflowTemplateClusterInstanceGroupConfigAcceleratorsArray(obj.Accelerators), + "disk_config": flattenDataprocWorkflowTemplateClusterInstanceGroupConfigDiskConfig(obj.DiskConfig), + "image": obj.Image, + "machine_type": obj.MachineType, + "min_cpu_platform": obj.MinCpuPlatform, + "num_instances": obj.NumInstances, + "preemptibility": obj.Preemptibility, + "instance_names": obj.InstanceNames, + "is_preemptible": obj.IsPreemptible, + "managed_group_config": flattenDataprocWorkflowTemplateClusterInstanceGroupConfigManagedGroupConfig(obj.ManagedGroupConfig), + } + + return []interface{}{transformed} + +} +func expandDataprocWorkflowTemplateClusterInstanceGroupConfigAcceleratorsArray(o interface{}) []dataproc.ClusterInstanceGroupConfigAccelerators { + if o == nil { + return nil + } + + objs := o.([]interface{}) + if len(objs) == 0 { + return nil + } + + items := make([]dataproc.ClusterInstanceGroupConfigAccelerators, 0, len(objs)) + for _, item := range objs { + i := expandDataprocWorkflowTemplateClusterInstanceGroupConfigAccelerators(item) + items = append(items, *i) + } + + return items +} + +func expandDataprocWorkflowTemplateClusterInstanceGroupConfigAccelerators(o interface{}) *dataproc.ClusterInstanceGroupConfigAccelerators { + if o == nil { + return nil + } + + obj := o.(map[string]interface{}) + return &dataproc.ClusterInstanceGroupConfigAccelerators{ + AcceleratorCount: dcl.Int64OrNil(int64(obj["accelerator_count"].(int))), + AcceleratorType: dcl.StringOrNil(obj["accelerator_type"].(string)), + } +} + +func flattenDataprocWorkflowTemplateClusterInstanceGroupConfigAcceleratorsArray(objs []dataproc.ClusterInstanceGroupConfigAccelerators) []interface{} { + if objs == nil { + return nil + } + + items := []interface{}{} + for _, item := range objs { + i := flattenDataprocWorkflowTemplateClusterInstanceGroupConfigAccelerators(&item) + items = append(items, i) + } + + return items +} + +func flattenDataprocWorkflowTemplateClusterInstanceGroupConfigAccelerators(obj *dataproc.ClusterInstanceGroupConfigAccelerators) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "accelerator_count": obj.AcceleratorCount, + "accelerator_type": obj.AcceleratorType, + } + + return transformed + +} + +func expandDataprocWorkflowTemplateClusterInstanceGroupConfigDiskConfig(o interface{}) *dataproc.ClusterInstanceGroupConfigDiskConfig { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.ClusterInstanceGroupConfigDiskConfig{ + BootDiskSizeGb: dcl.Int64OrNil(int64(obj["boot_disk_size_gb"].(int))), + BootDiskType: dcl.StringOrNil(obj["boot_disk_type"].(string)), + NumLocalSsds: dcl.Int64OrNil(int64(obj["num_local_ssds"].(int))), + } +} + +func flattenDataprocWorkflowTemplateClusterInstanceGroupConfigDiskConfig(obj *dataproc.ClusterInstanceGroupConfigDiskConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "boot_disk_size_gb": obj.BootDiskSizeGb, + "boot_disk_type": obj.BootDiskType, + "num_local_ssds": obj.NumLocalSsds, + } + + return []interface{}{transformed} + +} + +func flattenDataprocWorkflowTemplateClusterInstanceGroupConfigManagedGroupConfig(obj *dataproc.ClusterInstanceGroupConfigManagedGroupConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "instance_group_manager_name": obj.InstanceGroupManagerName, + "instance_template_name": obj.InstanceTemplateName, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateClusterClusterConfig(o interface{}) *dataproc.ClusterClusterConfig { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.ClusterClusterConfig{ + AutoscalingConfig: expandDataprocWorkflowTemplateClusterClusterConfigAutoscalingConfig(obj["autoscaling_config"]), + EncryptionConfig: expandDataprocWorkflowTemplateClusterClusterConfigEncryptionConfig(obj["encryption_config"]), + EndpointConfig: expandDataprocWorkflowTemplateClusterClusterConfigEndpointConfig(obj["endpoint_config"]), + GceClusterConfig: expandDataprocWorkflowTemplateClusterClusterConfigGceClusterConfig(obj["gce_cluster_config"]), + InitializationActions: expandDataprocWorkflowTemplateClusterClusterConfigInitializationActionsArray(obj["initialization_actions"]), + LifecycleConfig: expandDataprocWorkflowTemplateClusterClusterConfigLifecycleConfig(obj["lifecycle_config"]), + MasterConfig: expandDataprocWorkflowTemplateClusterInstanceGroupConfig(obj["master_config"]), + SecondaryWorkerConfig: expandDataprocWorkflowTemplateClusterInstanceGroupConfig(obj["secondary_worker_config"]), + SecurityConfig: expandDataprocWorkflowTemplateClusterClusterConfigSecurityConfig(obj["security_config"]), + SoftwareConfig: expandDataprocWorkflowTemplateClusterClusterConfigSoftwareConfig(obj["software_config"]), + StagingBucket: dcl.StringOrNil(obj["staging_bucket"].(string)), + TempBucket: dcl.StringOrNil(obj["temp_bucket"].(string)), + WorkerConfig: expandDataprocWorkflowTemplateClusterInstanceGroupConfig(obj["worker_config"]), + } +} + +func flattenDataprocWorkflowTemplateClusterClusterConfig(obj *dataproc.ClusterClusterConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "autoscaling_config": flattenDataprocWorkflowTemplateClusterClusterConfigAutoscalingConfig(obj.AutoscalingConfig), + "encryption_config": flattenDataprocWorkflowTemplateClusterClusterConfigEncryptionConfig(obj.EncryptionConfig), + "endpoint_config": flattenDataprocWorkflowTemplateClusterClusterConfigEndpointConfig(obj.EndpointConfig), + "gce_cluster_config": flattenDataprocWorkflowTemplateClusterClusterConfigGceClusterConfig(obj.GceClusterConfig), + "initialization_actions": flattenDataprocWorkflowTemplateClusterClusterConfigInitializationActionsArray(obj.InitializationActions), + "lifecycle_config": flattenDataprocWorkflowTemplateClusterClusterConfigLifecycleConfig(obj.LifecycleConfig), + "master_config": flattenDataprocWorkflowTemplateClusterInstanceGroupConfig(obj.MasterConfig), + "secondary_worker_config": flattenDataprocWorkflowTemplateClusterInstanceGroupConfig(obj.SecondaryWorkerConfig), + "security_config": flattenDataprocWorkflowTemplateClusterClusterConfigSecurityConfig(obj.SecurityConfig), + "software_config": flattenDataprocWorkflowTemplateClusterClusterConfigSoftwareConfig(obj.SoftwareConfig), + "staging_bucket": obj.StagingBucket, + "temp_bucket": obj.TempBucket, + "worker_config": flattenDataprocWorkflowTemplateClusterInstanceGroupConfig(obj.WorkerConfig), + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateClusterClusterConfigAutoscalingConfig(o interface{}) *dataproc.ClusterClusterConfigAutoscalingConfig { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.ClusterClusterConfigAutoscalingConfig{ + Policy: dcl.StringOrNil(obj["policy"].(string)), + } +} + +func flattenDataprocWorkflowTemplateClusterClusterConfigAutoscalingConfig(obj *dataproc.ClusterClusterConfigAutoscalingConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "policy": obj.Policy, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateClusterClusterConfigEncryptionConfig(o interface{}) *dataproc.ClusterClusterConfigEncryptionConfig { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.ClusterClusterConfigEncryptionConfig{ + GcePdKmsKeyName: dcl.StringOrNil(obj["gce_pd_kms_key_name"].(string)), + } +} + +func flattenDataprocWorkflowTemplateClusterClusterConfigEncryptionConfig(obj *dataproc.ClusterClusterConfigEncryptionConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "gce_pd_kms_key_name": obj.GcePdKmsKeyName, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateClusterClusterConfigEndpointConfig(o interface{}) *dataproc.ClusterClusterConfigEndpointConfig { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.ClusterClusterConfigEndpointConfig{ + EnableHttpPortAccess: dcl.Bool(obj["enable_http_port_access"].(bool)), + } +} + +func flattenDataprocWorkflowTemplateClusterClusterConfigEndpointConfig(obj *dataproc.ClusterClusterConfigEndpointConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "enable_http_port_access": obj.EnableHttpPortAccess, + "http_ports": obj.HttpPorts, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateClusterClusterConfigGceClusterConfig(o interface{}) *dataproc.ClusterClusterConfigGceClusterConfig { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.ClusterClusterConfigGceClusterConfig{ + InternalIPOnly: dcl.Bool(obj["internal_ip_only"].(bool)), + Metadata: checkStringMap(obj["metadata"]), + Network: dcl.StringOrNil(obj["network"].(string)), + NodeGroupAffinity: expandDataprocWorkflowTemplateClusterClusterConfigGceClusterConfigNodeGroupAffinity(obj["node_group_affinity"]), + PrivateIPv6GoogleAccess: dataproc.ClusterClusterConfigGceClusterConfigPrivateIPv6GoogleAccessEnumRef(obj["private_ipv6_google_access"].(string)), + ReservationAffinity: expandDataprocWorkflowTemplateClusterClusterConfigGceClusterConfigReservationAffinity(obj["reservation_affinity"]), + ServiceAccount: dcl.StringOrNil(obj["service_account"].(string)), + ServiceAccountScopes: expandStringArray(obj["service_account_scopes"]), + Subnetwork: dcl.StringOrNil(obj["subnetwork"].(string)), + Tags: expandStringArray(obj["tags"]), + Zone: dcl.StringOrNil(obj["zone"].(string)), + } +} + +func flattenDataprocWorkflowTemplateClusterClusterConfigGceClusterConfig(obj *dataproc.ClusterClusterConfigGceClusterConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "internal_ip_only": obj.InternalIPOnly, + "metadata": obj.Metadata, + "network": obj.Network, + "node_group_affinity": flattenDataprocWorkflowTemplateClusterClusterConfigGceClusterConfigNodeGroupAffinity(obj.NodeGroupAffinity), + "private_ipv6_google_access": obj.PrivateIPv6GoogleAccess, + "reservation_affinity": flattenDataprocWorkflowTemplateClusterClusterConfigGceClusterConfigReservationAffinity(obj.ReservationAffinity), + "service_account": obj.ServiceAccount, + "service_account_scopes": obj.ServiceAccountScopes, + "subnetwork": obj.Subnetwork, + "tags": obj.Tags, + "zone": obj.Zone, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateClusterClusterConfigGceClusterConfigNodeGroupAffinity(o interface{}) *dataproc.ClusterClusterConfigGceClusterConfigNodeGroupAffinity { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.ClusterClusterConfigGceClusterConfigNodeGroupAffinity{ + NodeGroup: dcl.StringOrNil(obj["node_group"].(string)), + } +} + +func flattenDataprocWorkflowTemplateClusterClusterConfigGceClusterConfigNodeGroupAffinity(obj *dataproc.ClusterClusterConfigGceClusterConfigNodeGroupAffinity) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "node_group": obj.NodeGroup, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateClusterClusterConfigGceClusterConfigReservationAffinity(o interface{}) *dataproc.ClusterClusterConfigGceClusterConfigReservationAffinity { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.ClusterClusterConfigGceClusterConfigReservationAffinity{ + ConsumeReservationType: dataproc.ClusterClusterConfigGceClusterConfigReservationAffinityConsumeReservationTypeEnumRef(obj["consume_reservation_type"].(string)), + Key: dcl.StringOrNil(obj["key"].(string)), + Values: expandStringArray(obj["values"]), + } +} + +func flattenDataprocWorkflowTemplateClusterClusterConfigGceClusterConfigReservationAffinity(obj *dataproc.ClusterClusterConfigGceClusterConfigReservationAffinity) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "consume_reservation_type": obj.ConsumeReservationType, + "key": obj.Key, + "values": obj.Values, + } + + return []interface{}{transformed} + +} +func expandDataprocWorkflowTemplateClusterClusterConfigInitializationActionsArray(o interface{}) []dataproc.ClusterClusterConfigInitializationActions { + if o == nil { + return nil + } + + objs := o.([]interface{}) + if len(objs) == 0 { + return nil + } + + items := make([]dataproc.ClusterClusterConfigInitializationActions, 0, len(objs)) + for _, item := range objs { + i := expandDataprocWorkflowTemplateClusterClusterConfigInitializationActions(item) + items = append(items, *i) + } + + return items +} + +func expandDataprocWorkflowTemplateClusterClusterConfigInitializationActions(o interface{}) *dataproc.ClusterClusterConfigInitializationActions { + if o == nil { + return nil + } + + obj := o.(map[string]interface{}) + return &dataproc.ClusterClusterConfigInitializationActions{ + ExecutableFile: dcl.StringOrNil(obj["executable_file"].(string)), + ExecutionTimeout: dcl.StringOrNil(obj["execution_timeout"].(string)), + } +} + +func flattenDataprocWorkflowTemplateClusterClusterConfigInitializationActionsArray(objs []dataproc.ClusterClusterConfigInitializationActions) []interface{} { + if objs == nil { + return nil + } + + items := []interface{}{} + for _, item := range objs { + i := flattenDataprocWorkflowTemplateClusterClusterConfigInitializationActions(&item) + items = append(items, i) + } + + return items +} + +func flattenDataprocWorkflowTemplateClusterClusterConfigInitializationActions(obj *dataproc.ClusterClusterConfigInitializationActions) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "executable_file": obj.ExecutableFile, + "execution_timeout": obj.ExecutionTimeout, + } + + return transformed + +} + +func expandDataprocWorkflowTemplateClusterClusterConfigLifecycleConfig(o interface{}) *dataproc.ClusterClusterConfigLifecycleConfig { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.ClusterClusterConfigLifecycleConfig{ + AutoDeleteTime: dcl.StringOrNil(obj["auto_delete_time"].(string)), + AutoDeleteTtl: dcl.StringOrNil(obj["auto_delete_ttl"].(string)), + IdleDeleteTtl: dcl.StringOrNil(obj["idle_delete_ttl"].(string)), + } +} + +func flattenDataprocWorkflowTemplateClusterClusterConfigLifecycleConfig(obj *dataproc.ClusterClusterConfigLifecycleConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "auto_delete_time": obj.AutoDeleteTime, + "auto_delete_ttl": obj.AutoDeleteTtl, + "idle_delete_ttl": obj.IdleDeleteTtl, + "idle_start_time": obj.IdleStartTime, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateClusterClusterConfigSecurityConfig(o interface{}) *dataproc.ClusterClusterConfigSecurityConfig { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.ClusterClusterConfigSecurityConfig{ + KerberosConfig: expandDataprocWorkflowTemplateClusterClusterConfigSecurityConfigKerberosConfig(obj["kerberos_config"]), + } +} + +func flattenDataprocWorkflowTemplateClusterClusterConfigSecurityConfig(obj *dataproc.ClusterClusterConfigSecurityConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "kerberos_config": flattenDataprocWorkflowTemplateClusterClusterConfigSecurityConfigKerberosConfig(obj.KerberosConfig), + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateClusterClusterConfigSecurityConfigKerberosConfig(o interface{}) *dataproc.ClusterClusterConfigSecurityConfigKerberosConfig { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.ClusterClusterConfigSecurityConfigKerberosConfig{ + CrossRealmTrustAdminServer: dcl.StringOrNil(obj["cross_realm_trust_admin_server"].(string)), + CrossRealmTrustKdc: dcl.StringOrNil(obj["cross_realm_trust_kdc"].(string)), + CrossRealmTrustRealm: dcl.StringOrNil(obj["cross_realm_trust_realm"].(string)), + CrossRealmTrustSharedPassword: dcl.StringOrNil(obj["cross_realm_trust_shared_password"].(string)), + EnableKerberos: dcl.Bool(obj["enable_kerberos"].(bool)), + KdcDbKey: dcl.StringOrNil(obj["kdc_db_key"].(string)), + KeyPassword: dcl.StringOrNil(obj["key_password"].(string)), + Keystore: dcl.StringOrNil(obj["keystore"].(string)), + KeystorePassword: dcl.StringOrNil(obj["keystore_password"].(string)), + KmsKey: dcl.StringOrNil(obj["kms_key"].(string)), + Realm: dcl.StringOrNil(obj["realm"].(string)), + RootPrincipalPassword: dcl.StringOrNil(obj["root_principal_password"].(string)), + TgtLifetimeHours: dcl.Int64OrNil(int64(obj["tgt_lifetime_hours"].(int))), + Truststore: dcl.StringOrNil(obj["truststore"].(string)), + TruststorePassword: dcl.StringOrNil(obj["truststore_password"].(string)), + } +} + +func flattenDataprocWorkflowTemplateClusterClusterConfigSecurityConfigKerberosConfig(obj *dataproc.ClusterClusterConfigSecurityConfigKerberosConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "cross_realm_trust_admin_server": obj.CrossRealmTrustAdminServer, + "cross_realm_trust_kdc": obj.CrossRealmTrustKdc, + "cross_realm_trust_realm": obj.CrossRealmTrustRealm, + "cross_realm_trust_shared_password": obj.CrossRealmTrustSharedPassword, + "enable_kerberos": obj.EnableKerberos, + "kdc_db_key": obj.KdcDbKey, + "key_password": obj.KeyPassword, + "keystore": obj.Keystore, + "keystore_password": obj.KeystorePassword, + "kms_key": obj.KmsKey, + "realm": obj.Realm, + "root_principal_password": obj.RootPrincipalPassword, + "tgt_lifetime_hours": obj.TgtLifetimeHours, + "truststore": obj.Truststore, + "truststore_password": obj.TruststorePassword, + } + + return []interface{}{transformed} + +} + +func expandDataprocWorkflowTemplateClusterClusterConfigSoftwareConfig(o interface{}) *dataproc.ClusterClusterConfigSoftwareConfig { + if o == nil { + return nil + } + objArr := o.([]interface{}) + if len(objArr) == 0 { + return nil + } + obj := objArr[0].(map[string]interface{}) + return &dataproc.ClusterClusterConfigSoftwareConfig{ + ImageVersion: dcl.StringOrNil(obj["image_version"].(string)), + Properties: checkStringMap(obj["properties"]), + } +} + +func flattenDataprocWorkflowTemplateClusterClusterConfigSoftwareConfig(obj *dataproc.ClusterClusterConfigSoftwareConfig) interface{} { + if obj == nil { + return nil + } + transformed := map[string]interface{}{ + "image_version": obj.ImageVersion, + "properties": obj.Properties, + } + + return []interface{}{transformed} + +} diff --git a/google/resource_dataproc_workflow_template_sweeper_test.go b/google/resource_dataproc_workflow_template_sweeper_test.go new file mode 100644 index 00000000000..c4e7d5f6379 --- /dev/null +++ b/google/resource_dataproc_workflow_template_sweeper_test.go @@ -0,0 +1,56 @@ +package google + +import ( + "context" + "log" + "testing" + + dataproc "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/dataproc" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" +) + +func init() { + resource.AddTestSweepers("DataprocWorkflow_template", &resource.Sweeper{ + Name: "DataprocWorkflow_template", + F: testSweepDataprocWorkflow_template, + }) +} + +func testSweepDataprocWorkflow_template(region string) error { + resourceName := "DataprocWorkflow_template" + log.Printf("[INFO][SWEEPER_LOG] Starting sweeper for %s", resourceName) + + config, err := sharedConfigForRegion(region) + if err != nil { + log.Printf("[INFO][SWEEPER_LOG] error getting shared config for region: %s", err) + return err + } + + err = config.LoadAndValidate(context.Background()) + if err != nil { + log.Printf("[INFO][SWEEPER_LOG] error loading: %s", err) + return err + } + + t := &testing.T{} + billingId := getTestBillingAccountFromEnv(t) + + // Setup variables to be used for Delete arguments. + d := map[string]string{ + "project": config.Project, + "region": region, + "location": region, + "zone": "-", + "billing_account": billingId, + } + + err = config.clientDataprocDCL.DeleteAllWorkflowTemplate(context.Background(), d["project"], d["location"], isDeletableDataprocWorkflow_template) + if err != nil { + return err + } + return nil +} + +func isDeletableDataprocWorkflow_template(r *dataproc.WorkflowTemplate) bool { + return isSweepableTestResource(*r.Name) +} diff --git a/google/resource_dataproc_workflow_template_test.go b/google/resource_dataproc_workflow_template_test.go new file mode 100644 index 00000000000..d80b277d70c --- /dev/null +++ b/google/resource_dataproc_workflow_template_test.go @@ -0,0 +1,129 @@ +package google + +import ( + "fmt" + "strings" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" +) + +func TestAccDataprocWorkflowTemplate_basic(t *testing.T) { + // DCL currently fails due to transport modification + skipIfVcr(t) + t.Parallel() + + context := map[string]interface{}{ + "random_suffix": randString(t, 10), + "project": getTestProjectFromEnv(), + } + + vcrTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: funcAccTestDataprocWorkflowTemplateCheckDestroy(t), + ExternalProviders: map[string]resource.ExternalProvider{ + "random": {}, + }, + Steps: []resource.TestStep{ + { + Config: testAccDataprocWorkflowTemplate_basic(context), + }, + { + ImportState: true, + ImportStateVerify: true, + ResourceName: "google_dataproc_workflow_template.template", + }, + }, + }) +} + +func testAccDataprocWorkflowTemplate_basic(context map[string]interface{}) string { + return Nprintf(` +resource "google_dataproc_workflow_template" "template" { + name = "template%{random_suffix}" + location = "us-central1" + placement { + managed_cluster { + cluster_name = "my-cluster" + config { + gce_cluster_config { + zone = "us-central1-a" + tags = ["foo", "bar"] + } + master_config { + num_instances = 1 + machine_type = "n1-standard-1" + disk_config { + boot_disk_type = "pd-ssd" + boot_disk_size_gb = 15 + } + } + worker_config { + num_instances = 3 + machine_type = "n1-standard-2" + disk_config { + boot_disk_size_gb = 10 + num_local_ssds = 2 + } + } + + secondary_worker_config { + num_instances = 2 + } + software_config { + image_version = "1.3.7-deb9" + } + } + } + } + jobs { + step_id = "someJob" + spark_job { + main_class = "SomeClass" + } + } + jobs { + step_id = "otherJob" + prerequisite_step_ids = ["someJob"] + presto_job { + query_file_uri = "someuri" + } + } +} +`, context) +} + +func funcAccTestDataprocWorkflowTemplateCheckDestroy(t *testing.T) func(s *terraform.State) error { + return func(s *terraform.State) error { + for name, rs := range s.RootModule().Resources { + if rs.Type != "google_dataproc_workflow_template" { + continue + } + if strings.HasPrefix(name, "data.") { + continue + } + + config := googleProviderConfig(t) + + url, err := replaceVarsForTest(config, rs, "{{DataprocBasePath}}projects/{{project}}/locations/{{location}}/workflowTemplates/{{name}}") + if err != nil { + return err + } + + billingProject := "" + + if config.BillingProject != "" { + billingProject = config.BillingProject + } + + _, err = sendRequest(config, "GET", billingProject, url, config.userAgent, nil) + if err == nil { + return fmt.Errorf("DataprocWorkflowTemplate still exists at %s", url) + } + } + + return nil + } +} diff --git a/google/utils.go b/google/utils.go index 2e913fd61a3..a80e9091b20 100644 --- a/google/utils.go +++ b/google/utils.go @@ -482,14 +482,6 @@ func SnakeToPascalCase(s string) string { return strings.Join(split, "") } -func checkStringMap(v interface{}) map[string]string { - m, ok := v.(map[string]string) - if ok { - return m - } - return convertStringMap(v.(map[string]interface{})) -} - func multiEnvSearch(ks []string) string { for _, k := range ks { if v := os.Getenv(k); v != "" { @@ -498,3 +490,11 @@ func multiEnvSearch(ks []string) string { } return "" } + +func checkStringMap(v interface{}) map[string]string { + m, ok := v.(map[string]string) + if ok { + return m + } + return convertStringMap(v.(map[string]interface{})) +} diff --git a/website/docs/r/dataproc_workflow_template.html.markdown b/website/docs/r/dataproc_workflow_template.html.markdown new file mode 100644 index 00000000000..e725a51818b --- /dev/null +++ b/website/docs/r/dataproc_workflow_template.html.markdown @@ -0,0 +1,895 @@ +--- +# ---------------------------------------------------------------------------- +# +# *** 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. +# +# ---------------------------------------------------------------------------- +--- + +subcategory: "Dataproc" +layout: "google" +page_title: "Google: google_dataproc_workflow_template" +sidebar_current: "docs-google-dataproc-workflow-template" +description: |- + A Workflow Template is a reusable workflow configuration. +--- + +# google\_dataproc\_workflow\_template + +A Workflow Template is a reusable workflow configuration. It defines a graph of jobs with information on where to run those jobs. + +## Example Usage + +```hcl +resource "google_dataproc_workflow_template" "template" { + name = "template-example" + location = "us-central1" + placement { + managed_cluster { + cluster_name = "my-cluster" + config { + gce_cluster_config { + zone = "us-central1-a" + tags = ["foo", "bar"] + } + master_config { + num_instances = 1 + machine_type = "n1-standard-1" + disk_config { + boot_disk_type = "pd-ssd" + boot_disk_size_gb = 15 + } + } + worker_config { + num_instances = 3 + machine_type = "n1-standard-2" + disk_config { + boot_disk_size_gb = 10 + num_local_ssds = 2 + } + } + + secondary_worker_config { + num_instances = 2 + } + software_config { + image_version = "1.3.7-deb9" + } + } + } + } + jobs { + step_id = "someJob" + spark_job { + main_class = "SomeClass" + } + } + jobs { + step_id = "otherJob" + prerequisite_step_ids = ["someJob"] + presto_job { + query_file_uri = "someuri" + } + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `jobs` - + (Required) + Required. The Directed Acyclic Graph of Jobs to submit. + +* `location` - + (Required) + The location for the resource + +* `name` - + (Required) + Output only. The resource name of the workflow template, as described in https://cloud.google.com/apis/design/resource_names. * For `projects.regions.workflowTemplates`, the resource name of the template has the following format: `projects/{project_id}/regions/{region}/workflowTemplates/{template_id}` * For `projects.locations.workflowTemplates`, the resource name of the template has the following format: `projects/{project_id}/locations/{location}/workflowTemplates/{template_id}` + +* `placement` - + (Required) + Required. WorkflowTemplate scheduling information. + + +The `jobs` block supports: + +* `hadoop_job` - + (Optional) + Optional. Job is a Hadoop job. + +* `hive_job` - + (Optional) + Optional. Job is a Hive job. + +* `labels` - + (Optional) + Optional. The labels to associate with this job. Label keys must be between 1 and 63 characters long, and must conform to the following regular expression: {0,63} No more than 32 labels can be associated with a given job. + +* `pig_job` - + (Optional) + Optional. Job is a Pig job. + +* `prerequisite_step_ids` - + (Optional) + Optional. The optional list of prerequisite job step_ids. If not specified, the job will start at the beginning of workflow. + +* `presto_job` - + (Optional) + Optional. Job is a Presto job. + +* `pyspark_job` - + (Optional) + Optional. Job is a PySpark job. + +* `scheduling` - + (Optional) + Optional. Job scheduling configuration. + +* `spark_job` - + (Optional) + Optional. Job is a Spark job. + +* `spark_r_job` - + (Optional) + Optional. Job is a SparkR job. + +* `spark_sql_job` - + (Optional) + Optional. Job is a SparkSql job. + +* `step_id` - + (Required) + Required. The step id. The id must be unique among all jobs within the template. The step id is used as prefix for job id, as job `goog-dataproc-workflow-step-id` label, and in field from other steps. The id must contain only letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-). Cannot begin or end with underscore or hyphen. Must consist of between 3 and 50 characters. + The `placement` block supports: + +* `cluster_selector` - + (Optional) + Optional. A selector that chooses target cluster for jobs based on metadata. The selector is evaluated at the time each job is submitted. + +* `managed_cluster` - + (Optional) + A cluster that is managed by the workflow. + The `config` block supports: + +* `autoscaling_config` - + (Optional) + Optional. Autoscaling config for the policy associated with the cluster. Cluster does not autoscale if this field is unset. + +* `encryption_config` - + (Optional) + Optional. Encryption settings for the cluster. + +* `endpoint_config` - + (Optional) + Optional. Port/endpoint configuration for this cluster + +* `gce_cluster_config` - + (Optional) + Optional. The shared Compute Engine config settings for all instances in a cluster. + +* `gke_cluster_config` - + (Optional) + Optional. The Kubernetes Engine config for Dataproc clusters deployed to Kubernetes. Setting this is considered mutually exclusive with Compute Engine-based options such as `gce_cluster_config`, `master_config`, `worker_config`, `secondary_worker_config`, and `autoscaling_config`. + +* `initialization_actions` - + (Optional) + Optional. Commands to execute on each node after config is completed. By default, executables are run on master and all worker nodes. You can test a node's `role` metadata to run an executable on a master or worker node, as shown below using `curl` (you can also use `wget`): ROLE=$(curl -H Metadata-Flavor:Google http://metadata/computeMetadata/v1/instance/attributes/dataproc-role) if ; then ... master specific actions ... else ... worker specific actions ... fi + +* `lifecycle_config` - + (Optional) + Optional. Lifecycle setting for the cluster. + +* `master_config` - + (Optional) + Optional. The Compute Engine config settings for additional worker instances in a cluster. + +* `metastore_config` - + (Optional) + Optional. Metastore configuration. + +* `secondary_worker_config` - + (Optional) + Optional. The Compute Engine config settings for additional worker instances in a cluster. + +* `security_config` - + (Optional) + Optional. Security settings for the cluster. + +* `software_config` - + (Optional) + Optional. The config settings for software inside the cluster. + +* `staging_bucket` - + (Optional) + Optional. A Cloud Storage bucket used to stage job dependencies, config files, and job driver console output. If you do not specify a staging bucket, Cloud Dataproc will determine a Cloud Storage location (US, ASIA, or EU) for your cluster's staging bucket according to the Compute Engine zone where your cluster is deployed, and then create and manage this project-level, per-location bucket (see (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/staging-bucket)). + +* `temp_bucket` - + (Optional) + Optional. A Cloud Storage bucket used to store ephemeral cluster and jobs data, such as Spark and MapReduce history files. If you do not specify a temp bucket, Dataproc will determine a Cloud Storage location (US, ASIA, or EU) for your cluster's temp bucket according to the Compute Engine zone where your cluster is deployed, and then create and manage this project-level, per-location bucket. The default bucket has a TTL of 90 days, but you can use any TTL (or none) if you specify a bucket. + +* `worker_config` - + (Optional) + Optional. The Compute Engine config settings for additional worker instances in a cluster. + +- - - + +* `dag_timeout` - + (Optional) + (Beta only) Optional. Timeout duration for the DAG of jobs. You can use "s", "m", "h", and "d" suffixes for second, minute, hour, and day duration values, respectively. The timeout duration must be from 10 minutes ("10m") to 24 hours ("24h" or "1d"). The timer begins when the first job is submitted. If the workflow is running at the end of the timeout period, any remaining jobs are cancelled, the workflow is ended, and if the workflow was running on a (/dataproc/docs/concepts/workflows/using-workflows#configuring_or_selecting_a_cluster), the cluster is deleted. + +* `labels` - + (Optional) + Optional. The labels to associate with this template. These labels will be propagated to all jobs and clusters created by the workflow instance. Label **keys** must contain 1 to 63 characters, and must conform to (https://www.ietf.org/rfc/rfc1035.txt). No more than 32 labels can be associated with a template. + +* `parameters` - + (Optional) + Optional. Template parameters whose values are substituted into the template. Values for parameters must be provided when the template is instantiated. + +* `project` - + (Optional) + The project for the resource + +* `version` - + (Optional) + Optional. Used to perform a consistent read-modify-write. This field should be left blank for a `CreateWorkflowTemplate` request. It is required for an `UpdateWorkflowTemplate` request, and must match the current server version. A typical update template flow would fetch the current template with a `GetWorkflowTemplate` request, which will return the current template with the `version` field filled in with the current server version. The user updates other fields in the template, then returns it as part of the `UpdateWorkflowTemplate` request. + + +The `hadoop_job` block supports: + +* `archive_uris` - + (Optional) + Optional. HCFS URIs of archives to be extracted in the working directory of Hadoop drivers and tasks. Supported file types: .jar, .tar, .tar.gz, .tgz, or .zip. + +* `args` - + (Optional) + Optional. The arguments to pass to the driver. Do not include arguments, such as `-libjars` or `-Dfoo=bar`, that can be set as job properties, since a collision may occur that causes an incorrect job submission. + +* `file_uris` - + (Optional) + Optional. HCFS (Hadoop Compatible Filesystem) URIs of files to be copied to the working directory of Hadoop drivers and distributed tasks. Useful for naively parallel tasks. + +* `jar_file_uris` - + (Optional) + Optional. Jar file URIs to add to the CLASSPATHs of the Hadoop driver and tasks. + +* `logging_config` - + (Optional) + Optional. The runtime log config for job execution. + +* `main_class` - + (Optional) + The name of the driver's main class. The jar file containing the class must be in the default CLASSPATH or specified in `jar_file_uris`. + +* `main_jar_file_uri` - + (Optional) + The HCFS URI of the jar file containing the main class. Examples: 'gs://foo-bucket/analytics-binaries/extract-useful-metrics-mr.jar' 'hdfs:/tmp/test-samples/custom-wordcount.jar' 'file:///home/usr/lib/hadoop-mapreduce/hadoop-mapreduce-examples.jar' + +* `properties` - + (Optional) + Optional. A mapping of property names to values, used to configure Hadoop. Properties that conflict with values set by the Dataproc API may be overwritten. Can include properties set in /etc/hadoop/conf/*-site and classes in user code. + The `logging_config` block supports: + +* `driver_log_levels` - + (Optional) + The per-package log levels for the driver. This may include "root" package name to configure rootLogger. Examples: 'com.google = FATAL', 'root = INFO', 'org.apache = DEBUG' + The `hive_job` block supports: + +* `continue_on_failure` - + (Optional) + Optional. Whether to continue executing queries if a query fails. The default value is `false`. Setting to `true` can be useful when executing independent parallel queries. + +* `jar_file_uris` - + (Optional) + Optional. HCFS URIs of jar files to add to the CLASSPATH of the Hive server and Hadoop MapReduce (MR) tasks. Can contain Hive SerDes and UDFs. + +* `properties` - + (Optional) + Optional. A mapping of property names and values, used to configure Hive. Properties that conflict with values set by the Dataproc API may be overwritten. Can include properties set in /etc/hadoop/conf/*-site.xml, /etc/hive/conf/hive-site.xml, and classes in user code. + +* `query_file_uri` - + (Optional) + The HCFS URI of the script that contains Hive queries. + +* `query_list` - + (Optional) + A list of queries. + +* `script_variables` - + (Optional) + Optional. Mapping of query variable names to values (equivalent to the Hive command: `SET name="value";`). + The `query_list` block supports: + +* `queries` - + (Required) + Required. The queries to execute. You do not need to end a query expression with a semicolon. Multiple queries can be specified in one string by separating each with a semicolon. Here is an example of a Dataproc API snippet that uses a QueryList to specify a HiveJob: "hiveJob": { "queryList": { "queries": } } + The `pig_job` block supports: + +* `continue_on_failure` - + (Optional) + Optional. Whether to continue executing queries if a query fails. The default value is `false`. Setting to `true` can be useful when executing independent parallel queries. + +* `jar_file_uris` - + (Optional) + Optional. HCFS URIs of jar files to add to the CLASSPATH of the Pig Client and Hadoop MapReduce (MR) tasks. Can contain Pig UDFs. + +* `logging_config` - + (Optional) + Optional. The runtime log config for job execution. + +* `properties` - + (Optional) + Optional. A mapping of property names to values, used to configure Pig. Properties that conflict with values set by the Dataproc API may be overwritten. Can include properties set in /etc/hadoop/conf/*-site.xml, /etc/pig/conf/pig.properties, and classes in user code. + +* `query_file_uri` - + (Optional) + The HCFS URI of the script that contains the Pig queries. + +* `query_list` - + (Optional) + A list of queries. + +* `script_variables` - + (Optional) + Optional. Mapping of query variable names to values (equivalent to the Pig command: `name=`). + The `logging_config` block supports: + +* `driver_log_levels` - + (Optional) + The per-package log levels for the driver. This may include "root" package name to configure rootLogger. Examples: 'com.google = FATAL', 'root = INFO', 'org.apache = DEBUG' + The `query_list` block supports: + +* `queries` - + (Required) + Required. The queries to execute. You do not need to end a query expression with a semicolon. Multiple queries can be specified in one string by separating each with a semicolon. Here is an example of a Dataproc API snippet that uses a QueryList to specify a HiveJob: "hiveJob": { "queryList": { "queries": } } + The `presto_job` block supports: + +* `client_tags` - + (Optional) + Optional. Presto client tags to attach to this query + +* `continue_on_failure` - + (Optional) + Optional. Whether to continue executing queries if a query fails. The default value is `false`. Setting to `true` can be useful when executing independent parallel queries. + +* `logging_config` - + (Optional) + Optional. The runtime log config for job execution. + +* `output_format` - + (Optional) + Optional. The format in which query output will be displayed. See the Presto documentation for supported output formats + +* `properties` - + (Optional) + Optional. A mapping of property names to values. Used to set Presto (https://prestodb.io/docs/current/sql/set-session.html) Equivalent to using the --session flag in the Presto CLI + +* `query_file_uri` - + (Optional) + The HCFS URI of the script that contains SQL queries. + +* `query_list` - + (Optional) + A list of queries. + The `logging_config` block supports: + +* `driver_log_levels` - + (Optional) + The per-package log levels for the driver. This may include "root" package name to configure rootLogger. Examples: 'com.google = FATAL', 'root = INFO', 'org.apache = DEBUG' + The `query_list` block supports: + +* `queries` - + (Required) + Required. The queries to execute. You do not need to end a query expression with a semicolon. Multiple queries can be specified in one string by separating each with a semicolon. Here is an example of a Dataproc API snippet that uses a QueryList to specify a HiveJob: "hiveJob": { "queryList": { "queries": } } + The `pyspark_job` block supports: + +* `archive_uris` - + (Optional) + Optional. HCFS URIs of archives to be extracted into the working directory of each executor. Supported file types: .jar, .tar, .tar.gz, .tgz, and .zip. + +* `args` - + (Optional) + Optional. The arguments to pass to the driver. Do not include arguments, such as `--conf`, that can be set as job properties, since a collision may occur that causes an incorrect job submission. + +* `file_uris` - + (Optional) + Optional. HCFS URIs of files to be placed in the working directory of each executor. Useful for naively parallel tasks. + +* `jar_file_uris` - + (Optional) + Optional. HCFS URIs of jar files to add to the CLASSPATHs of the Python driver and tasks. + +* `logging_config` - + (Optional) + Optional. The runtime log config for job execution. + +* `main_python_file_uri` - + (Required) + Required. The HCFS URI of the main Python file to use as the driver. Must be a .py file. + +* `properties` - + (Optional) + Optional. A mapping of property names to values, used to configure PySpark. Properties that conflict with values set by the Dataproc API may be overwritten. Can include properties set in /etc/spark/conf/spark-defaults.conf and classes in user code. + +* `python_file_uris` - + (Optional) + Optional. HCFS file URIs of Python files to pass to the PySpark framework. Supported file types: .py, .egg, and .zip. + The `logging_config` block supports: + +* `driver_log_levels` - + (Optional) + The per-package log levels for the driver. This may include "root" package name to configure rootLogger. Examples: 'com.google = FATAL', 'root = INFO', 'org.apache = DEBUG' + The `scheduling` block supports: + +* `max_failures_per_hour` - + (Optional) + Optional. Maximum number of times per hour a driver may be restarted as a result of driver exiting with non-zero code before job is reported failed. A job may be reported as thrashing if driver exits with non-zero code 4 times within 10 minute window. Maximum value is 10. + +* `max_failures_total` - + (Optional) + Optional. Maximum number of times in total a driver may be restarted as a result of driver exiting with non-zero code before job is reported failed. Maximum value is 240 + The `spark_job` block supports: + +* `archive_uris` - + (Optional) + Optional. HCFS URIs of archives to be extracted into the working directory of each executor. Supported file types: .jar, .tar, .tar.gz, .tgz, and .zip. + +* `args` - + (Optional) + Optional. The arguments to pass to the driver. Do not include arguments, such as `--conf`, that can be set as job properties, since a collision may occur that causes an incorrect job submission. + +* `file_uris` - + (Optional) + Optional. HCFS URIs of files to be placed in the working directory of each executor. Useful for naively parallel tasks. + +* `jar_file_uris` - + (Optional) + Optional. HCFS URIs of jar files to add to the CLASSPATHs of the Spark driver and tasks. + +* `logging_config` - + (Optional) + Optional. The runtime log config for job execution. + +* `main_class` - + (Optional) + The name of the driver's main class. The jar file that contains the class must be in the default CLASSPATH or specified in `jar_file_uris`. + +* `main_jar_file_uri` - + (Optional) + The HCFS URI of the jar file that contains the main class. + +* `properties` - + (Optional) + Optional. A mapping of property names to values, used to configure Spark. Properties that conflict with values set by the Dataproc API may be overwritten. Can include properties set in /etc/spark/conf/spark-defaults.conf and classes in user code. + The `logging_config` block supports: + +* `driver_log_levels` - + (Optional) + The per-package log levels for the driver. This may include "root" package name to configure rootLogger. Examples: 'com.google = FATAL', 'root = INFO', 'org.apache = DEBUG' + The `spark_r_job` block supports: + +* `archive_uris` - + (Optional) + Optional. HCFS URIs of archives to be extracted into the working directory of each executor. Supported file types: .jar, .tar, .tar.gz, .tgz, and .zip. + +* `args` - + (Optional) + Optional. The arguments to pass to the driver. Do not include arguments, such as `--conf`, that can be set as job properties, since a collision may occur that causes an incorrect job submission. + +* `file_uris` - + (Optional) + Optional. HCFS URIs of files to be placed in the working directory of each executor. Useful for naively parallel tasks. + +* `logging_config` - + (Optional) + Optional. The runtime log config for job execution. + +* `main_r_file_uri` - + (Required) + Required. The HCFS URI of the main R file to use as the driver. Must be a .R file. + +* `properties` - + (Optional) + Optional. A mapping of property names to values, used to configure SparkR. Properties that conflict with values set by the Dataproc API may be overwritten. Can include properties set in /etc/spark/conf/spark-defaults.conf and classes in user code. + The `logging_config` block supports: + +* `driver_log_levels` - + (Optional) + The per-package log levels for the driver. This may include "root" package name to configure rootLogger. Examples: 'com.google = FATAL', 'root = INFO', 'org.apache = DEBUG' + The `spark_sql_job` block supports: + +* `jar_file_uris` - + (Optional) + Optional. HCFS URIs of jar files to be added to the Spark CLASSPATH. + +* `logging_config` - + (Optional) + Optional. The runtime log config for job execution. + +* `properties` - + (Optional) + Optional. A mapping of property names to values, used to configure Spark SQL's SparkConf. Properties that conflict with values set by the Dataproc API may be overwritten. + +* `query_file_uri` - + (Optional) + The HCFS URI of the script that contains SQL queries. + +* `query_list` - + (Optional) + A list of queries. + +* `script_variables` - + (Optional) + Optional. Mapping of query variable names to values (equivalent to the Spark SQL command: SET `name="value";`). + The `logging_config` block supports: + +* `driver_log_levels` - + (Optional) + The per-package log levels for the driver. This may include "root" package name to configure rootLogger. Examples: 'com.google = FATAL', 'root = INFO', 'org.apache = DEBUG' + The `query_list` block supports: + +* `queries` - + (Required) + Required. The queries to execute. You do not need to end a query expression with a semicolon. Multiple queries can be specified in one string by separating each with a semicolon. Here is an example of a Dataproc API snippet that uses a QueryList to specify a HiveJob: "hiveJob": { "queryList": { "queries": } } + The `parameters` block supports: + +* `description` - + (Optional) + Optional. Brief description of the parameter. Must not exceed 1024 characters. + +* `fields` - + (Required) + Required. Paths to all fields that the parameter replaces. A field is allowed to appear in at most one parameter's list of field paths. A field path is similar in syntax to a .sparkJob.args + +* `name` - + (Required) + Required. Parameter name. The parameter name is used as the key, and paired with the parameter value, which are passed to the template when the template is instantiated. The name must contain only capital letters (A-Z), numbers (0-9), and underscores (_), and must not start with a number. The maximum length is 40 characters. + +* `validation` - + (Optional) + Optional. Validation rules to be applied to this parameter's value. + The `validation` block supports: + +* `regex` - + (Optional) + Validation based on regular expressions. + +* `values` - + (Optional) + Validation based on a list of allowed values. + The `regex` block supports: + +* `regexes` - + (Required) + Required. RE2 regular expressions used to validate the parameter's value. The value must match the regex in its entirety (substring matches are not sufficient). + The `values` block supports: + +* `values` - + (Required) + Required. List of allowed values for the parameter. + The `cluster_selector` block supports: + +* `cluster_labels` - + (Required) + Required. The cluster labels. Cluster must have all labels to match. + +* `zone` - + (Optional) + Optional. The zone where workflow process executes. This parameter does not affect the selection of the cluster. If unspecified, the zone of the first cluster matching the selector is used. + The `managed_cluster` block supports: + +* `cluster_name` - + (Required) + Required. The cluster name prefix. A unique cluster name will be formed by appending a random suffix. The name must contain only lower-case letters (a-z), numbers (0-9), and hyphens (-). Must begin with a letter. Cannot begin or end with hyphen. Must consist of between 2 and 35 characters. + +* `config` - + (Required) + Required. The cluster configuration. + +* `labels` - + (Optional) + Optional. The labels to associate with this cluster. Label keys must be between 1 and 63 characters long, and must conform to the following PCRE regular expression: {0,63} No more than 32 labels can be associated with a given cluster. + The `secondary_worker_config` block supports: + +* `accelerators` - + (Optional) + Optional. The Compute Engine accelerator configuration for these instances. + +* `disk_config` - + (Optional) + Optional. Disk option config settings. + +* `image` - + (Optional) + Optional. The Compute Engine image resource used for cluster instances. The URI can represent an image or image family. Image examples: * `https://www.googleapis.com/compute/beta/projects/` If the URI is unspecified, it will be inferred from `SoftwareConfig.image_version` or the system default. + +* `machine_type` - + (Optional) + Optional. The Compute Engine machine type used for cluster instances. A full URL, partial URI, or short name are valid. Examples: * `https://www.googleapis.com/compute/v1/projects/(https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement) feature, you must use the short name of the machine type resource, for example, `n1-standard-2`. + +* `min_cpu_platform` - + (Optional) + Optional. Specifies the minimum cpu platform for the Instance Group. See (https://cloud.google.com/dataproc/docs/concepts/compute/dataproc-min-cpu). + +* `num_instances` - + (Optional) + Optional. The number of VM instances in the instance group. For master instance groups, must be set to 1. + +* `preemptibility` - + (Optional) + Optional. Specifies the preemptibility of the instance group. The default value for master and worker groups is `NON_PREEMPTIBLE`. This default cannot be changed. The default value for secondary instances is `PREEMPTIBLE`. Possible values: PREEMPTIBILITY_UNSPECIFIED, NON_PREEMPTIBLE, PREEMPTIBLE + +* `instance_names` - + Output only. The list of instance names. Dataproc derives the names from `cluster_name`, `num_instances`, and the instance group. + +* `is_preemptible` - + Output only. Specifies that this instance group contains preemptible instances. + +* `managed_group_config` - + Output only. The config for Compute Engine Instance Group Manager that manages this group. This is only used for preemptible instance groups. + The `accelerators` block supports: + +* `accelerator_count` - + (Optional) + The number of the accelerator cards of this type exposed to this instance. + +* `accelerator_type` - + (Optional) + Full URL, partial URI, or short name of the accelerator type resource to expose to this instance. See (https://cloud.google.com/dataproc/docs/concepts/configuring-clusters/auto-zone#using_auto_zone_placement) feature, you must use the short name of the accelerator type resource, for example, `nvidia-tesla-k80`. + The `disk_config` block supports: + +* `boot_disk_size_gb` - + (Optional) + Optional. Size in GB of the boot disk (default is 500GB). + +* `boot_disk_type` - + (Optional) + Optional. Type of the boot disk (default is "pd-standard"). Valid values: "pd-ssd" (Persistent Disk Solid State Drive) or "pd-standard" (Persistent Disk Hard Disk Drive). + +* `num_local_ssds` - + (Optional) + Optional. Number of attached SSDs, from 0 to 4 (default is 0). If SSDs are not attached, the boot disk is used to store runtime logs and (https://hadoop.apache.org/docs/r1.2.1/hdfs_user_guide.html) data. If one or more SSDs are attached, this runtime bulk data is spread across them, and the boot disk contains only basic config and installed binaries. + The `autoscaling_config` block supports: + +* `policy` - + (Optional) + Optional. The autoscaling policy used by the cluster. Only resource names including projectid and location (region) are valid. Examples: * `https://www.googleapis.com/compute/v1/projects/` Note that the policy must be in the same project and Dataproc region. + The `encryption_config` block supports: + +* `gce_pd_kms_key_name` - + (Optional) + Optional. The Cloud KMS key name to use for PD disk encryption for all instances in the cluster. + The `endpoint_config` block supports: + +* `enable_http_port_access` - + (Optional) + Optional. If true, enable http access to specific ports on the cluster from external sources. Defaults to false. + +* `http_ports` - + Output only. The map of port descriptions to URLs. Will only be populated if enable_http_port_access is true. + The `gce_cluster_config` block supports: + +* `internal_ip_only` - + (Optional) + Optional. If true, all instances in the cluster will only have internal IP addresses. By default, clusters are not restricted to internal IP addresses, and will have ephemeral external IP addresses assigned to each instance. This `internal_ip_only` restriction can only be enabled for subnetwork enabled networks, and all off-cluster dependencies must be configured to be accessible without external IP addresses. + +* `metadata` - + (Optional) + The Compute Engine metadata entries to add to all instances (see (https://cloud.google.com/compute/docs/storing-retrieving-metadata#project_and_instance_metadata)). + +* `network` - + (Optional) + Optional. The Compute Engine network to be used for machine communications. Cannot be specified with subnetwork_uri. If neither `network_uri` nor `subnetwork_uri` is specified, the "default" network of the project is used, if it exists. Cannot be a "Custom Subnet Network" (see /regions/global/default` * `default` + +* `node_group_affinity` - + (Optional) + Optional. Node Group Affinity for sole-tenant clusters. + +* `private_ipv6_google_access` - + (Optional) + Optional. The type of IPv6 access for a cluster. Possible values: PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED, INHERIT_FROM_SUBNETWORK, OUTBOUND, BIDIRECTIONAL + +* `reservation_affinity` - + (Optional) + Optional. Reservation Affinity for consuming Zonal reservation. + +* `service_account` - + (Optional) + Optional. The (https://cloud.google.com/compute/docs/access/service-accounts#default_service_account) is used. + +* `service_account_scopes` - + (Optional) + Optional. The URIs of service account scopes to be included in Compute Engine instances. The following base set of scopes is always included: * https://www.googleapis.com/auth/cloud.useraccounts.readonly * https://www.googleapis.com/auth/devstorage.read_write * https://www.googleapis.com/auth/logging.write If no scopes are specified, the following defaults are also provided: * https://www.googleapis.com/auth/bigquery * https://www.googleapis.com/auth/bigtable.admin.table * https://www.googleapis.com/auth/bigtable.data * https://www.googleapis.com/auth/devstorage.full_control + +* `subnetwork` - + (Optional) + Optional. The Compute Engine subnetwork to be used for machine communications. Cannot be specified with network_uri. A full URL, partial URI, or short name are valid. Examples: * `https://www.googleapis.com/compute/v1/projects//regions/us-east1/subnetworks/sub0` * `sub0` + +* `tags` - + (Optional) + The Compute Engine tags to add to all instances (see (https://cloud.google.com/compute/docs/label-or-tag-resources#tags)). + +* `zone` - + (Optional) + Optional. The zone where the Compute Engine cluster will be located. On a create request, it is required in the "global" region. If omitted in a non-global Dataproc region, the service will pick a zone in the corresponding Compute Engine region. On a get request, zone will always be present. A full URL, partial URI, or short name are valid. Examples: * `https://www.googleapis.com/compute/v1/projects/` * `us-central1-f` + The `node_group_affinity` block supports: + +* `node_group` - + (Required) + Required. The URI of a sole-tenant /zones/us-central1-a/nodeGroups/node-group-1` * `node-group-1` + The `reservation_affinity` block supports: + +* `consume_reservation_type` - + (Optional) + Optional. Type of reservation to consume Possible values: TYPE_UNSPECIFIED, NO_RESERVATION, ANY_RESERVATION, SPECIFIC_RESERVATION + +* `key` - + (Optional) + Optional. Corresponds to the label key of reservation resource. + +* `values` - + (Optional) + Optional. Corresponds to the label values of reservation resource. + The `gke_cluster_config` block supports: + +* `namespaced_gke_deployment_target` - + (Optional) + Optional. A target for the deployment. + The `namespaced_gke_deployment_target` block supports: + +* `cluster_namespace` - + (Optional) + Optional. A namespace within the GKE cluster to deploy into. + +* `target_gke_cluster` - + (Optional) + Optional. The target GKE cluster to deploy to. Format: 'projects/{project}/locations/{location}/clusters/{cluster_id}' + The `initialization_actions` block supports: + +* `executable_file` - + (Optional) + Required. Cloud Storage URI of executable file. + +* `execution_timeout` - + (Optional) + Optional. Amount of time executable has to complete. Default is 10 minutes (see JSON representation of (https://developers.google.com/protocol-buffers/docs/proto3#json)). Cluster creation fails with an explanatory error message (the name of the executable that caused the error and the exceeded timeout period) if the executable is not completed at end of the timeout period. + The `lifecycle_config` block supports: + +* `auto_delete_time` - + (Optional) + Optional. The time when cluster will be auto-deleted (see JSON representation of (https://developers.google.com/protocol-buffers/docs/proto3#json)). + +* `auto_delete_ttl` - + (Optional) + Optional. The lifetime duration of cluster. The cluster will be auto-deleted at the end of this period. Minimum value is 10 minutes; maximum value is 14 days (see JSON representation of (https://developers.google.com/protocol-buffers/docs/proto3#json)). + +* `idle_delete_ttl` - + (Optional) + Optional. The duration to keep the cluster alive while idling (when no jobs are running). Passing this threshold will cause the cluster to be deleted. Minimum value is 5 minutes; maximum value is 14 days (see JSON representation of (https://developers.google.com/protocol-buffers/docs/proto3#json). + +* `idle_start_time` - + Output only. The time when cluster became idle (most recent job finished) and became eligible for deletion due to idleness (see JSON representation of (https://developers.google.com/protocol-buffers/docs/proto3#json)). + The `metastore_config` block supports: + +* `dataproc_metastore_service` - + (Required) + Required. Resource name of an existing Dataproc Metastore service. Example: * `projects/` + The `security_config` block supports: + +* `kerberos_config` - + (Optional) + Kerberos related configuration. + The `kerberos_config` block supports: + +* `cross_realm_trust_admin_server` - + (Optional) + Optional. The admin server (IP or hostname) for the remote trusted realm in a cross realm trust relationship. + +* `cross_realm_trust_kdc` - + (Optional) + Optional. The KDC (IP or hostname) for the remote trusted realm in a cross realm trust relationship. + +* `cross_realm_trust_realm` - + (Optional) + Optional. The remote realm the Dataproc on-cluster KDC will trust, should the user enable cross realm trust. + +* `cross_realm_trust_shared_password` - + (Optional) + Optional. The Cloud Storage URI of a KMS encrypted file containing the shared password between the on-cluster Kerberos realm and the remote trusted realm, in a cross realm trust relationship. + +* `enable_kerberos` - + (Optional) + Optional. Flag to indicate whether to Kerberize the cluster (default: false). Set this field to true to enable Kerberos on a cluster. + +* `kdc_db_key` - + (Optional) + Optional. The Cloud Storage URI of a KMS encrypted file containing the master key of the KDC database. + +* `key_password` - + (Optional) + Optional. The Cloud Storage URI of a KMS encrypted file containing the password to the user provided key. For the self-signed certificate, this password is generated by Dataproc. + +* `keystore` - + (Optional) + Optional. The Cloud Storage URI of the keystore file used for SSL encryption. If not provided, Dataproc will provide a self-signed certificate. + +* `keystore_password` - + (Optional) + Optional. The Cloud Storage URI of a KMS encrypted file containing the password to the user provided keystore. For the self-signed certificate, this password is generated by Dataproc. + +* `kms_key` - + (Optional) + Optional. The uri of the KMS key used to encrypt various sensitive files. + +* `realm` - + (Optional) + Optional. The name of the on-cluster Kerberos realm. If not specified, the uppercased domain of hostnames will be the realm. + +* `root_principal_password` - + (Optional) + Optional. The Cloud Storage URI of a KMS encrypted file containing the root principal password. + +* `tgt_lifetime_hours` - + (Optional) + Optional. The lifetime of the ticket granting ticket, in hours. If not specified, or user specifies 0, then default value 10 will be used. + +* `truststore` - + (Optional) + Optional. The Cloud Storage URI of the truststore file used for SSL encryption. If not provided, Dataproc will provide a self-signed certificate. + +* `truststore_password` - + (Optional) + Optional. The Cloud Storage URI of a KMS encrypted file containing the password to the user provided truststore. For the self-signed certificate, this password is generated by Dataproc. + The `software_config` block supports: + +* `image_version` - + (Optional) + Optional. The version of software inside the cluster. It must be one of the supported (https://cloud.google.com/dataproc/docs/concepts/versioning/dataproc-versions#other_versions). If unspecified, it defaults to the latest Debian version. + +* `properties` - + (Optional) + Optional. The properties to set on daemon config files. Property keys are specified in `prefix:property` format, for example `core:hadoop.tmp.dir`. The following are supported prefixes and their mappings: * capacity-scheduler: `capacity-scheduler.xml` * core: `core-site.xml` * distcp: `distcp-default.xml` * hdfs: `hdfs-site.xml` * hive: `hive-site.xml` * mapred: `mapred-site.xml` * pig: `pig.properties` * spark: `spark-defaults.conf` * yarn: `yarn-site.xml` For more information, see (https://cloud.google.com/dataproc/docs/concepts/cluster-properties). + +## Attributes Reference + +In addition to the arguments listed above, the following computed attributes are exported: + +* `id` - an identifier for the resource with format `projects/{{project}}/locations/{{location}}/workflowTemplates/{{name}}` + +* `create_time` - + Output only. The time template was created. + +* `update_time` - + Output only. The time template was last updated. + +## Timeouts + +This resource provides the following +[Timeouts](/docs/configuration/resources.html#timeouts) configuration options: + +- `create` - Default is 10 minutes. +- `delete` - Default is 10 minutes. + +## Import + +WorkflowTemplate can be imported using any of these accepted formats: + +``` +$ terraform import google_dataproc_workflow_template.default projects/{{project}}/locations/{{location}}/workflowTemplates/{{name}} +$ terraform import google_dataproc_workflow_template.default {{project}}/{{location}}/{{name}} +$ terraform import google_dataproc_workflow_template.default {{location}}/{{name}} +``` + + + diff --git a/website/google.erb b/website/google.erb index 95634b3645d..22c7021e072 100644 --- a/website/google.erb +++ b/website/google.erb @@ -2176,6 +2176,10 @@ google_dataproc_job_iam +
  • + google_dataproc_workflow_template +
  • +