adding new spanner-migrations runner module under community folder.#5597
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new Terraform module designed to streamline the process of applying DDL migrations to Google Cloud Spanner databases. By leveraging Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new community module, spanner-migrations-runner, which applies Spanner DDL migrations using the gcloud CLI. The review feedback identifies a bug in the fileset logic that would cause failures when no sub-directory is provided and highlights a violation of the repository style guide regarding the registration of new modules in the global index. Additionally, it is recommended to use a minimum version constraint for Terraform rather than pinning to a specific patch version to ensure better compatibility for a reusable module.
kvenkatachala333
left a comment
There was a problem hiding this comment.
LGTM. Just a minor nit: please handle the gemini suggestion of ensuring new module is added to the index in the root modules/README.md file as required by the repository style guide
…oogleCloudPlatform#5597) adding new module spanner-migrations runner under community folder.
…oogleCloudPlatform#5597) adding new module spanner-migrations runner under community folder.
Adding a module for executing sequential Spanner schema migrations using the gcloud CLI.
This module provides a declarative mechanism for managing Spanner database schema evolution through versioned SQL migration files. It is specifically designed to handle advanced Spanner features, such as Protobuf-based columns, which are not currently supported by the native Google Cloud Terraform provider.
The module automates the application of schema changes by iterating through a specified directory and applying all .up.sql files in alphabetical order. To ensure stability during infrastructure updates, it utilizes a content-based hash trigger to avoid redundant execution of migrations that have already been applied.
Key Changes:
Sequential Execution: Implements a shell-based loop via local-exec to ensure migrations are applied in strict alphabetical/versioned order.
Protobuf Support: Includes an optional path for a compiled proto descriptors file (.pb), enabling the application of DDLs that reference custom Protobuf types.
Efficient Idempotency: Uses a SHA256 hash of all migration files as a Terraform trigger. The module only executes when new migration files are added or existing ones are modified.
Encapsulated Scripts: Hides the complexity of gcloud spanner databases ddl update commands behind a standard Cluster Toolkit module interface.
Submission Checklist
NOTE: Community submissions can take up to 2 weeks to be reviewed.
Please take the following actions before submitting this pull request.