Skip to content

Commit

Permalink
Terraform template for Reverse replication for sharded MySQL (#1946)
Browse files Browse the repository at this point in the history
* Reverse replication Terraform template

* Add support for metadata db and changestream creation

* End to end working draft

* Make target_tags rule optional

* Update variables for gCloud null resource and test with VPC

* Address comments
  • Loading branch information
manitgupta authored Oct 25, 2024
1 parent 7e5001b commit 9eec796
Show file tree
Hide file tree
Showing 9 changed files with 1,130 additions and 0 deletions.
43 changes: 43 additions & 0 deletions v2/spanner-to-sourcedb/terraform/samples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## Terraform samples for reverse replication

This repository provides samples for common scenarios users might have while trying to run a replication from Spanner to a source database.

Pick a sample that is closest to your use-case, use it as a starting point, and tailor it to your own specific needs.

## Other Sample Repositories

The following sample repositories provide additional examples -

1. [Sample environment setups](https://github.com/GoogleCloudPlatform/DataflowTemplates/blob/main/v2/spanner-common/terraform/samples)
2. [Bulk migration](https://github.com/GoogleCloudPlatform/DataflowTemplates/blob/main/v2/sourcedb-to-spanner/terraform/samples)
3. [Live migration](https://github.com/GoogleCloudPlatform/DataflowTemplates/blob/main/v2/datastream-to-spanner/terraform/samples/)

## List of examples

1. [Spanner to sharded MySQL](spanner-to-sharded-mysql/README.md)

## Sample structure

Each sample contains the following (and potentially more) files -

1. `main.tf` - This contains the Terraform resources which will be created.
2. `outputs.tf` - This declares the outputs that will be output as part of
running the terraform example.
3. `variables.tf` - This declares the input variables that are required to
configure the resources.
4. `terraform.tf` - This contains the required providers and APIs/project
configurations for the sample.
5. `terraform.tfvars` - This contains the dummy inputs that need to be populated
to run the example.
6. `terraform_simple.tfvars` - This contains the minimal list of dummy inputs
that need to be populated to run the example.

## How to add a new sample

It is strongly recommended to copy an existing sample and modify it according to the scenario you are trying to cover.
This ensures uniformity in the style in which terraform samples are written.

```shell
mkdir my-new-sample
cp -r spanner-to-sharded-mysql/* my-new-sample/
```
Loading

0 comments on commit 9eec796

Please sign in to comment.