hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.33k stars 1.73k forks source link

Add support for google_database_migration_service_migration_job #16048

Open melinath opened 1 year ago

melinath commented 1 year ago

Community Note

Description

Split off from https://github.com/hashicorp/terraform-provider-google/issues/9624 to collect feedback for this feature specifically, as separate from the connection profile resource. If you are interested in seeing support for this resource, please thumbs up and leave comments below regarding your use case / how you would expect the Terraform resource to work / anything else you think may be relevant.

From the previous ticket's author:

My use case is the next – we serve many clients with a dedicated infrastructure stack for each one, including distinguished database instances. I'd appreciate describing the database migration configuration once as Terraform module, peer-reviewing it with my colleagues and calling it for each client with respective parameters. Also, I had multiple iterations (one of which resulted in a dump profile feature DMS team released recently) to make DMS finally work for our scale and it would be so much easier to do those iterations via the code rather than manually managing the job.

I understand the DMS job is imperative by its nature, but as far as REST API endpoint exists for it, DMS team has designed to work with job resource programmatically, right? Terraform provider is just another client for it.

New or Affected Resource(s)

Potential Terraform Configuration

resource google_database_migration_service_connection_profile source {
  type = "mysql"
  ...
}

resource google_database_migration_service_connection_profile destination {
  type = "cloudsql"
  ...
}

resource google_database_migration_service_migration_job migration_job {
  source = google_dms_connection_profile.source.id
  destination = google_dms_connection_profile.destination.id
  ...
}

b/325437141

gdsotirov commented 10 months ago

I came across this issue while searching for a way to automate migration jobs. I tried creating source and destination based on the examples from google_database_migration_service_connection_profile resource's documentation, but in fact with this resource one could only create source (i.e. a connection profile that specifies source MySQL server) and destination (i.e. Cloud SQL instance to migrate into). However, without creating a migration job that dumps, imports and starts replication on the destination Cloud SQL instance you achieve nothing. To put it simply without a resource for migration job the puzzle is not complete. In my particular case I need to set a custom dump, which is one of the options of database migration, but this should be one of the arguments of migration job resource as it's a field of MigrationJob resource REST resource. Are there any plans for adding the suggested migration job resource?

kantselovich commented 9 months ago

👍 Working on migrating databases from on-prem to GCP using DMS, multiple teams at https://github.com/GannettDigital would be happy to see this feature implemented.

teadur commented 2 months ago

👍 Working on migrating databases from on-prem to GCP using DMS, multiple teams at https://github.com/GannettDigital would be happy to see this feature implemented.

indeed its only missing piece for getting everything terrraformed for db migration from x to alloydb.