Skip to content

Terraform provider for managing SQL schemas using migrations.

License

Notifications You must be signed in to change notification settings

FindHotel/terraform-provider-sql

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-provider-sql

Terraform provider for managing SQL schemas using migrations.

This plugin uses rubenv/sql-migrate, it is recommended to go read how it works before using this provider.

Usage

Installation

Build the provider and put it in Terraform's third-party providers directory in ~/.terraform.d/plugins:

Terraform <0.12

go get github.com/FindHotel/terraform-provider-sql
mkdir -p ~/.terraform.d/plugins
go build -o ~/.terraform.d/plugins/terraform-provider-sql github.com/FindHotel/terraform-provider-sql

Terraform >0.13

go get github.com/FindHotel/terraform-provider-sql
mkdir -p ~/.terraform.d/plugins
go build -o ~/.terraform.d/plugins/<your-module-url-specified-in-tf-file>/<version-specified-in-tf-file>/linux_amd64/terraform-provider-sql github.com/FindHotel/terraform-provider-sql

I recommend using Go modules to ensure using the same version in development and production.

Configuration

In your Terraform configuration:

resource "sql_schema" "this" {
  driver     = "<database driver>" # mysql/postgres/cloudsql/cloudsqlpostgres
  datasource = "<database connection string>"
  directory  = "migrations" # optional
  table      = "schema_migrations" # optional
}

About

Terraform provider for managing SQL schemas using migrations.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 90.9%
  • Makefile 9.1%