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
| Name and description | Required | Value |
|---|
endpoint | true | string |
profile
The AWS profile name to use from the shared credentials file. If not set, the default profile will be used. | false | string |
region | false | string |
role_arn
ARN of the role to assume for generating the token. | false | string |
username | true | string |
data blob_dir
The blob_dir data source reads the state of a migration directory from the blob storage. Currently, it supports S3 (s3://).
data "blob_dir" "migrations" {
url = "s3://my-bucket/migrations?region=us-east-1&profile=aws-atlas"
}
data.blob_dir attributes
| Name | Required | Value |
|---|
url | true | string |
data.blob_dir exposed references
data cloud_databases
The cloud_databases reads the status of migration targets from Atlas Cloud.
data "cloud_databases" "dev" {
repo = "my-app"
env = "dev"
}
data.cloud_databases attributes
| Name and description | Required | Value |
|---|
env | false | string |
repo
The repo attribute specifies the migrate-directory name to filter the databases by. | true | string |
data.cloud_databases exposed references
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 exposed references
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.external_schema exposed references
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.hcl_schema exposed references
data http
The http data source makes an HTTP GET/HEAD/POST request to the given URL and exports information about the response. The given URL may be either an http or https URL.
data.http attributes
| Name and description | Required | Value |
|---|
ca_cert_pem
Certificate Authority (CA) in PEM (RFC 1421) format. | false | string |
client_cert_pem
Client certificate in PEM (RFC 1421) format. | false | string |
client_key_pem
Client key in PEM (RFC 1421) format. | false | string |
insecure
Disables verification of the server's certificate chain and hostname. Defaults to false. | false | bool |
method
The HTTP Method for the request. Allowed methods are a subset of methods defined in RFC7231 namely, GET, HEAD, and POST. POST support is only intended for read-only URLs, such as submitting a search. If omitted, the default method is GET. | false | enum (GET, HEAD, POST)
|
request_body
The request body as a string. | false | string |
false | map |
request_timeout_ms
The request timeout in milliseconds. | false | int |
url
The URL for the request. Supported schemes are http and https. | true | string |
data.http exposed references
data.http blocks
data.retry
Retry request configuration. By default there are no retries. Configuring this block will result in retries if an error is returned by the client (e.g., connection errors) or if a 5xx-range (except 501) status code is received.
data.retry attributes
| Name and description | Required | Value |
|---|
attempts
The number of times the request is to be retried. For example, if 2 is specified, the request will be tried a maximum of 3 times. | false | int |
max_delay_ms
The maximum delay between retry requests in milliseconds. | false | int |
min_delay_ms
The minimum delay between retry requests in milliseconds. | false | int |
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_dir exposed references
data remote_schema
data.remote_schema attributes
data.remote_schema exposed references
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.sql exposed references
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 |
data.template_dir exposed references
dev clickhouse
dev.clickhouse attributes
dev.clickhouse exposed references
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 exposed references
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 exposed references
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 exposed references
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 exposed references
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 snowflake
dev.snowflake attributes
dev.snowflake exposed references
dev.snowflake 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 exposed references
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 clickhouse
diff.clickhouse blocks
diff.add_table
diff.add_table attributes
diff.cluster
diff.cluster attributes
| Name | Required | Value |
|---|
name | false | string |
diff.concurrent_index
diff.concurrent_index attributes
diff.drop_table
diff.drop_table attributes
diff.materialized
diff.materialized attributes
diff.skip
diff.skip attributes
docker clickhouse
docker.clickhouse attributes
| Name and description | Required | Value |
|---|
args
Additional arguments to pass to the docker run command when starting the container. | false | List of strings |
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 |
platform
The platform attribute specifies the platform for the container. It defaults to the host platform if not specified. Examples: linux/amd64, linux/arm64, linux/arm/v7, etc. | false | string |
schema | false | string |
timeout
The timeout attribute specifies the timeout for waiting the container being ready to use. Defaults to 1m if not specified. | false | string |
docker.clickhouse exposed references
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 |
|---|
args
Additional arguments to pass to the docker run command when starting the container. | false | List of strings |
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 |
platform
The platform attribute specifies the platform for the container. It defaults to the host platform if not specified. Examples: linux/amd64, linux/arm64, linux/arm/v7, etc. | false | string |
schema | false | string |
timeout
The timeout attribute specifies the timeout for waiting the container being ready to use. Defaults to 1m if not specified. | false | string |
docker.mariadb exposed references
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 |
|---|
args
Additional arguments to pass to the docker run command when starting the container. | false | List of strings |
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 |
platform
The platform attribute specifies the platform for the container. It defaults to the host platform if not specified. Examples: linux/amd64, linux/arm64, linux/arm/v7, etc. | false | string |
schema | false | string |
timeout
The timeout attribute specifies the timeout for waiting the container being ready to use. Defaults to 1m if not specified. | false | string |
docker.mysql exposed references
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 oracle
docker.oracle attributes
| Name and description | Required | Value |
|---|
args
Additional arguments to pass to the docker run command when starting the container. | false | List of strings |
baseline | false | string |
database
The database attribute specifies the Oracle Pluggable Database (PDB) name to connect to. If not specified, the default database is used. This option is only available for the Oracle Enterprise Image. | 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)
|
platform
The platform attribute specifies the platform for the container. It defaults to the host platform if not specified. Examples: linux/amd64, linux/arm64, linux/arm/v7, etc. | false | string |
schema | false | string |
timeout
The timeout attribute specifies the timeout for waiting the container being ready to use. Defaults to 1m if not specified. | false | string |
docker.oracle exposed references
docker.oracle 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 |
|---|
args
Additional arguments to pass to the docker run command when starting the container. | false | List of strings |
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 |
platform
The platform attribute specifies the platform for the container. It defaults to the host platform if not specified. Examples: linux/amd64, linux/arm64, linux/arm/v7, etc. | false | string |
schema | false | string |
timeout
The timeout attribute specifies the timeout for waiting the container being ready to use. Defaults to 1m if not specified. | false | string |
docker.postgres exposed references
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 |
|---|
args
Additional arguments to pass to the docker run command when starting the container. | false | List of strings |
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)
|
platform
The platform attribute specifies the platform for the container. It defaults to the host platform if not specified. Examples: linux/amd64, linux/arm64, linux/arm/v7, etc. | false | string |
schema | false | string |
timeout
The timeout attribute specifies the timeout for waiting the container being ready to use. Defaults to 1m if not specified. | false | string |
docker.sqlserver exposed references
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.check.migrate_apply
env.check.migrate_apply blocks
env.check.allow
env.check.allow attributes
env.check.allow constraints
| Constraint | Value |
|---|
| Required | false |
Require Name (e.g., env.check.allow "name" ) | true |
env.check.deny
env.check.deny attributes
env.check.deny constraints
| Constraint | Value |
|---|
| Required | false |
Require Name (e.g., env.check.deny "name" ) | true |
env.check.migrate_apply constraints
| Constraint | Value |
|---|
| Required | false |
| Repeatable | true |
env.diff.clickhouse
env.diff.clickhouse blocks
env.diff.add_table
env.diff.add_table attributes
env.diff.cluster
env.diff.cluster attributes
| Name | Required | Value |
|---|
name | false | string |
env.diff.concurrent_index
env.diff.concurrent_index attributes
env.diff.drop_table
env.diff.drop_table attributes
env.diff.materialized
env.diff.materialized 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
}
naming {
force = true
}
}
env.lint attributes
env.lint blocks
env.lint.check
The check block defines the configuration of a specific lint check.
check "PG301" {
error = true
}
check "NM101" {
skip = true
}
env.lint.check attributes
| Name and description | Required | Value |
|---|
error
The error attribute specifies whether lint should error when the check fails. | false | bool |
force
The force attribute specifies whether this check should be enforced even if the atlas:nolint directive is set | false | bool |
skip
The skip attribute specifies whether lint should skip the check. | false | bool |
env.lint.check constraints
| Constraint | Value |
|---|
| Required | false |
Require Name (e.g., env.lint.check "name" ) | true |
| Mutually exclusive sets | [error, skip, force] |
| One of required sets | [error, skip, force] |
env.lint.concurrent_index
env.lint.concurrent_index attributes
env.lint.condrop
env.lint.condrop attributes
env.lint.data_depend
env.lint.data_depend attributes
env.lint.destructive
env.lint.destructive attributes
env.lint.destructive blocks
env.lint.destructive.allow_column
env.lint.destructive.allow_column attributes
| Name | Required | Value |
|---|
match | false | string |
env.lint.destructive.allow_schema
env.lint.destructive.allow_schema attributes
| Name | Required | Value |
|---|
match | false | string |
env.lint.destructive.allow_table
env.lint.destructive.allow_table attributes
| Name | Required | Value |
|---|
match | false | string |
env.lint.git
env.lint.git attributes
| Name | Required | Value |
|---|
base | false | string |
dir | false | string |
env.lint.incompatible
env.lint.incompatible attributes
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.nestedtx
env.lint.nestedtx 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 |
|---|
error | false | bool |
src | true | List of strings |
vars | false | map |
env.lint.statement
The statement block defines the configuration of the statement analyzer.
statement {
allow "only-alter-create" {
match = "(ALTER|CREATE) .+"
}
allow "delete-with-filter" {
match = "DELETE .+ WHERE .+"
}
deny "reject-delete" {
match = "DELETE .+"
}
deny "reject-truncate" {
match = "TRUNCATE .+"
}
}
env.lint.statement attributes
env.lint.statement blocks
env.lint.statement.allow
env.lint.statement.allow attributes
| Name | Required | Value |
|---|
match | true | string |
env.lint.statement.allow constraints
| Constraint | Value |
|---|
| Required | false |
Require Name (e.g., env.lint.statement.allow "name" ) | true |
env.lint.statement.deny
env.lint.statement.deny attributes
env.lint.statement.deny constraints
| Constraint | Value |
|---|
| Required | false |
Require Name (e.g., env.lint.statement.deny "name" ) | true |
env.lint.statement constraints
| Constraint | Value |
|---|
| Required | false |
| Require Name | false |
| One of required sets | [deny, allow] |
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_name | false | string |
lock_timeout | false | string |
revisions_schema | false | string |
to_version | false | string |
tx_mode | false | Transaction mode can be one of:
string
enum (none, file, all)
|
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.post.migrate_apply
env.post.migrate_apply blocks
env.post.exec
env.post.exec attributes
| Name | Required | Value |
|---|
on_error | false | enum (CONTINUE, BREAK)
|
sql | false | string |
src | false | string |
env.post.exec constraints
| Constraint | Value |
|---|
| Required | false |
| Require Name | false |
| Mutually exclusive sets | [src, sql] |
| One of required sets | [src, sql] |
env.post.skip
env.post.skip attributes
env.post.migrate_apply constraints
| Constraint | Value |
|---|
| Required | false |
| Repeatable | true |
env.post.schema_apply
env.post.schema_apply blocks
env.post.exec
env.post.exec attributes
| Name | Required | Value |
|---|
on_error | false | enum (CONTINUE, BREAK)
|
sql | false | string |
src | false | string |
env.post.exec constraints
| Constraint | Value |
|---|
| Required | false |
| Require Name | false |
| Mutually exclusive sets | [src, sql] |
| One of required sets | [src, sql] |
env.post.skip
env.post.skip attributes
env.post.schema_apply constraints
| Constraint | Value |
|---|
| Required | false |
| Repeatable | true |
env.pre.migrate_apply
env.pre.migrate_apply blocks
env.pre.exec
env.pre.exec attributes
| Name | Required | Value |
|---|
on_error | false | enum (CONTINUE, BREAK, FAIL)
|
sql | false | string |
src | false | string |
env.pre.exec constraints
| Constraint | Value |
|---|
| Required | false |
| Require Name | false |
| Mutually exclusive sets | [src, sql] |
| One of required sets | [src, sql] |
env.pre.skip
env.pre.skip attributes
env.pre.migrate_apply constraints
| Constraint | Value |
|---|
| Required | false |
| Repeatable | true |
env.pre.schema_apply
env.pre.schema_apply blocks
env.pre.exec
env.pre.exec attributes
| Name | Required | Value |
|---|
on_error | false | enum (CONTINUE, BREAK, FAIL)
|
sql | false | string |
src | false | string |
env.pre.exec constraints
| Constraint | Value |
|---|
| Required | false |
| Require Name | false |
| Mutually exclusive sets | [src, sql] |
| One of required sets | [src, sql] |
env.pre.skip
env.pre.skip attributes
env.pre.schema_apply constraints
| Constraint | Value |
|---|
| Required | false |
| Repeatable | true |
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
}
naming {
force = true
}
}
lint attributes
lint blocks
lint.check
The check block defines the configuration of a specific lint check.
check "PG301" {
error = true
}
check "NM101" {
skip = true
}
lint.check attributes
| Name and description | Required | Value |
|---|
error
The error attribute specifies whether lint should error when the check fails. | false | bool |
force
The force attribute specifies whether this check should be enforced even if the atlas:nolint directive is set | false | bool |
skip
The skip attribute specifies whether lint should skip the check. | false | bool |
lint.check constraints
| Constraint | Value |
|---|
| Required | false |
Require Name (e.g., lint.check "name" ) | true |
| Mutually exclusive sets | [error, skip, force] |
| One of required sets | [error, skip, force] |
lint.concurrent_index
lint.concurrent_index attributes
lint.condrop
lint.condrop attributes
lint.data_depend
lint.data_depend attributes
lint.destructive
lint.destructive attributes
lint.destructive blocks
lint.destructive.allow_column
lint.destructive.allow_column attributes
| Name | Required | Value |
|---|
match | false | string |
lint.destructive.allow_schema
lint.destructive.allow_schema attributes
| Name | Required | Value |
|---|
match | false | string |
lint.destructive.allow_table
lint.destructive.allow_table attributes
| Name | Required | Value |
|---|
match | false | string |
lint.git
lint.git attributes
| Name | Required | Value |
|---|
base | false | string |
dir | false | string |
lint.incompatible
lint.incompatible attributes
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.nestedtx
lint.nestedtx attributes
lint.non_linear
lint.non_linear attributes
| Name | Required | Value |
|---|
error | false | bool |
lint.rule.hcl
lint.rule.hcl attributes
| Name | Required | Value |
|---|
error | false | bool |
src | true | List of strings |
vars | false | map |
lint.statement
The statement block defines the configuration of the statement analyzer.
statement {
allow "only-alter-create" {
match = "(ALTER|CREATE) .+"
}
allow "delete-with-filter" {
match = "DELETE .+ WHERE .+"
}
deny "reject-delete" {
match = "DELETE .+"
}
deny "reject-truncate" {
match = "TRUNCATE .+"
}
}
lint.statement attributes
lint.statement blocks
lint.statement.allow
lint.statement.allow attributes
| Name | Required | Value |
|---|
match | true | string |
lint.statement.allow constraints
| Constraint | Value |
|---|
| Required | false |
Require Name (e.g., lint.statement.allow "name" ) | true |
lint.statement.deny
lint.statement.deny attributes
lint.statement.deny constraints
| Constraint | Value |
|---|
| Required | false |
Require Name (e.g., lint.statement.deny "name" ) | true |
lint.statement constraints
| Constraint | Value |
|---|
| Required | false |
| Require Name | false |
| One of required sets | [deny, allow] |
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 |