magic-modules icon indicating copy to clipboard operation
magic-modules copied to clipboard

Add ability to import Dataflow jobs

Open bschaatsbergen opened this issue 1 year ago • 14 comments

If this PR is for Terraform, I acknowledge that I have:

  • [x] Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • [x] Generated Terraform, and ran make test and make lint to ensure it passes unit and linter tests.
  • [x] Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • [x] Ran relevant acceptance tests (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • [x] Read the Release Notes Guide before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

Add ability to import Dataflow jobs


bruno@pop-os ~/D/t/12088 [1]> terraform import google_dataflow_job.default 2022-07-31_06_25_42-11926927532632678660                                                                                                           (base) 
google_dataflow_job.default: Importing from ID "2022-07-31_06_25_42-11926927532632678660"...
google_dataflow_job.default: Import prepared!
  Prepared google_dataflow_job for import
google_dataflow_job.default: Refreshing state... [id=2022-07-31_06_25_42-11926927532632678660]

Import successful!

The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.

bschaatsbergen avatar Aug 06 '22 07:08 bschaatsbergen

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Aug 06 '22 07:08 google-cla[bot]

Hello! I am a robot who works on Magic Modules PRs.

I've detected that you're a community contributor. @megan07, a repository maintainer, has been assigned to assist you and help review your changes.

:question: First time contributing? Click here for more details

Your assigned reviewer will help review your code by:

  • Ensuring it's backwards compatible, covers common error cases, etc.
  • Summarizing the change into a user-facing changelog note.
  • Passes tests, either our "VCR" suite, a set of presubmit tests, or with manual test runs.

You can help make sure that review is quick by running local tests and ensuring they're passing in between each push you make to your PR's branch. Also, try to leave a comment with each push you make, as pushes generally don't generate emails.

If your reviewer doesn't get back to you within a week after your most recent change, please feel free to leave a comment on the issue asking them to take a look! In the absence of a dedicated review dashboard most maintainers manage their pending reviews through email, and those will sometimes get lost in their inbox.


modular-magician avatar Aug 06 '22 07:08 modular-magician

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 2 files changed, 8 insertions(+), 1 deletion(-)) Terraform Beta: Diff ( 2 files changed, 8 insertions(+), 1 deletion(-)) TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

modular-magician avatar Aug 06 '22 07:08 modular-magician

Tests analytics

Total tests: 2125 Passed tests 1889 Skipped tests: 227 Failed tests: 9

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample|TestAccFirebaserulesRelease_BasicRelease|TestAccComputeInstance_soleTenantNodeAffinities|TestAccComputeInstance_networkPerformanceConfig|TestAccComputeGlobalForwardingRule_internalLoadBalancing|TestAccCloudRunService_cloudRunServiceStaticOutboundExample|TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample|TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample|TestAccCloudFunctions2Function_fullUpdate

modular-magician avatar Aug 06 '22 08:08 modular-magician

Tests passed during RECORDING mode: TestAccFirebaserulesRelease_BasicRelease[view] TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample[view] TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample[view] TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample[view] TestAccCloudFunctions2Function_fullUpdate[view]

Tests failed during RECORDING mode: TestAccComputeInstance_networkPerformanceConfig[view] TestAccComputeGlobalForwardingRule_internalLoadBalancing[view] TestAccCloudRunService_cloudRunServiceStaticOutboundExample[view] TestAccComputeInstance_soleTenantNodeAffinities[view]

Please fix these to complete your PR View the build log or the debug log for each test

modular-magician avatar Aug 06 '22 08:08 modular-magician

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 3 files changed, 92 insertions(+), 1 deletion(-)) Terraform Beta: Diff ( 3 files changed, 92 insertions(+), 1 deletion(-)) TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

modular-magician avatar Aug 08 '22 21:08 modular-magician

Tests analytics

Total tests: 0 Passed tests 0 Skipped tests: 0 Failed tests: 0

Errors occurred during REPLAYING mode. Please fix them to complete your PR View the build log

modular-magician avatar Aug 08 '22 21:08 modular-magician

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 3 files changed, 80 insertions(+), 1 deletion(-)) Terraform Beta: Diff ( 3 files changed, 80 insertions(+), 1 deletion(-)) TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

modular-magician avatar Aug 10 '22 09:08 modular-magician

Tests analytics

Total tests: 0 Passed tests 0 Skipped tests: 0 Failed tests: 0

Errors occurred during REPLAYING mode. Please fix them to complete your PR View the build log

modular-magician avatar Aug 10 '22 09:08 modular-magician

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 3 files changed, 68 insertions(+), 1 deletion(-)) Terraform Beta: Diff ( 3 files changed, 68 insertions(+), 1 deletion(-)) TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

modular-magician avatar Aug 10 '22 10:08 modular-magician

Tests analytics

Total tests: 2128 Passed tests 1891 Skipped tests: 227 Failed tests: 10

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests TestAccComputeInstance_networkPerformanceConfig|TestAccComputeInstance_soleTenantNodeAffinities|TestAccComputeGlobalForwardingRule_internalLoadBalancing|TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample|TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample|TestAccCloudFunctions2Function_fullUpdate|TestAccCloudRunService_cloudRunServiceStaticOutboundExample|TestAccCGCSnippet_eventarcWorkflowsExample|TestAccSqlUser_mysqlDisabled|TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample

modular-magician avatar Aug 10 '22 11:08 modular-magician

Tests passed during RECORDING mode: TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample[view] TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample[view] TestAccCloudFunctions2Function_fullUpdate[view] TestAccCGCSnippet_eventarcWorkflowsExample[view] TestAccSqlUser_mysqlDisabled[view] TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample[view]

Tests failed during RECORDING mode: TestAccComputeInstance_networkPerformanceConfig[view] TestAccComputeInstance_soleTenantNodeAffinities[view] TestAccComputeGlobalForwardingRule_internalLoadBalancing[view] TestAccCloudRunService_cloudRunServiceStaticOutboundExample[view]

Please fix these to complete your PR View the build log or the debug log for each test

modular-magician avatar Aug 10 '22 11:08 modular-magician

Fixed @megan07 :) !

bschaatsbergen avatar Aug 10 '22 11:08 bschaatsbergen

Hi @bschaatsbergen! First, I'm so sorry, I had responded yesterday but forgot to hit submit, so I'm glad you were able to fix those issues!

I ran all of these tests and they all failed at the import step for the fact that the GET call doesn't return all of the fields that can be set in the config, so we'll need to add these fields to ImportStateVerifyIgnore in the test step.

provider_test.go:309: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected.
(map[string]string) {
}
(map[string]string) (len=5) {
(string) (len=9) "on_delete": (string) (len=5) "drain",
(string) (len=12) "parameters.%": (string) (len=1) "2",
(string) (len=20) "parameters.inputFile": (string) (len=45) "gs://dataflow-samples/shakespeare/various.txt",
(string) (len=17) "parameters.output": (string) (len=43) "gs://tf-test-dataflow-gcs-8l2gmcwj0s/output",
(string) (len=28) "skip_wait_on_job_termination": (string) (len=5) "false"
}

This is one of the test failures, and these fields failed on all tests, so all tests should at least have ImportStateVerifyIgnore: []string{"on_delete", "parameters", "skip_wait_on_job_termination"} while others will have additional fields to ignore as well. To find the fields to ignore you can compare the test configuration to the list of fields that are Set here. Anything that is configured, but not Set should be in the ignore, as that won't be imported, so we cannot compare it to the configuration. Does that make sense?

megan07 avatar Aug 10 '22 17:08 megan07

Heya @megan07, could you please rerun the tests 😃 . If I've missed any properties that are to be set in the ImportStateVerifyIgnore could you commit that in my branch or report it back to me and I'll take care of it.

bschaatsbergen avatar Aug 16 '22 08:08 bschaatsbergen

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 3 files changed, 103 insertions(+), 24 deletions(-)) Terraform Beta: Diff ( 3 files changed, 103 insertions(+), 24 deletions(-)) TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

modular-magician avatar Aug 16 '22 09:08 modular-magician

Tests analytics

Total tests: 0 Passed tests 0 Skipped tests: 0 Failed tests: 0

Errors occurred during REPLAYING mode. Please fix them to complete your PR View the build log

modular-magician avatar Aug 16 '22 09:08 modular-magician

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 3 files changed, 80 insertions(+), 1 deletion(-)) Terraform Beta: Diff ( 3 files changed, 80 insertions(+), 1 deletion(-)) TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

modular-magician avatar Aug 16 '22 12:08 modular-magician

Tests analytics

Total tests: 2130 Passed tests 1894 Skipped tests: 227 Failed tests: 9

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample|TestAccComputeInstance_networkPerformanceConfig|TestAccComputeInstance_soleTenantNodeAffinities|TestAccComputeGlobalForwardingRule_internalLoadBalancing|TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample|TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample|TestAccCGCSnippet_eventarcWorkflowsExample|TestAccCloudFunctions2Function_fullUpdate|TestAccCloudRunService_cloudRunServiceStaticOutboundExample

modular-magician avatar Aug 16 '22 12:08 modular-magician

Tests passed during RECORDING mode: TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample[view] TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample[view] TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample[view] TestAccCloudFunctions2Function_fullUpdate[view]

Tests failed during RECORDING mode: TestAccComputeInstance_networkPerformanceConfig[view] TestAccComputeInstance_soleTenantNodeAffinities[view] TestAccComputeGlobalForwardingRule_internalLoadBalancing[view] TestAccCGCSnippet_eventarcWorkflowsExample[view] TestAccCloudRunService_cloudRunServiceStaticOutboundExample[view]

Please fix these to complete your PR View the build log or the debug log for each test

modular-magician avatar Aug 16 '22 12:08 modular-magician

Looking better! It looks like we probably want to ignore state in all of these too. Sorry about that! But then I think we should be ready to go! Thanks for your patience!

provider_test.go:309: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected. (map[string]string) (len=1) { (string) (len=5) "state": (string) (len=17) "JOB_STATE_RUNNING" } (map[string]string) (len=1) { (string) (len=5) "state": (string) (len=17) "JOB_STATE_PENDING" }

megan07 avatar Aug 16 '22 13:08 megan07

Done @megan07 :) !

bschaatsbergen avatar Aug 16 '22 13:08 bschaatsbergen

Hi! I'm the modular magician. Your PR generated some diffs in downstreams - here they are.

Diff report:

Terraform GA: Diff ( 3 files changed, 80 insertions(+), 1 deletion(-)) Terraform Beta: Diff ( 3 files changed, 80 insertions(+), 1 deletion(-)) TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

modular-magician avatar Aug 16 '22 13:08 modular-magician

Tests analytics

Total tests: 2130 Passed tests 1893 Skipped tests: 227 Failed tests: 10

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample|TestAccFirebaserulesRelease_BasicRelease|TestAccComputeInstance_networkPerformanceConfig|TestAccComputeInstance_soleTenantNodeAffinities|TestAccComputeGlobalForwardingRule_internalLoadBalancing|TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample|TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample|TestAccCGCSnippet_eventarcWorkflowsExample|TestAccCloudFunctions2Function_fullUpdate|TestAccCloudRunService_cloudRunServiceStaticOutboundExample

modular-magician avatar Aug 16 '22 14:08 modular-magician

Neat, thanks @megan07 - next time I'll ensure I can run the tests locally as I seem to have no access to view the build logs coming from the actions.

bschaatsbergen avatar Aug 16 '22 14:08 bschaatsbergen

Tests passed during RECORDING mode: TestAccPrivatecaCertificateAuthority_privatecaCertificateAuthoritySubordinateExample[view] TestAccFirebaserulesRelease_BasicRelease[view] TestAccCloudfunctions2function_cloudfunctions2BasicAuditlogsExample[view] TestAccCloudfunctions2function_cloudfunctions2BasicGcsExample[view] TestAccCGCSnippet_eventarcWorkflowsExample[view] TestAccCloudFunctions2Function_fullUpdate[view]

Tests failed during RECORDING mode: TestAccComputeInstance_networkPerformanceConfig[view] TestAccComputeInstance_soleTenantNodeAffinities[view] TestAccComputeGlobalForwardingRule_internalLoadBalancing[view] TestAccCloudRunService_cloudRunServiceStaticOutboundExample[view]

Please fix these to complete your PR View the build log or the debug log for each test

modular-magician avatar Aug 16 '22 14:08 modular-magician