From d47c763ae34b7ba20ec5b7fd8531de35a3ce16ea Mon Sep 17 00:00:00 2001 From: eric-hole Date: Thu, 14 May 2020 00:18:01 -0700 Subject: [PATCH 1/4] Add the google_dataflow_flex_template_job resource --- ...resource_dataflow_flex_template_job.go.erb | 155 ++++++++++++++++++ ...rce_dataflow_flex_template_job_test.go.erb | 84 ++++++++++ third_party/terraform/utils/provider.go.erb | 3 + .../dataflow_flex_template_job.html.markdown | 59 +++++++ 4 files changed, 301 insertions(+) create mode 100644 third_party/terraform/resources/resource_dataflow_flex_template_job.go.erb create mode 100644 third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb create mode 100644 third_party/terraform/website/docs/r/dataflow_flex_template_job.html.markdown diff --git a/third_party/terraform/resources/resource_dataflow_flex_template_job.go.erb b/third_party/terraform/resources/resource_dataflow_flex_template_job.go.erb new file mode 100644 index 000000000000..581e0c7984a4 --- /dev/null +++ b/third_party/terraform/resources/resource_dataflow_flex_template_job.go.erb @@ -0,0 +1,155 @@ +<% autogen_exception -%> +package google +<% unless version == 'ga' -%> + +import ( + "fmt" + "log" + "time" + + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + dataflow "google.golang.org/api/dataflow/v1b3" +) + +// NOTE: resource_dataflow_flex_template currently does not support updating existing jobs. +// Changing any non-computed field will result in the job being deleted (according to its +// on_delete policy) and recreated with the updated parameters. + +// resourceDataflowFlexTemplateJob defines the schema for Dataflow FlexTemplate jobs. +func resourceDataflowFlexTemplateJob() *schema.Resource { + return &schema.Resource{ + Create: resourceDataflowFlexTemplateJobCreate, + Read: resourceDataflowFlexTemplateJobRead, + Update: resourceDataflowFlexTemplateJobUpdateByReplacement, + Delete: resourceDataflowJobDelete, + Schema: map[string]*schema.Schema{ + + "container_spec_gcs_path": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + + "on_delete": { + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{"cancel", "drain"}, false), + Optional: true, + Default: "drain", + }, + + "labels": { + Type: schema.TypeMap, + Optional: true, + DiffSuppressFunc: resourceDataflowJobLabelDiffSuppress, + ForceNew: true, + }, + + "parameters": { + Type: schema.TypeMap, + Optional: true, + ForceNew: true, + }, + + "project": { + Type: schema.TypeString, + Optional: true, + Computed: true, + // ForceNew applies to both stream and batch jobs + ForceNew: true, + }, + + "job_id": { + Type: schema.TypeString, + Computed: true, + }, + + "state": { + Type: schema.TypeString, + Computed: true, + }, + }, + } +} + +// resourceDataflowFlexTemplateJobCreate creates a Flex Template Job from TF code. +func resourceDataflowFlexTemplateJobCreate(d *schema.ResourceData, meta interface{}) error { + config := meta.(*Config) + + project, err := getProject(d, config) + if err != nil { + return err + } + + region, err := getRegion(d, config) + if err != nil { + return err + } + + request := dataflow.LaunchFlexTemplateRequest{ + LaunchParameter: &dataflow.LaunchFlexTemplateParameter{ + ContainerSpecGcsPath: d.Get("container_spec_gcs_path").(string), + JobName: d.Get("name").(string), + Parameters: expandStringMap(d, "parameters"), + }, + } + response, err := config.clientDataflow.Projects.Locations.FlexTemplates.Launch(project, region, &request).Do() + if err != nil { + return err + } + job := response.Job + d.SetId(job.Id) + d.Set("job_id", job.Id) + + return resourceDataflowFlexTemplateJobRead(d, meta) +} + +// resourceDataflowFlexTemplateJobRead reads a Flex Template Job resource. +func resourceDataflowFlexTemplateJobRead(d *schema.ResourceData, meta interface{}) error { + config := meta.(*Config) + + project, err := getProject(d, config) + if err != nil { + return err + } + + region, err := getRegion(d, config) + if err != nil { + return err + } + + jobId := d.Id() + + job, err := resourceDataflowJobGetJob(config, project, region, jobId) + if err != nil { + return handleNotFoundError(err, d, fmt.Sprintf("Dataflow job %s", jobId)) + } + + d.Set("state", job.CurrentState) + d.Set("name", job.Name) + d.Set("project", project) + d.Set("labels", job.Labels) + + if _, ok := dataflowTerminalStatesMap[job.CurrentState]; ok { + log.Printf("[DEBUG] Removing resource '%s' because it is in state %s.\n", job.Name, job.CurrentState) + d.SetId("") + return nil + } + d.SetId(job.Id) + d.Set("job_id", job.Id) + + return nil +} + +// resourceDataflowFlexTemplateJobUpdateByReplacement will be the method for updating Flex-Template jobs +func resourceDataflowFlexTemplateJobUpdateByReplacement(d *schema.ResourceData, meta interface{}) error { + return nil +} + +<% end -%> diff --git a/third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb b/third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb new file mode 100644 index 000000000000..0dcca85d67e1 --- /dev/null +++ b/third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb @@ -0,0 +1,84 @@ +<% autogen_exception -%> +package google +<% unless version == 'ga' -%> + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" +) + +func TestAccDataflowFlexTemplateJob_simple(t *testing.T) { + t.Parallel() + + randStr := randString(t, 10) + bucket := "tf-test-dataflow-gcs-" + randStr + job := "tf-test-dataflow-job-" + randStr + + vcrTest(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckDataflowJobDestroyProducer(t), + Steps: []resource.TestStep{ + { + Config: testAccDataflowFlowFlexTemplateJob_basic(bucket, job), + Check: resource.ComposeTestCheckFunc( + testAccDataflowJobExists(t, "google_dataflow_job.big_data"), + ), + }, + }, + }) +} + +func testAccDataflowFlowFlexTemplateJob_basic(bucket, job string) string { + return fmt.Sprintf(` +resource "google_storage_bucket" "temp" { + name = "%s" + force_destroy = true +} + +resource "google_storage_bucket_object" "flex_template" { + name = "flex_template.json" + bucket = "%s" + content = "%s" +} + +resource "google_dataflow_flex_template_job" "big_data" { + name = "%s" + container_spec_gcs_path = "%s" + on_delete = "cancel" +} +`, bucket, bucket, flexTemplateContent(), bucket, job) +} + +func flexTemplateContent() string { + return ` +< diff --git a/third_party/terraform/utils/provider.go.erb b/third_party/terraform/utils/provider.go.erb index 94a8fc4152ad..a03d32982e0b 100644 --- a/third_party/terraform/utils/provider.go.erb +++ b/third_party/terraform/utils/provider.go.erb @@ -326,6 +326,9 @@ end # products.each do "google_container_node_pool": resourceContainerNodePool(), "google_container_registry": resourceContainerRegistry(), "google_dataflow_job": resourceDataflowJob(), + <% unless version == 'ga' -%> + "google_dataflow_flex_template_job": resourceDataflowFlexTemplateJob(), + <% end -%> "google_dataproc_cluster": resourceDataprocCluster(), "google_dataproc_cluster_iam_binding": ResourceIamBinding(IamDataprocClusterSchema, NewDataprocClusterUpdater, DataprocClusterIdParseFunc), "google_dataproc_cluster_iam_member": ResourceIamMember(IamDataprocClusterSchema, NewDataprocClusterUpdater, DataprocClusterIdParseFunc), diff --git a/third_party/terraform/website/docs/r/dataflow_flex_template_job.html.markdown b/third_party/terraform/website/docs/r/dataflow_flex_template_job.html.markdown new file mode 100644 index 000000000000..80ea95692240 --- /dev/null +++ b/third_party/terraform/website/docs/r/dataflow_flex_template_job.html.markdown @@ -0,0 +1,59 @@ +--- +subcategory: "Dataflow" +layout: "google" +page_title: "Google: google_dataflow_flex_template_job" +sidebar_current: "docs-google-dataflow-flex-template-job" +description: |- + Creates a job in Dataflow based on a Flex Template. +--- + +# google\_dataflow\_flex\_template\_job + +Creates a [Flex Template](https://cloud.google.com/dataflow/docs/guides/templates/using-flex-templates) job on Dataflow, which is an implementation of Apache Beam running on Google Compute Engine. For more information see +the official documentation for +[Beam](https://beam.apache.org) and [Dataflow](https://cloud.google.com/dataflow/). + +## Example Usage + +```hcl +resource "google_dataflow_flex_template_job" "big_data_job" { + provider = google-beta + name = "dataflow-flextemplates-job" + container_spec_gcs_path = "gs://my-bucket/templates/template.json" + parameters = { + inputSubscription = "messages" + } +} +``` + +[ To Come ...] +## Note on "destroy" / "apply" +There are many types of Dataflow jobs. Some Dataflow jobs run constantly, getting new data from (e.g.) a GCS bucket, and outputting data continuously. Some jobs process a set amount of data then terminate. All jobs can fail while running due to programming errors or other issues. In this way, Dataflow jobs are different from most other Terraform / Google resources. + +The Dataflow resource is considered 'existing' while it is in a nonterminal state. If it reaches a terminal state (e.g. 'FAILED', 'COMPLETE', 'CANCELLED'), it will be recreated on the next 'apply'. This is as expected for jobs which run continuously, but may surprise users who use this resource for other kinds of Dataflow jobs. + +A Dataflow job which is 'destroyed' may be "cancelled" or "drained". If "cancelled", the job terminates - any data written remains where it is, but no new data will be processed. If "drained", no new data will enter the pipeline, but any data currently in the pipeline will finish being processed. The default is "cancelled", but if a user sets `on_delete` to `"drain"` in the configuration, you may experience a long wait for your `terraform destroy` to complete. + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) A unique name for the resource, required by Dataflow. +* `container_spec_gcs_path` - (Required) The GCS path to the Dataflow job Flex Template. + +- - - + +* `parameters` - (Optional) Key/Value pairs to be passed to the Dataflow job (as used in the template). +* `labels` - (Optional) User labels to be specified for the job. Keys and values should follow the restrictions + specified in the [labeling restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions) page. + **NOTE**: Google-provided Dataflow templates often provide default labels that begin with `goog-dataflow-provided`. + Unless explicitly set in config, these labels will be ignored to prevent diffs on re-apply. +* `on_delete` - (Optional) One of "drain" or "cancel". Specifies behavior of deletion during `terraform destroy`. See above note. +* `project` - (Optional) The project in which the resource belongs. If it is not provided, the provider project is used. + +## Attributes Reference +In addition to the arguments listed above, the following computed attributes are exported: + +* `job_id` - The unique ID of this job. +* `type` - The type of this job, selected from the [JobType enum](https://cloud.google.com/dataflow/docs/reference/rest/v1b3/projects.jobs#Job.JobType) +* `state` - The current state of the resource, selected from the [JobState enum](https://cloud.google.com/dataflow/docs/reference/rest/v1b3/projects.jobs#Job.JobState) From 7d9a8e18f0a53213130913c2bf25130eee0bc43d Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Mon, 20 Jul 2020 13:52:18 -0700 Subject: [PATCH 2/4] Add a correct flex template, implement separate delete method. --- ...resource_dataflow_flex_template_job.go.erb | 98 +++++++++++++++++-- ...rce_dataflow_flex_template_job_test.go.erb | 74 +++++++------- .../dataflow_flex_template_job.html.markdown | 54 +++++++--- 3 files changed, 169 insertions(+), 57 deletions(-) diff --git a/third_party/terraform/resources/resource_dataflow_flex_template_job.go.erb b/third_party/terraform/resources/resource_dataflow_flex_template_job.go.erb index 581e0c7984a4..376a8c9a0448 100644 --- a/third_party/terraform/resources/resource_dataflow_flex_template_job.go.erb +++ b/third_party/terraform/resources/resource_dataflow_flex_template_job.go.erb @@ -5,8 +5,12 @@ package google import ( "fmt" "log" + "strings" "time" + "github.com/hashicorp/terraform-plugin-sdk/helper/resource" + "google.golang.org/api/googleapi" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" dataflow "google.golang.org/api/dataflow/v1b3" @@ -21,8 +25,8 @@ func resourceDataflowFlexTemplateJob() *schema.Resource { return &schema.Resource{ Create: resourceDataflowFlexTemplateJobCreate, Read: resourceDataflowFlexTemplateJobRead, - Update: resourceDataflowFlexTemplateJobUpdateByReplacement, - Delete: resourceDataflowJobDelete, + Update: resourceDataflowFlexTemplateJobUpdate, + Delete: resourceDataflowFlexTemplateJobDelete, Schema: map[string]*schema.Schema{ "container_spec_gcs_path": { @@ -41,14 +45,14 @@ func resourceDataflowFlexTemplateJob() *schema.Resource { Type: schema.TypeString, ValidateFunc: validation.StringInSlice([]string{"cancel", "drain"}, false), Optional: true, - Default: "drain", + Default: "cancel", }, "labels": { Type: schema.TypeMap, Optional: true, DiffSuppressFunc: resourceDataflowJobLabelDiffSuppress, - ForceNew: true, + ForceNew: true, }, "parameters": { @@ -99,10 +103,12 @@ func resourceDataflowFlexTemplateJobCreate(d *schema.ResourceData, meta interfac Parameters: expandStringMap(d, "parameters"), }, } + response, err := config.clientDataflow.Projects.Locations.FlexTemplates.Launch(project, region, &request).Do() if err != nil { return err } + job := response.Job d.SetId(job.Id) d.Set("job_id", job.Id) @@ -141,15 +147,91 @@ func resourceDataflowFlexTemplateJobRead(d *schema.ResourceData, meta interface{ d.SetId("") return nil } - d.SetId(job.Id) - d.Set("job_id", job.Id) return nil } -// resourceDataflowFlexTemplateJobUpdateByReplacement will be the method for updating Flex-Template jobs -func resourceDataflowFlexTemplateJobUpdateByReplacement(d *schema.ResourceData, meta interface{}) error { +// resourceDataflowFlexTemplateJobUpdate is a blank method to enable updating +// the on_delete virtual field +func resourceDataflowFlexTemplateJobUpdate(d *schema.ResourceData, meta interface{}) error { return nil } +func resourceDataflowFlexTemplateJobDelete(d *schema.ResourceData, meta interface{}) error { + config := meta.(*Config) + + project, err := getProject(d, config) + if err != nil { + return err + } + + region, err := getRegion(d, config) + if err != nil { + return err + } + + id := d.Id() + + requestedState, err := resourceDataflowJobMapRequestedState(d.Get("on_delete").(string)) + if err != nil { + return err + } + + // Retry updating the state while the job is not ready to be canceled/drained. + err = resource.Retry(time.Minute*time.Duration(15), func() *resource.RetryError { + // To terminate a dataflow job, we update the job with a requested + // terminal state. + job := &dataflow.Job{ + RequestedState: requestedState, + } + + _, updateErr := resourceDataflowJobUpdateJob(config, project, region, id, job) + if updateErr != nil { + gerr, isGoogleErr := updateErr.(*googleapi.Error) + if !isGoogleErr { + // If we have an error and it's not a google-specific error, we should go ahead and return. + return resource.NonRetryableError(updateErr) + } + + if strings.Contains(gerr.Message, "not yet ready for canceling") { + // Retry cancelling job if it's not ready. + // Sleep to avoid hitting update quota with repeated attempts. + time.Sleep(5 * time.Second) + return resource.RetryableError(updateErr) + } + + if strings.Contains(gerr.Message, "Job has terminated") { + // Job has already been terminated, skip. + return nil + } + } + + return nil + }) + if err != nil { + return err + } + + // Wait for state to reach terminal state (canceled/drained/done) + _, ok := dataflowTerminalStatesMap[d.Get("state").(string)] + for !ok { + log.Printf("[DEBUG] Waiting for job with job state %q to terminate...", d.Get("state").(string)) + time.Sleep(5 * time.Second) + + err = resourceDataflowFlexTemplateJobRead(d, meta) + if err != nil { + return fmt.Errorf("Error while reading job to see if it was properly terminated: %v", err) + } + _, ok = dataflowTerminalStatesMap[d.Get("state").(string)] + } + + // Only remove the job from state if it's actually successfully canceled. + if _, ok := dataflowTerminalStatesMap[d.Get("state").(string)]; ok { + log.Printf("[DEBUG] Removing dataflow job with final state %q", d.Get("state").(string)) + d.SetId("") + return nil + } + return fmt.Errorf("Unable to cancel the dataflow job '%s' - final state was %q.", d.Id(), d.Get("state").(string)) +} + <% end -%> diff --git a/third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb b/third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb index 0dcca85d67e1..5efef050547a 100644 --- a/third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb +++ b/third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb @@ -24,13 +24,14 @@ func TestAccDataflowFlexTemplateJob_simple(t *testing.T) { { Config: testAccDataflowFlowFlexTemplateJob_basic(bucket, job), Check: resource.ComposeTestCheckFunc( - testAccDataflowJobExists(t, "google_dataflow_job.big_data"), + testAccDataflowJobExists(t, "google_dataflow_flex_template_job.big_data"), ), }, }, }) } +// note: this config creates a job that doesn't actually do anything func testAccDataflowFlowFlexTemplateJob_basic(bucket, job string) string { return fmt.Sprintf(` resource "google_storage_bucket" "temp" { @@ -40,45 +41,50 @@ resource "google_storage_bucket" "temp" { resource "google_storage_bucket_object" "flex_template" { name = "flex_template.json" - bucket = "%s" - content = "%s" + bucket = google_storage_bucket.temp.name + content = < diff --git a/third_party/terraform/website/docs/r/dataflow_flex_template_job.html.markdown b/third_party/terraform/website/docs/r/dataflow_flex_template_job.html.markdown index 80ea95692240..8261752f0481 100644 --- a/third_party/terraform/website/docs/r/dataflow_flex_template_job.html.markdown +++ b/third_party/terraform/website/docs/r/dataflow_flex_template_job.html.markdown @@ -9,9 +9,10 @@ description: |- # google\_dataflow\_flex\_template\_job -Creates a [Flex Template](https://cloud.google.com/dataflow/docs/guides/templates/using-flex-templates) job on Dataflow, which is an implementation of Apache Beam running on Google Compute Engine. For more information see -the official documentation for -[Beam](https://beam.apache.org) and [Dataflow](https://cloud.google.com/dataflow/). +Creates a [Flex Template](https://cloud.google.com/dataflow/docs/guides/templates/using-flex-templates) +job on Dataflow, which is an implementation of Apache Beam running on Google +Compute Engine. For more information see the official documentation for [Beam](https://beam.apache.org) +and [Dataflow](https://cloud.google.com/dataflow/). ## Example Usage @@ -28,32 +29,55 @@ resource "google_dataflow_flex_template_job" "big_data_job" { [ To Come ...] ## Note on "destroy" / "apply" -There are many types of Dataflow jobs. Some Dataflow jobs run constantly, getting new data from (e.g.) a GCS bucket, and outputting data continuously. Some jobs process a set amount of data then terminate. All jobs can fail while running due to programming errors or other issues. In this way, Dataflow jobs are different from most other Terraform / Google resources. +There are many types of Dataflow jobs. Some Dataflow jobs run constantly, +getting new data from (e.g.) a GCS bucket, and outputting data continuously. +Some jobs process a set amount of data then terminate. All jobs can fail while +running due to programming errors or other issues. In this way, Dataflow jobs +are different from most other Terraform / Google resources. -The Dataflow resource is considered 'existing' while it is in a nonterminal state. If it reaches a terminal state (e.g. 'FAILED', 'COMPLETE', 'CANCELLED'), it will be recreated on the next 'apply'. This is as expected for jobs which run continuously, but may surprise users who use this resource for other kinds of Dataflow jobs. +The Dataflow resource is considered 'existing' while it is in a nonterminal +state. If it reaches a terminal state (e.g. 'FAILED', 'COMPLETE', +'CANCELLED'), it will be recreated on the next 'apply'. This is as expected for +jobs which run continuously, but may surprise users who use this resource for +other kinds of Dataflow jobs. -A Dataflow job which is 'destroyed' may be "cancelled" or "drained". If "cancelled", the job terminates - any data written remains where it is, but no new data will be processed. If "drained", no new data will enter the pipeline, but any data currently in the pipeline will finish being processed. The default is "cancelled", but if a user sets `on_delete` to `"drain"` in the configuration, you may experience a long wait for your `terraform destroy` to complete. +A Dataflow job which is 'destroyed' may be "cancelled" or "drained". If +"cancelled", the job terminates - any data written remains where it is, but no +new data will be processed. If "drained", no new data will enter the pipeline, +but any data currently in the pipeline will finish being processed. The default +is "cancelled", but if a user sets `on_delete` to `"drain"` in the +configuration, you may experience a long wait for your `terraform destroy` to +complete. ## Argument Reference The following arguments are supported: * `name` - (Required) A unique name for the resource, required by Dataflow. -* `container_spec_gcs_path` - (Required) The GCS path to the Dataflow job Flex Template. + +* `container_spec_gcs_path` - (Required) The GCS path to the Dataflow job Flex +Template. - - - -* `parameters` - (Optional) Key/Value pairs to be passed to the Dataflow job (as used in the template). -* `labels` - (Optional) User labels to be specified for the job. Keys and values should follow the restrictions - specified in the [labeling restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions) page. - **NOTE**: Google-provided Dataflow templates often provide default labels that begin with `goog-dataflow-provided`. - Unless explicitly set in config, these labels will be ignored to prevent diffs on re-apply. -* `on_delete` - (Optional) One of "drain" or "cancel". Specifies behavior of deletion during `terraform destroy`. See above note. -* `project` - (Optional) The project in which the resource belongs. If it is not provided, the provider project is used. +* `parameters` - (Optional) Key/Value pairs to be passed to the Dataflow job (as +used in the template). + +* `labels` - (Optional) User labels to be specified for the job. Keys and values +should follow the restrictions specified in the [labeling restrictions](https://cloud.google.com/compute/docs/labeling-resources#restrictions) +page. **NOTE**: Google-provided Dataflow templates often provide default labels +that begin with `goog-dataflow-provided`. Unless explicitly set in config, these +labels will be ignored to prevent diffs on re-apply. + +* `on_delete` - (Optional) One of "drain" or "cancel". Specifies behavior of +deletion during `terraform destroy`. See above note. + +* `project` - (Optional) The project in which the resource belongs. If it is not +provided, the provider project is used. ## Attributes Reference In addition to the arguments listed above, the following computed attributes are exported: * `job_id` - The unique ID of this job. -* `type` - The type of this job, selected from the [JobType enum](https://cloud.google.com/dataflow/docs/reference/rest/v1b3/projects.jobs#Job.JobType) + * `state` - The current state of the resource, selected from the [JobState enum](https://cloud.google.com/dataflow/docs/reference/rest/v1b3/projects.jobs#Job.JobState) From 4e9cdc2207ce0e58e095261d84854117fcacb7d4 Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Fri, 24 Jul 2020 11:07:36 -0700 Subject: [PATCH 3/4] Remove stray line of markdown --- .../website/docs/r/dataflow_flex_template_job.html.markdown | 1 - 1 file changed, 1 deletion(-) diff --git a/third_party/terraform/website/docs/r/dataflow_flex_template_job.html.markdown b/third_party/terraform/website/docs/r/dataflow_flex_template_job.html.markdown index 8261752f0481..307871d081c8 100644 --- a/third_party/terraform/website/docs/r/dataflow_flex_template_job.html.markdown +++ b/third_party/terraform/website/docs/r/dataflow_flex_template_job.html.markdown @@ -27,7 +27,6 @@ resource "google_dataflow_flex_template_job" "big_data_job" { } ``` -[ To Come ...] ## Note on "destroy" / "apply" There are many types of Dataflow jobs. Some Dataflow jobs run constantly, getting new data from (e.g.) a GCS bucket, and outputting data continuously. From c002c99bc0eba36ed0ad3ef638d902daa38bf009 Mon Sep 17 00:00:00 2001 From: Riley Karson Date: Fri, 24 Jul 2020 11:08:07 -0700 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Cameron Thornton --- .../resources/resource_dataflow_flex_template_job.go.erb | 1 - .../tests/resource_dataflow_flex_template_job_test.go.erb | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/third_party/terraform/resources/resource_dataflow_flex_template_job.go.erb b/third_party/terraform/resources/resource_dataflow_flex_template_job.go.erb index 376a8c9a0448..d84913427a83 100644 --- a/third_party/terraform/resources/resource_dataflow_flex_template_job.go.erb +++ b/third_party/terraform/resources/resource_dataflow_flex_template_job.go.erb @@ -65,7 +65,6 @@ func resourceDataflowFlexTemplateJob() *schema.Resource { Type: schema.TypeString, Optional: true, Computed: true, - // ForceNew applies to both stream and batch jobs ForceNew: true, }, diff --git a/third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb b/third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb index 5efef050547a..a52ae29479e0 100644 --- a/third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb +++ b/third_party/terraform/tests/resource_dataflow_flex_template_job_test.go.erb @@ -9,7 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/helper/resource" ) -func TestAccDataflowFlexTemplateJob_simple(t *testing.T) { +func TestAccDataflowFlexTemplateJob_basic(t *testing.T) { t.Parallel() randStr := randString(t, 10)