Skip to content

databasemigrationservice: Add objects config field to DMS migration job resource for selective migration#17302

Merged
roaks3 merged 4 commits into
GoogleCloudPlatform:mainfrom
oleksandrsan:google-dms-migration-job-objects-config
Apr 30, 2026
Merged

databasemigrationservice: Add objects config field to DMS migration job resource for selective migration#17302
roaks3 merged 4 commits into
GoogleCloudPlatform:mainfrom
oleksandrsan:google-dms-migration-job-objects-config

Conversation

@oleksandrsan
Copy link
Copy Markdown

@oleksandrsan oleksandrsan commented Apr 27, 2026

Description

Add support for configuring which databases, schemas, or tables to migrate on google_database_migration_service_migration_job via the new objects_config block. The objects_config block maps directly to the API's MigrationJobObjectsConfig and is the same field that gcloud's --database-filter flag populates for homogeneous migrations.

Mark the whole subtree immutable since it is not in the API's update mask

Tests Added

  • Added database_migration_service_migration_job_postgres_to_postgres_objects example demonstrating selection of a database and a specific table

Verification Results

  • Verified that the provider builds successfully with these changes.

Release Note Template for Downstream PRs (will be copied)

databasemigrationservice: added `objects_config` field to `google_database_migration_service_migration_job` resource

@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Apr 27, 2026
@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 27, 2026

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.

@oleksandrsan oleksandrsan changed the title Add objects config field to DMS migration job resource Add objects config field to DMS migration job resource for selective migration Apr 27, 2026
@oleksandrsan oleksandrsan marked this pull request as ready for review April 27, 2026 12:44
@oleksandrsan oleksandrsan changed the title Add objects config field to DMS migration job resource for selective migration databasemigrationservice: Add objects config field to DMS migration job resource for selective migration Apr 27, 2026
@github-actions github-actions Bot requested a review from roaks3 April 27, 2026 12:45
@github-actions
Copy link
Copy Markdown

Googlers: For automatic test runs see go/terraform-auto-test-runs.

@roaks3, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

Copy link
Copy Markdown
Contributor

@roaks3 roaks3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One note, but otherwise LGTM. Kicking off tests now

Comment thread mmv1/products/databasemigrationservice/MigrationJob.yaml
@modular-magician modular-magician added service/datamigration and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels Apr 28, 2026
@modular-magician
Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 648 insertions(+))
google-beta provider: Diff ( 4 files changed, 648 insertions(+))
terraform-google-conversion: Diff ( 5 files changed, 477 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 209 insertions(+))

@modular-magician
Copy link
Copy Markdown
Collaborator

Tests analytics

Total tests: 15
Passed tests: 12
Skipped tests: 0
Affected tests: 3

Click here to see the affected service packages
  • databasemigrationservice

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccDatabaseMigrationServiceMigrationJob_databaseMigrationServiceMigrationJobPostgresToAlloydbExample
  • TestAccDatabaseMigrationServiceMigrationJob_databaseMigrationServiceMigrationJobPostgresToPostgresExample
  • TestAccDatabaseMigrationServiceMigrationJob_databaseMigrationServiceMigrationJobPostgresToPostgresObjectsExample

Get to know how VCR tests work

@modular-magician
Copy link
Copy Markdown
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccDatabaseMigrationServiceMigrationJob_databaseMigrationServiceMigrationJobPostgresToPostgresObjectsExample [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🔴 Tests failed during RECORDING mode:
TestAccDatabaseMigrationServiceMigrationJob_databaseMigrationServiceMigrationJobPostgresToAlloydbExample [Error message] [Debug log]
TestAccDatabaseMigrationServiceMigrationJob_databaseMigrationServiceMigrationJobPostgresToPostgresExample [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@roaks3
Copy link
Copy Markdown
Contributor

roaks3 commented Apr 28, 2026

Looks like an issue with the defaults used by the server

@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Apr 28, 2026
@github-actions github-actions Bot requested a review from roaks3 April 28, 2026 17:59
…, source_objects_config and objects_selection_type
@oleksandrsan
Copy link
Copy Markdown
Author

Looks like an issue with the defaults used by the server

I see, the API sets the objects_selection_type to ALL by default:

  objectsConfig:
    sourceObjectsConfig:
      objectsSelectionType: ALL_OBJECTS

So I added default_from_api flag for these 3 fields.

I am running the acceptance test locally on my personal account, but it fails with a different, perhaps unrelated, error:

  | Error: Error waiting to create ConnectionProfile: Error waiting for Creating ConnectionProfile: Error code 10, message: Failed to perform tenant project creation
  | 
  |   with google_database_migration_service_connection_profile.source_cp,
  |   on terraform_plugin_test.tf line 40, in resource "google_database_migration_service_connection_profile" "source_cp":
  |   40: resource "google_database_migration_service_connection_profile" "source_cp" {

@oleksandrsan
Copy link
Copy Markdown
Author

I tested the provider manually - all cases seem to be passing, adding objects_config after apply also works by re-creating the migration job.

@roaks3
Copy link
Copy Markdown
Contributor

roaks3 commented Apr 30, 2026

Ok, I'll try running in CI. The test is matching the other tests we have for the resource, so I'd expect it should be safe. Otherwise, there could be an issue with service connections and how they exhaust quota.

@modular-magician modular-magician removed the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Apr 30, 2026
@modular-magician
Copy link
Copy Markdown
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

google provider: Diff ( 4 files changed, 659 insertions(+))
google-beta provider: Diff ( 4 files changed, 659 insertions(+))
terraform-google-conversion: Diff ( 5 files changed, 488 insertions(+))
Open in Cloud Shell: Diff ( 4 files changed, 209 insertions(+))

@modular-magician
Copy link
Copy Markdown
Collaborator

Tests analytics

Total tests: 15
Passed tests: 15
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages
  • databasemigrationservice

🟢 All tests passed!

View the build log

@roaks3 roaks3 added this pull request to the merge queue Apr 30, 2026
Merged via the queue into GoogleCloudPlatform:main with commit 43948c1 Apr 30, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants