atlas
The atlas
is an optional block for configuring Atlas login credentials.
atlas {
cloud {
org = "org-name"
}
}
atlas
blocks
atlas.cloud
atlas.cloud
attributes
Name and description | Required | Value |
---|
org
The org attribute specifies the organization to log in to. If Atlas executes using atlas.hcl without logging in to the specified organization, the command will be aborted. | false | string |
token | false | string |
atlas.cloud
constraints
Constraint | Value |
---|
Required | true |
Require Name | false |
One of required sets | [org, token] |
data aws_rds_token
The aws_rds_token
data source generates a short-lived token for an AWS RDS database using IAM Authentication.
data "aws_rds_token" "db" {
region = "us-east-1"
endpoint = local.endpoint
username = local.user
}
data.aws_rds_token
attributes
data composite_schema
The composite_schema
data source allows the composition of multiple Atlas schemas into a unified schema graph.
data "composite_schema" "app" {
schema "inventory" {
url = data.external_schema.sqlalchemy.url
}
schema "graph" {
url = "ent://ent/schema"
}
...
}
data.composite_schema
blocks
data.schema
data.schema
attributes
Name | Required | Value |
---|
url | true | Composite_schema url can be one of:
- Object reference
string
|
data.schema
constraints
Constraint | Value |
---|
Required | true |
Require Name | false |
Repeatable | true |
data external
The external
allows the execution of an external program and uses its output in the project.
data "external" "dot_env" {
program = [
"npm",
"run",
"load-env.js"
]
}
data.external
attributes
data external_schema
The external_schema
data source allows the import of an SQL schema from an external program into Atlas' desired state.
data "external_schema" "graph" {
program = [
"npm",
"run",
"generate-schema"
]
}
data.external_schema
attributes
data gcp_cloudsql_token
The gcp_cloudsql_token
data source generates a short-lived token for an GCP CloudSQL database using IAM Authentication.
data "gcp_cloudsql_token" "db" {}
data.gcp_cloudsql_token
attributes
Name | Required | Value |
---|
region | false | string |
data hcl_schema
The hcl_schema
data source allows the loading of an Atlas HCL schema from a file or directory, with optional variables.
data "hcl_schema" "app" {
path = "schema.hcl"
vars = {
tenant = var.tenant
}
}
data.hcl_schema
attributes
Name | Required | Value |
---|
path | false | string |
paths | false | List of strings |
vars | false | map |
data remote_dir
The remote_dir
data source reads the state of a migration directory from Atlas Cloud.
data "remote_dir" "migrations" {
name = "myapp"
}
data.remote_dir
attributes
Name | Required | Value |
---|
name | true | string |
tag | false | string |
data remote_schema
data.remote_schema
attributes
data runtimevar
The runtimevar
data source allows fetching runtime variables from a remote source.
data.runtimevar
attributes
Name | Required | Value |
---|
url | true | string |
data sql
The sql
data source allows executing SQL queries and using their result in the project.
data "sql" "tenants" {
url = var.url
query = "..."
args = [var.pattern]
}
data.sql
attributes
Name | Required | Value |
---|
args | false | Any value |
query | true | string |
url | true | string |
data template_dir
The template_dir
data source renders a migration directory from a template directory.
data "template_dir" "app" {
path = var.path
vars = {
Key1 = "value1"
Key2 = "value2"
}
}
data.template_dir
attributes
Name | Required | Value |
---|
path | true | string |
vars | false | map |
dev clickhouse
dev.clickhouse
attributes
dev.clickhouse
blocks
dev.connection
The connection
block defines the connection configuration for the dev-database.
dev "postgres" "postgis" {
...
connection {
max_open = 1
max_idle = 1
max_lifetime = "30s"
max_idle_time = "30s"
}
}
dev.connection
attributes
dev mariadb
dev.mariadb
attributes
dev.mariadb
blocks
dev.connection
The connection
block defines the connection configuration for the dev-database.
dev "postgres" "postgis" {
...
connection {
max_open = 1
max_idle = 1
max_lifetime = "30s"
max_idle_time = "30s"
}
}
dev.connection
attributes
dev mysql
dev.mysql
attributes
dev.mysql
blocks
dev.connection
The connection
block defines the connection configuration for the dev-database.
dev "postgres" "postgis" {
...
connection {
max_open = 1
max_idle = 1
max_lifetime = "30s"
max_idle_time = "30s"
}
}
dev.connection
attributes
dev postgres
dev.postgres
attributes
dev.postgres
blocks
dev.connection
The connection
block defines the connection configuration for the dev-database.
dev "postgres" "postgis" {
...
connection {
max_open = 1
max_idle = 1
max_lifetime = "30s"
max_idle_time = "30s"
}
}
dev.connection
attributes
dev redshift
dev.redshift
attributes
dev.redshift
blocks
dev.connection
The connection
block defines the connection configuration for the dev-database.
dev "postgres" "postgis" {
...
connection {
max_open = 1
max_idle = 1
max_lifetime = "30s"
max_idle_time = "30s"
}
}
dev.connection
attributes
dev sqlserver
dev.sqlserver
attributes
dev.sqlserver
blocks
dev.connection
The connection
block defines the connection configuration for the dev-database.
dev "postgres" "postgis" {
...
connection {
max_open = 1
max_idle = 1
max_lifetime = "30s"
max_idle_time = "30s"
}
}
dev.connection
attributes
diff
The diff
block defines the diffing configuration
diff {
concurrent_index {
add = true
drop = true
}
}
diff
blocks
diff.concurrent_index
diff.concurrent_index
attributes
diff.skip
diff.skip
attributes
docker clickhouse
docker.clickhouse
attributes
Name and description | Required | Value |
---|
baseline | false | string |
env | false | List of strings |
image | true | string |
init
The init attribute specifies the initialization script for the Docker-based database created in Atlas. docker "mysql" "dev" { image = "mysql:8.4" init = <<-SQL SET GLOBAL log_bin_trust_function_creators=true; SET GLOBAL restrict_fk_on_non_standard_key=false; SET GLOBAL sql_mode := REPLACE(@@sql_mode, 'NO_ZERO_DATE', ''); SQL }
| false | string |
schema | false | string |
docker.clickhouse
blocks
docker.build
The build
block defines the build configuration for the Docker image.
The given image is built using the provided Dockerfile and context.
docker "postgres" "pg-vn" {
image = "postgres:15-vn"
build {
context = "."
dockerfile = "locale.Dockerfile"
args = {
LOCALE = "vi-VN"
}
}
}
docker.build
attributes
docker.connection
The connection
block defines the connection configuration for the Docker-based database created in Atlas.
docker "postgres" "dev" {
...
connection {
max_open = 1
max_idle = 1
max_lifetime = "30s"
max_idle_time = "30s"
}
}
docker.connection
attributes
docker mariadb
docker.mariadb
attributes
Name and description | Required | Value |
---|
baseline | false | string |
env | false | List of strings |
image | true | string |
init
The init attribute specifies the initialization script for the Docker-based database created in Atlas. docker "mysql" "dev" { image = "mysql:8.4" init = <<-SQL SET GLOBAL log_bin_trust_function_creators=true; SET GLOBAL restrict_fk_on_non_standard_key=false; SET GLOBAL sql_mode := REPLACE(@@sql_mode, 'NO_ZERO_DATE', ''); SQL }
| false | string |
schema | false | string |
docker.mariadb
blocks
docker.build
The build
block defines the build configuration for the Docker image.
The given image is built using the provided Dockerfile and context.
docker "postgres" "pg-vn" {
image = "postgres:15-vn"
build {
context = "."
dockerfile = "locale.Dockerfile"
args = {
LOCALE = "vi-VN"
}
}
}
docker.build
attributes
docker.connection
The connection
block defines the connection configuration for the Docker-based database created in Atlas.
docker "postgres" "dev" {
...
connection {
max_open = 1
max_idle = 1
max_lifetime = "30s"
max_idle_time = "30s"
}
}
docker.connection
attributes
docker mysql
docker.mysql
attributes
Name and description | Required | Value |
---|
baseline | false | string |
env | false | List of strings |
image | true | string |
init
The init attribute specifies the initialization script for the Docker-based database created in Atlas. docker "mysql" "dev" { image = "mysql:8.4" init = <<-SQL SET GLOBAL log_bin_trust_function_creators=true; SET GLOBAL restrict_fk_on_non_standard_key=false; SET GLOBAL sql_mode := REPLACE(@@sql_mode, 'NO_ZERO_DATE', ''); SQL }
| false | string |
schema | false | string |
docker.mysql
blocks
docker.build
The build
block defines the build configuration for the Docker image.
The given image is built using the provided Dockerfile and context.
docker "postgres" "pg-vn" {
image = "postgres:15-vn"
build {
context = "."
dockerfile = "locale.Dockerfile"
args = {
LOCALE = "vi-VN"
}
}
}
docker.build
attributes
docker.connection
The connection
block defines the connection configuration for the Docker-based database created in Atlas.
docker "postgres" "dev" {
...
connection {
max_open = 1
max_idle = 1
max_lifetime = "30s"
max_idle_time = "30s"
}
}
docker.connection
attributes
docker postgres
docker.postgres
attributes
Name and description | Required | Value |
---|
baseline | false | string |
database | false | string |
env | false | List of strings |
image | true | string |
init
The init attribute specifies the initialization script for the Docker-based database created in Atlas. docker "mysql" "dev" { image = "mysql:8.4" init = <<-SQL SET GLOBAL log_bin_trust_function_creators=true; SET GLOBAL restrict_fk_on_non_standard_key=false; SET GLOBAL sql_mode := REPLACE(@@sql_mode, 'NO_ZERO_DATE', ''); SQL }
| false | string |
schema | false | string |
docker.postgres
blocks
docker.build
The build
block defines the build configuration for the Docker image.
The given image is built using the provided Dockerfile and context.
docker "postgres" "pg-vn" {
image = "postgres:15-vn"
build {
context = "."
dockerfile = "locale.Dockerfile"
args = {
LOCALE = "vi-VN"
}
}
}
docker.build
attributes
docker.connection
The connection
block defines the connection configuration for the Docker-based database created in Atlas.
docker "postgres" "dev" {
...
connection {
max_open = 1
max_idle = 1
max_lifetime = "30s"
max_idle_time = "30s"
}
}
docker.connection
attributes
docker sqlserver
docker.sqlserver
attributes
Name and description | Required | Value |
---|
baseline | false | string |
collate | false | string |
database | false | string |
env | false | List of strings |
image | true | string |
init
The init attribute specifies the initialization script for the Docker-based database created in Atlas. docker "mysql" "dev" { image = "mysql:8.4" init = <<-SQL SET GLOBAL log_bin_trust_function_creators=true; SET GLOBAL restrict_fk_on_non_standard_key=false; SET GLOBAL sql_mode := REPLACE(@@sql_mode, 'NO_ZERO_DATE', ''); SQL }
| false | string |
mode | false | enum (database, schema)
|
schema | false | string |
docker.sqlserver
blocks
docker.build
The build
block defines the build configuration for the Docker image.
The given image is built using the provided Dockerfile and context.
docker "postgres" "pg-vn" {
image = "postgres:15-vn"
build {
context = "."
dockerfile = "locale.Dockerfile"
args = {
LOCALE = "vi-VN"
}
}
}
docker.build
attributes
docker.connection
The connection
block defines the connection configuration for the Docker-based database created in Atlas.
docker "postgres" "dev" {
...
connection {
max_open = 1
max_idle = 1
max_lifetime = "30s"
max_idle_time = "30s"
}
}
docker.connection
attributes
env
The env
block describes an environment block that can be selected by using the --env
flag.
env
attributes
Name | Required | Value |
---|
dev | false | string |
exclude | false | List of strings |
name | false | string |
schemas | false | List of strings |
src | false | Schema source can be one of:
- Object reference
string
- List of strings
|
url | false | string |
env
blocks
env.diff
The diff
block defines the diffing configuration
diff {
concurrent_index {
add = true
drop = true
}
}
env.diff
blocks
env.diff.concurrent_index
env.diff.concurrent_index
attributes
env.diff.skip
env.diff.skip
attributes
The format
block defines the output format of the different commands
format {
migrate {
diff = "{{ sql . \" \" }}"
}
}
env.lint
The lint
block defines the linting configuration
lint {
destructive {
error = false
}
concurrent_index {
error = true
}
}
env.lint
attributes
env.lint
blocks
env.lint.concurrent_index
env.lint.concurrent_index
attributes
env.lint.condrop
env.lint.condrop
attributes
Name | Required | Value |
---|
error | false | bool |
env.lint.data_depend
env.lint.data_depend
attributes
Name | Required | Value |
---|
error | false | bool |
env.lint.destructive
env.lint.destructive
attributes
Name | Required | Value |
---|
error | false | bool |
env.lint.git
env.lint.git
attributes
Name | Required | Value |
---|
base | false | string |
dir | false | string |
env.lint.incompatible
env.lint.incompatible
attributes
Name | Required | Value |
---|
error | false | bool |
env.lint.naming
env.lint.naming
attributes
env.lint.naming
blocks
env.lint.naming.check
env.lint.naming.check
attributes
env.lint.naming.column
env.lint.naming.column
attributes
env.lint.naming.foreign_key
env.lint.naming.foreign_key
attributes
env.lint.naming.index
env.lint.naming.index
attributes
env.lint.naming.schema
env.lint.naming.schema
attributes
env.lint.naming.table
env.lint.naming.table
attributes
env.lint.non_linear
env.lint.non_linear
attributes
Name | Required | Value |
---|
error | false | bool |
env.lint.rule.hcl
env.lint.rule.hcl
attributes
Name | Required | Value |
---|
src | true | List of strings |
vars | false | map |
env.lint
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Mutually exclusive sets | [latest, git] , [log, format] |
env.log
Use the format block instead
env.log
blocks
env.log.migrate
env.log.migrate
attributes
env.log.schema
env.log.schema
attributes
env.migration
The migration
block defines the migration configuration
migration {
dir = "file://migrations"
repo {
name = "app"
}
}
env.migration
attributes
Name | Required | Value |
---|
baseline | false | string |
dir | false | string |
exclude | false | List of strings |
exec_order | false | enum (LINEAR, linear, LINEAR_SKIP, linear-skip, NON_LINEAR, non-linear)
|
format | false | Migration format can be one of:
enum (atlas, golang-migrate, goose, flyway, liquibase, dbmate)
string
|
lock_timeout | false | string |
revisions_schema | false | string |
env.migration
blocks
env.migration.repo
The repository configuration for the migrations directory in the registry
env.migration.repo
attributes
Name | Required | Value |
---|
name | true | string |
env.schema
The configuration for the desired schema
schema {
src = "file://schema.hcl"
repo {
name = "app"
}
}
env.schema
attributes
Name | Required | Value |
---|
src | true | Schema source can be one of:
- Object reference
string
- List of strings
|
env.schema
blocks
env.schema.repo
The repository configuration for the desired schema in the registry
env.schema.repo
attributes
Name | Required | Value |
---|
name | true | string |
env.test
The test
block defines the testing configuration
test {
schema {
src = ["schema.test.hcl"]
vars = {
seed_file = "filename.sql"
variable2 = var.name
variable3 = data.external.value
}
}
}
env.test
blocks
env.test.migrate
env.test.migrate
attributes
Name | Required | Value |
---|
src | true | List of strings |
vars | false | map |
env.test.schema
env.test.schema
attributes
Name | Required | Value |
---|
src | true | List of strings |
vars | false | map |
env
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | true |
Allow unknown attributes | true |
Mutually exclusive sets | [src, schema] |
hook sql
The hook "sql" "name"
block defines an SQL hook configuration.
hook "sql" "timeout" {
transaction {
after_begin = [
"SET statement_timeout TO '50ms'",
]
}
}
hook.sql
attributes
hook.sql
blocks
hook.transaction
hook.transaction
attributes
lint
The lint
block defines the linting configuration
lint {
destructive {
error = false
}
concurrent_index {
error = true
}
}
lint
attributes
lint
blocks
lint.concurrent_index
lint.concurrent_index
attributes
lint.condrop
lint.condrop
attributes
Name | Required | Value |
---|
error | false | bool |
lint.data_depend
lint.data_depend
attributes
Name | Required | Value |
---|
error | false | bool |
lint.destructive
lint.destructive
attributes
Name | Required | Value |
---|
error | false | bool |
lint.git
lint.git
attributes
Name | Required | Value |
---|
base | false | string |
dir | false | string |
lint.incompatible
lint.incompatible
attributes
Name | Required | Value |
---|
error | false | bool |
lint.naming
lint.naming
attributes
lint.naming
blocks
lint.naming.check
lint.naming.check
attributes
lint.naming.column
lint.naming.column
attributes
lint.naming.foreign_key
lint.naming.foreign_key
attributes
lint.naming.index
lint.naming.index
attributes
lint.naming.schema
lint.naming.schema
attributes
lint.naming.table
lint.naming.table
attributes
lint.non_linear
lint.non_linear
attributes
Name | Required | Value |
---|
error | false | bool |
lint.rule.hcl
lint.rule.hcl
attributes
Name | Required | Value |
---|
src | true | List of strings |
vars | false | map |
lint
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Mutually exclusive sets | [latest, git] , [log, format] |
test
The test
block defines the testing configuration
test {
schema {
src = ["schema.test.hcl"]
vars = {
seed_file = "filename.sql"
variable2 = var.name
variable3 = data.external.value
}
}
}
test
blocks
test.migrate
test.migrate
attributes
Name | Required | Value |
---|
src | true | List of strings |
vars | false | map |
test.schema
test.schema
attributes
Name | Required | Value |
---|
src | true | List of strings |
vars | false | map |