Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ariga/terraform-provider-atlas
Terraform Provider for Atlas
https://github.com/ariga/terraform-provider-atlas
Last synced: about 12 hours ago
JSON representation
Terraform Provider for Atlas
- Host: GitHub
- URL: https://github.com/ariga/terraform-provider-atlas
- Owner: ariga
- License: apache-2.0
- Created: 2022-04-25T08:59:16.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-09T07:22:40.000Z (5 months ago)
- Last Synced: 2024-06-11T19:13:00.111Z (5 months ago)
- Language: Go
- Homepage: https://atlasgo.io
- Size: 310 KB
- Stars: 55
- Watchers: 10
- Forks: 7
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-tf - terraform-provider-atlas - Provider for [Atlas](https://atlasgo.io/). (Providers / Vendor supported providers)
README
# Atlas Terraform Provider
[![Twitter](https://img.shields.io/twitter/url.svg?label=Follow%20%40ariga%2Fatlas&style=social&url=https%3A%2F%2Ftwitter.com%2Fatlasgo_io)](https://twitter.com/atlasgo_io)
[![Discord](https://img.shields.io/discord/930720389120794674?label=discord&logo=discord&style=flat-square&logoColor=white)](https://discord.com/invite/zZ6sWVg6NT)Atlas is a language-agnostic tool for managing and migrating database schemas using modern DevOps principles.
It offers two workflows:- **Declarative**: Similar to Terraform, Atlas compares the current state of the database to the desired state, as
defined in an [HCL], [SQL], or [ORM] schema. Based on this comparison, it generates and executes a migration plan to
transition the database to its desired state.- **Versioned**: Unlike other tools, Atlas automatically plans schema migrations for you. Users can describe their desired
database schema in [HCL], [SQL], or their chosen [ORM], and by utilizing Atlas, they can plan, lint, and apply the
necessary migrations to the database.## Installation
```terraform
terraform {
required_providers {
atlas = {
source = "ariga/atlas"
version = "~> 0.6.1"
}
}
}
provider "atlas" {
# Use MySQL 8 docker image as the dev database.
dev_url = "docker://mysql/8"
}
```## Quick Start
1\. To create a schema for your database, [first install `atlas`](https://atlasgo.io/getting-started#installation)
2\. Then, inspect the schema of the database:
```shell
atlas schema inspect -u "mysql://root:pass@localhost:3306/example" > schema.hcl
```3\. Finally, configure the terraform resource to apply the state to your database:
```terraform
data "atlas_schema" "my_schema" {
src = "file://${abspath("./schema.hcl")}"
dev_url = "mysql://root:pass@localhost:3307/example"
}resource "atlas_schema" "example_db" {
hcl = data.atlas_schema.my_schema.hcl
url = "mysql://root:pass@localhost:3306/example"
dev_url = "mysql://root:pass@localhost:3307/example"
}
```For more advanced examples, check out the examples folder.
### Docs
* [Provider Docs](https://registry.terraform.io/providers/ariga/atlas/latest/docs)
* [Atlas Docs](https://atlasgo.io)### Supported databases:
MySQL, MariaDB, PostgresSQL, SQLite, TiDB, CockroachDB, SQL Server, ClickHouse, Redshift.
[HCL]: https://atlasgo.io/atlas-schema/hcl
[SQL]: https://atlasgo.io/atlas-schema/sql
[ORM]: https://atlasgo.io/atlas-schema/external