Atlas Configuration
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 |
|---|---|---|
The | false | string |
token | false | string |
atlas.cloud constraints
| Constraint | Value |
|---|---|
| Required | true |
| Require Name | false |
| One of required sets | [org, token] |
check migrate_apply
check.migrate_apply blocks
check.allow
check.allow attributes
| Name | Required | Value |
|---|---|---|
condition | true | bool |
check.allow constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., check.allow "name" ) | true |
check.deny
check.deny attributes
| Name | Required | Value |
|---|---|---|
condition | true | bool |
message | false | string |
check.deny constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., check.deny "name" ) | true |
check.migrate_apply constraints
| Constraint | Value |
|---|---|
| Required | false |
| Repeatable | true |
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 |
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 |
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
| Name | Value |
|---|---|
url | string |
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 |
The | true | string |
data.cloud_databases exposed references
| Name | Value |
|---|---|
targets | any |
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
| Name | Value |
|---|---|
url | string |
data.composite_schema blocks
data.schema
data.schema attributes
| Name | Required | Value |
|---|---|---|
url | true | Composite_schema url can be one of:
|
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
| Name | Required | Value |
|---|---|---|
program | true | List of strings |
working_dir | false | string |
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
| Name | Required | Value |
|---|---|---|
program | true | List of strings |
working_dir | false | string |
data.external_schema exposed references
| Name | Value |
|---|---|
url | string |
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
| Name | Value |
|---|---|
url | string |
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 |
|---|---|---|
Certificate Authority (CA) in PEM (RFC 1421) format. | false | string |
Client certificate in PEM (RFC 1421) format. | false | string |
Client key in PEM (RFC 1421) format. | false | string |
Disables verification of the server's certificate chain and hostname. Defaults to | false | bool |
The HTTP Method for the request. Allowed methods are a subset of methods defined in RFC7231 namely, | false |
|
The request body as a string. | false | string |
A map of request header field names and values. | false | map |
The request timeout in milliseconds. | false | int |
The URL for the request. Supported schemes are | true | string |
data.http exposed references
| Name and description | Value |
|---|---|
The response body returned as a string. | string |
The response body encoded as base64 (standard) as defined in RFC 4648. | string |
A map of response header field names and values. Duplicate headers are concatenated according to RFC2616. | map |
The HTTP response status code. | int |
The URL used for the request. | string |
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 |
|---|---|---|
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 |
The maximum delay between retry requests in milliseconds. | false | int |
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
| Name | Value |
|---|---|
url | string |
data remote_schema
data.remote_schema attributes
| Name | Required | Value |
|---|---|---|
name | true | string |
tag | false | string |
version | false | string |
data.remote_schema exposed references
| Name | Value |
|---|---|
url | string |
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
| Name | Value |
|---|---|
count | int |
value | string |
values | strings |
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
| Name | Value |
|---|---|
url | string |
deployment
The deployment block defines a multi-tenant or deployment strategy with groups.
deployment "staged" {
variable "tier" {
type = string
}
group "canary" {
match = var.tier == "canary"
on_error = FAIL
}
group "rest" {
depends_on = [group.canary]
parallel = 32
on_error = CONTINUE
}
}
deployment blocks
deployment.group
The group block defines a deployment group with its execution settings.
deployment.group attributes
| Name and description | Required | Value |
|---|---|---|
List of groups that must complete before this group starts. | false | List of object reference to |
Expression to filter which tenants belong to this group. Uses | false | Any value |
Error handling mode: | false |
|
Expression or list of expressions to sort tenants within this group. | false | Any value |
Maximum number of tenants to process in parallel within this group. Defaults to 1. | false | int |
deployment.group constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., deployment.group "name" ) | true |
| Repeatable | true |
deployment.variable
deployment.variable attributes
| Name | Required | Value |
|---|---|---|
default | false | Any value |
description | false | string |
type | true | HCL type ( |
deployment.variable blocks
deployment.variable.validation
deployment.variable.validation attributes
| Name | Required | Value |
|---|---|---|
condition | true | bool |
error_message | false | string |
deployment.variable.validation constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Repeatable | true |
deployment.variable constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., deployment.variable "name" ) | true |
deployment constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., deployment "name" ) | true |
dev clickhouse
dev.clickhouse attributes
| Name | Required | Value |
|---|---|---|
baseline | false | string |
url | true | string |
dev.clickhouse exposed references
| Name | Value |
|---|---|
url | string |
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
| Name | Required | Value |
|---|---|---|
max_idle | false | int |
max_idle_time | false | string |
max_lifetime | false | string |
max_open | false | int |
dev mariadb
dev.mariadb attributes
| Name | Required | Value |
|---|---|---|
baseline | false | string |
url | true | string |
dev.mariadb exposed references
| Name | Value |
|---|---|
url | string |
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
| Name | Required | Value |
|---|---|---|
max_idle | false | int |
max_idle_time | false | string |
max_lifetime | false | string |
max_open | false | int |
dev mysql
dev.mysql attributes
| Name | Required | Value |
|---|---|---|
baseline | false | string |
url | true | string |
dev.mysql exposed references
| Name | Value |
|---|---|
url | string |
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
| Name | Required | Value |
|---|---|---|
max_idle | false | int |
max_idle_time | false | string |
max_lifetime | false | string |
max_open | false | int |
dev postgres
dev.postgres attributes
| Name | Required | Value |
|---|---|---|
baseline | false | string |
url | true | string |
dev.postgres exposed references
| Name | Value |
|---|---|
url | string |
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
| Name | Required | Value |
|---|---|---|
max_idle | false | int |
max_idle_time | false | string |
max_lifetime | false | string |
max_open | false | int |
dev redshift
dev.redshift attributes
| Name | Required | Value |
|---|---|---|
baseline | false | string |
url | true | string |
dev.redshift exposed references
| Name | Value |
|---|---|
url | string |
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
| Name | Required | Value |
|---|---|---|
max_idle | false | int |
max_idle_time | false | string |
max_lifetime | false | string |
max_open | false | int |
dev snowflake
dev.snowflake attributes
| Name | Required | Value |
|---|---|---|
baseline | false | string |
url | true | string |
dev.snowflake exposed references
| Name | Value |
|---|---|
url | string |
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
| Name | Required | Value |
|---|---|---|
max_idle | false | int |
max_idle_time | false | string |
max_lifetime | false | string |
max_open | false | int |
dev sqlserver
dev.sqlserver attributes
| Name | Required | Value |
|---|---|---|
baseline | false | string |
url | true | string |
dev.sqlserver exposed references
| Name | Value |
|---|---|
url | string |
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
| Name | Required | Value |
|---|---|---|
max_idle | false | int |
max_idle_time | false | string |
max_lifetime | false | string |
max_open | false | int |
diff clickhouse
diff.clickhouse blocks
diff.add_table
diff.add_table attributes
| Name | Required | Value |
|---|---|---|
if_not_exists | false | bool |
diff.cluster
diff.cluster attributes
| Name | Required | Value |
|---|---|---|
name | false | string |
diff.concurrent_index
diff.concurrent_index attributes
| Name | Required | Value |
|---|---|---|
add | false | bool |
create | false | bool |
drop | false | bool |
diff.drop_table
diff.drop_table attributes
| Name | Required | Value |
|---|---|---|
cascade | false | bool |
if_exists | false | bool |
diff.materialized
diff.materialized attributes
| Name | Required | Value |
|---|---|---|
with_no_data | false | bool |
diff.session_settings
diff.session_settings attributes
| Name | Required | Value |
|---|---|---|
match | true | string |
values | false | map |
diff.session_settings constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Repeatable | true |
diff.skip
diff.skip attributes
| Name | Required | Value |
|---|---|---|
add_column | false | bool |
add_extension | false | bool |
add_foreign_key | false | bool |
add_func | false | bool |
add_index | false | bool |
add_proc | false | bool |
add_schema | false | bool |
add_table | false | bool |
add_trigger | false | bool |
add_view | false | bool |
drop_column | false | bool |
drop_extension | false | bool |
drop_foreign_key | false | bool |
drop_func | false | bool |
drop_index | false | bool |
drop_proc | false | bool |
drop_role | false | bool |
drop_schema | false | bool |
drop_table | false | bool |
drop_trigger | false | bool |
drop_user | false | bool |
drop_view | false | bool |
modify_column | false | bool |
modify_extension | false | bool |
modify_foreign_key | false | bool |
modify_func | false | bool |
modify_index | false | bool |
modify_proc | false | bool |
modify_schema | false | bool |
modify_table | false | bool |
modify_trigger | false | bool |
modify_view | false | bool |
rename_constraint | false | bool |
rename_func | false | bool |
rename_proc | false | bool |
rename_table | false | bool |
rename_trigger | false | bool |
rename_view | false | bool |
docker clickhouse
docker.clickhouse attributes
| Name and description | Required | Value |
|---|---|---|
Additional arguments to pass to the | false | List of strings |
baseline | false | string |
The | false | List of strings |
env | false | List of strings |
image | true | string |
The | false | string |
The | false | string |
schema | false | string |
The | false | string |
docker.clickhouse exposed references
| Name | Value |
|---|---|
url | 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"
}
}
}
Alternatively, you can define the Dockerfile inline:
docker "postgres" "dev" {
image = "postgres:15-custom"
build {
context = "."
dockerfile_inline = <<-EOF
FROM postgres:15
RUN apt-get update && apt-get install -y curl
EOF
}
}
docker.build attributes
| Name and description | Required | Value |
|---|---|---|
args | false | map |
context | true | string |
dockerfile | false | string |
The | false | string |
platform | false | List of strings |
target | false | string |
docker.build constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Mutually exclusive sets | [dockerfile, dockerfile_inline] |
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
| Name | Required | Value |
|---|---|---|
max_idle | false | int |
max_idle_time | false | string |
max_lifetime | false | string |
max_open | false | int |
docker dsql
docker.dsql attributes
| Name and description | Required | Value |
|---|---|---|
Additional arguments to pass to the | false | List of strings |
baseline | false | string |
The | false | List of strings |
env | false | List of strings |
image | true | string |
The | false | string |
The | false | string |
schema | false | string |
The | false | string |
docker.dsql exposed references
| Name | Value |
|---|---|
url | string |
docker.dsql 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"
}
}
}
Alternatively, you can define the Dockerfile inline:
docker "postgres" "dev" {
image = "postgres:15-custom"
build {
context = "."
dockerfile_inline = <<-EOF
FROM postgres:15
RUN apt-get update && apt-get install -y curl
EOF
}
}
docker.build attributes
| Name and description | Required | Value |
|---|---|---|
args | false | map |
context | true | string |
dockerfile | false | string |
The | false | string |
platform | false | List of strings |
target | false | string |
docker.build constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Mutually exclusive sets | [dockerfile, dockerfile_inline] |
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
| Name | Required | Value |
|---|---|---|
max_idle | false | int |
max_idle_time | false | string |
max_lifetime | false | string |
max_open | false | int |
docker mariadb
docker.mariadb attributes
| Name and description | Required | Value |
|---|---|---|
Additional arguments to pass to the | false | List of strings |
baseline | false | string |
The | false | List of strings |
env | false | List of strings |
image | true | string |
The | false | string |
The | false | string |
schema | false | string |
The | false | string |
docker.mariadb exposed references
| Name | Value |
|---|---|
url | 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"
}
}
}
Alternatively, you can define the Dockerfile inline:
docker "postgres" "dev" {
image = "postgres:15-custom"
build {
context = "."
dockerfile_inline = <<-EOF
FROM postgres:15
RUN apt-get update && apt-get install -y curl
EOF
}
}
docker.build attributes
| Name and description | Required | Value |
|---|---|---|
args | false | map |
context | true | string |
dockerfile | false | string |
The | false | string |
platform | false | List of strings |
target | false | string |
docker.build constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Mutually exclusive sets | [dockerfile, dockerfile_inline] |
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
| Name | Required | Value |
|---|---|---|
max_idle | false | int |
max_idle_time | false | string |
max_lifetime | false | string |
max_open | false | int |
docker mysql
docker.mysql attributes
| Name and description | Required | Value |
|---|---|---|
Additional arguments to pass to the | false | List of strings |
baseline | false | string |
The | false | List of strings |
env | false | List of strings |
image | true | string |
The | false | string |
The | false | string |
schema | false | string |
The | false | string |
docker.mysql exposed references
| Name | Value |
|---|---|
url | 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"
}
}
}
Alternatively, you can define the Dockerfile inline:
docker "postgres" "dev" {
image = "postgres:15-custom"
build {
context = "."
dockerfile_inline = <<-EOF
FROM postgres:15
RUN apt-get update && apt-get install -y curl
EOF
}
}
docker.build attributes
| Name and description | Required | Value |
|---|---|---|
args | false | map |
context | true | string |
dockerfile | false | string |
The | false | string |
platform | false | List of strings |
target | false | string |
docker.build constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Mutually exclusive sets | [dockerfile, dockerfile_inline] |
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
| Name | Required | Value |
|---|---|---|
max_idle | false | int |
max_idle_time | false | string |
max_lifetime | false | string |
max_open | false | int |
docker oracle
docker.oracle attributes
| Name and description | Required | Value |
|---|---|---|
Additional arguments to pass to the | false | List of strings |
baseline | false | string |
The | false | List of strings |
The | false | string |
env | false | List of strings |
image | true | string |
The | false | string |
mode | false |
|
The | false | string |
schema | false | string |
The | false | string |
docker.oracle exposed references
| Name | Value |
|---|---|
url | string |
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"
}
}
}
Alternatively, you can define the Dockerfile inline:
docker "postgres" "dev" {
image = "postgres:15-custom"
build {
context = "."
dockerfile_inline = <<-EOF
FROM postgres:15
RUN apt-get update && apt-get install -y curl
EOF
}
}
docker.build attributes
| Name and description | Required | Value |
|---|---|---|
args | false | map |
context | true | string |
dockerfile | false | string |
The | false | string |
platform | false | List of strings |
target | false | string |
docker.build constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Mutually exclusive sets | [dockerfile, dockerfile_inline] |
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
| Name | Required | Value |
|---|---|---|
max_idle | false | int |
max_idle_time | false | string |
max_lifetime | false | string |
max_open | false | int |
docker postgres
docker.postgres attributes
| Name and description | Required | Value |
|---|---|---|
Additional arguments to pass to the | false | List of strings |
baseline | false | string |
The | false | List of strings |
database | false | string |
env | false | List of strings |
image | true | string |
The | false | string |
The | false | string |
schema | false | string |
The | false | string |
docker.postgres exposed references
| Name | Value |
|---|---|
url | 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"
}
}
}
Alternatively, you can define the Dockerfile inline:
docker "postgres" "dev" {
image = "postgres:15-custom"
build {
context = "."
dockerfile_inline = <<-EOF
FROM postgres:15
RUN apt-get update && apt-get install -y curl
EOF
}
}
docker.build attributes
| Name and description | Required | Value |
|---|---|---|
args | false | map |
context | true | string |
dockerfile | false | string |
The | false | string |
platform | false | List of strings |
target | false | string |
docker.build constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Mutually exclusive sets | [dockerfile, dockerfile_inline] |
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
| Name | Required | Value |
|---|---|---|
max_idle | false | int |
max_idle_time | false | string |
max_lifetime | false | string |
max_open | false | int |
docker sqlserver
docker.sqlserver attributes
| Name and description | Required | Value |
|---|---|---|
Additional arguments to pass to the | false | List of strings |
baseline | false | string |
collate | false | string |
The | false | List of strings |
database | false | string |
env | false | List of strings |
image | true | string |
The | false | string |
mode | false |
|
The | false | string |
schema | false | string |
The | false | string |
docker.sqlserver exposed references
| Name | Value |
|---|---|
url | 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"
}
}
}
Alternatively, you can define the Dockerfile inline:
docker "postgres" "dev" {
image = "postgres:15-custom"
build {
context = "."
dockerfile_inline = <<-EOF
FROM postgres:15
RUN apt-get update && apt-get install -y curl
EOF
}
}
docker.build attributes
| Name and description | Required | Value |
|---|---|---|
args | false | map |
context | true | string |
dockerfile | false | string |
The | false | string |
platform | false | List of strings |
target | false | string |
docker.build constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Mutually exclusive sets | [dockerfile, dockerfile_inline] |
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
| Name | Required | Value |
|---|---|---|
max_idle | false | int |
max_idle_time | false | string |
max_lifetime | false | string |
max_open | false | int |
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 |
include | false | List of strings |
name | false | string |
schemas | false | List of strings |
src | false | Schema source can be one of:
|
url | false | string |
env blocks
env.check.migrate_apply
env.check.migrate_apply blocks
env.check.allow
env.check.allow attributes
| Name | Required | Value |
|---|---|---|
condition | true | bool |
env.check.allow constraints
| Constraint | Value |
|---|---|
| Required | false |
Require Name (e.g., env.check.allow "name" ) | true |
env.check.deny
env.check.deny attributes
| Name | Required | Value |
|---|---|---|
condition | true | bool |
message | false | string |
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.data
The data block configures static/lookup data management.
data {
mode = UPSERT
include = ["countries", "currencies"]
exclude = ["temp_*"]
}
env.data attributes
| Name and description | Required | Value |
|---|---|---|
Exclude tables matching patterns. Supports glob patterns. | false | List of strings |
Include only tables matching patterns. Supports glob patterns. | false | List of strings |
Maximum number of rows to manage per table. Value is required when querying a database in SYNC mode | false | int |
The sync mode: | true |
|
Skip objects from diff comparison. Supports glob patterns (e.g., | false | List of strings |
env.diff.clickhouse
env.diff.clickhouse blocks
env.diff.add_table
env.diff.add_table attributes
| Name | Required | Value |
|---|---|---|
if_not_exists | false | bool |
env.diff.cluster
env.diff.cluster attributes
| Name | Required | Value |
|---|---|---|
name | false | string |
env.diff.concurrent_index
env.diff.concurrent_index attributes
| Name | Required | Value |
|---|---|---|
add | false | bool |
create | false | bool |
drop | false | bool |
env.diff.drop_table
env.diff.drop_table attributes
| Name | Required | Value |
|---|---|---|
cascade | false | bool |
if_exists | false | bool |
env.diff.materialized
env.diff.materialized attributes
| Name | Required | Value |
|---|---|---|
with_no_data | false | bool |
env.diff.session_settings
env.diff.session_settings attributes
| Name | Required | Value |
|---|---|---|
match | true | string |
values | false | map |
env.diff.session_settings constraints
| Constraint | Value |
|---|---|
| Required | false |
| Require Name | false |
| Repeatable | true |
env.diff.skip
env.diff.skip attributes
| Name | Required | Value |
|---|---|---|
add_column | false | bool |
add_extension | false | bool |
add_foreign_key | false | bool |
add_func | false | bool |
add_index | false | bool |
add_proc | false | bool |
add_schema | false | bool |
add_table | false | bool |
add_trigger | false | bool |
add_view | false | bool |
drop_column | false | bool |
drop_extension | false | bool |
drop_foreign_key | false | bool |
drop_func | false | bool |
drop_index | false | bool |
drop_proc | false | bool |
drop_role | false | bool |
drop_schema | false | bool |
drop_table | false | bool |
drop_trigger | false | bool |
drop_user | false | bool |
drop_view | false | bool |
modify_column | false | bool |
modify_extension | false | bool |
modify_foreign_key | false | bool |
modify_func | false | bool |
modify_index | false | bool |
modify_proc | false | bool |
modify_schema | false | bool |
modify_table | false | bool |
modify_trigger | false | bool |
modify_view | false | bool |
rename_constraint | false | bool |
rename_func | false | bool |
rename_proc | false | bool |
rename_table | false | bool |
rename_trigger | false | bool |
rename_view | false | bool |
env.export
The export block configures schema export destinations.
export {
schema {
inspect = exporter.sql.dir
diff = exporter.http.webhook
}
}
env.export blocks
env.export.schema
Configure schema export.
env.export.schema attributes
| Name and description | Required | Value |
|---|---|---|
Exporter reference for 'schema diff' command. | false | Object reference to |
Exporter reference for 'schema inspect' command. | false | Object reference to |
env.format
The format block defines the output format of the different commands
format {
migrate {
diff = "{{ sql . \" \" }}"
}
}
env.format blocks
env.format.migrate
env.format.migrate attributes
| Name | Required | Value |
|---|---|---|
apply | false | string |
diff | false | string |
down | false | string |
lint | false | string |
status | false | string |
env.format.schema
env.format.schema attributes
| Name | Required | Value |
|---|---|---|
apply | false | string |
diff | false | string |
inspect | false | string |
env.lint
The lint block defines the linting configuration.
lint {
destructive {
error = false
}
concurrent_index {
error = true
}
naming {
force = true
}
}
env.lint attributes
| Name | Required | Value |
|---|---|---|
format | false | string |
latest | false | int |
log | false | string |
review | false |
|
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 |
|---|---|---|
The | false | bool |
The | false | bool |
The | 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
| Name | Required | Value |
|---|---|---|
check_create | false | bool |
check_drop | false | bool |
check_txmode | false | bool |
error | false | bool |
force | false | bool |
env.lint.condrop
env.lint.condrop attributes
| Name | Required | Value |
|---|---|---|
error | false | bool |
force | false | bool |
env.lint.data_depend
env.lint.data_depend attributes
| Name | Required | Value |
|---|---|---|
error | false | bool |
force | false | bool |
env.lint.destructive
env.lint.destructive attributes
| Name | Required | Value |
|---|---|---|
error | false | bool |
force | false | bool |
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
| Name | Required | Value |
|---|---|---|
error | false | bool |
force | false | bool |
env.lint.naming
env.lint.naming attributes
| Name | Required | Value |
|---|---|---|
error | false | bool |
force | false | bool |
match | false | string |
message | false | string |
env.lint.naming blocks
env.lint.naming.check
env.lint.naming.check attributes
| Name | Required | Value |
|---|---|---|
match | false | string |
message | false | string |
env.lint.naming.column
env.lint.naming.column attributes
| Name | Required | Value |
|---|---|---|
match | false | string |
message | false | string |
env.lint.naming.foreign_key
env.lint.naming.foreign_key attributes
| Name | Required | Value |
|---|---|---|
match | false | string |
message | false | string |
env.lint.naming.index
env.lint.naming.index attributes
| Name | Required | Value |
|---|---|---|
match | false | string |
message | false | string |
env.lint.naming.schema
env.lint.naming.schema attributes
| Name | Required | Value |
|---|---|---|
match | false | string |
message | false | string |
env.lint.naming.table
env.lint.naming.table attributes
| Name | Required | Value |
|---|---|---|
match | false | string |
message | false | string |
env.lint.nestedtx
env.lint.nestedtx attributes
| Name | Required | Value |
|---|---|---|
error | false | bool |
force | false | bool |
env.lint.non_linear
env.lint.non_linear attributes
| Name | Required | Value |
|---|---|---|
error | false | bool |
on_edit | false |
|
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
| Name | Required | Value |
|---|---|---|
error | false | bool |
force | false | bool |
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
| Name | Required | Value |
|---|---|---|
match | true | string |
message | false | string |
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
| Name | Required | Value |
|---|---|---|
apply | false | string |
diff | false | string |
down | false | string |
lint | false | string |
status | false | string |
env.log.schema
env.log.schema attributes
| Name | Required | Value |
|---|---|---|
apply | false | string |
diff | false | string |
inspect | false | string |
env.migration
The migration block defines the migration configuration
migration {
dir = "file://migrations"
repo {
name = "app"
}
}
env.migration attributes
| Name and description | Required | Value |
|---|---|---|
baseline | false | string |
dir | false | string |
exclude | false | List of strings |
exec_order | false |
|
format | false | Migration format can be one of:
|
lock_name | false | string |
lock_timeout | false | string |
revisions_schema | false | string |
skip_lock | false | bool |
Skip reporting migrations to Atlas Cloud. Useful for temporary environments (e.g., PR previews). | false | bool |
to_version | false | string |
tx_mode | false | Transaction mode can be one of:
|
env.migration blocks
env.migration.repo
The repository configuration for the migrations directory in the registry
repo {
name = "app"
}
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 |
|
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
| Name | Required | Value |
|---|---|---|
condition | true | bool |
message | false | string |
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 |
|
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
| Name | Required | Value |
|---|---|---|
condition | true | bool |
message | false | string |
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 |
|
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
| Name | Required | Value |
|---|---|---|
condition | true | bool |
message | false | string |
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 |
|
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
| Name | Required | Value |
|---|---|---|
condition | true | bool |
message | false | string |
env.pre.schema_apply constraints
| Constraint | Value |
|---|---|
| Required | false |
| Repeatable | true |
env.rollout
The rollout block configures multi-tenant or multi-environment deployment for this environment.
rollout {
deployment = deployment.staged
vars = {
tier = each.value.tier
region = each.value.region
}
}
env.rollout attributes
| Name and description | Required | Value |
|---|---|---|
Reference to a deployment block that defines the rollout strategy. | true | Object reference to |
Map of variable values to pass to the deployment. Keys must match the deployment's variable declarations. | false | map |
env.schema
The configuration for the desired schema
schema {
src = "file://schema.hcl"
repo {
name = "app"
}
}
env.schema attributes
| Name | Required | Value |
|---|---|---|
src | false | Schema source can be one of:
|
env.schema blocks
env.schema.mode
The inspection mode configuration.
By default, tables, views, funcs, types, objects, and triggers are enabled. Roles and permissions are disabled by default. Sensitive values are denied by default.
// Enable roles and permissions inspection.
mode {
roles = true
permissions = true
}
// Disable triggers and functions inspection.
mode {
triggers = false
funcs = false
}
// Allow sensitive values (passwords) in migration planning.
mode {
roles = true
sensitive = ALLOW
}
env.schema.mode attributes
| Name and description | Required | Value |
|---|---|---|
funcs | false | bool |
objects | false | bool |
permissions | false | bool |
roles | false | bool |
Control sensitive values (e.g., passwords) in migration planning. Valid values: | false |
|
tables | false | bool |
triggers | false | bool |
types | false | bool |
views | false | bool |
env.schema.repo
The repository configuration for the desired schema in the registry
repo {
name = "app"
}
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] |
exporter hcl
Export schema as HCL.
// Single file output.
exporter "hcl" "file" {
path = "schema.hcl"
}
// Split by object (directory output).
exporter "hcl" "dir" {
path = "schema/hcl"
split_by = object
naming = lower
}
exporter.hcl attributes
| Name and description | Required | Value |
|---|---|---|
File extension for split files (defaults to '.hcl'). | false | string |
Naming convention for split files: | false |
|
Output path. If | true | string |
Split strategy: | false |
|
exporter http
Export schema via HTTP request.
// Using a template for the body.
exporter "http" "webhook" {
url = "https://api.example.com/schemas"
method = "POST"
body_template = "{{ sql . }}"
headers = {
"Content-Type" = "application/json"
"Authorization" = "Bearer ${var.token}"
}
}
// Using a non-template body.
exporter "http" "simple" {
url = "https://api.example.com/schemas"
method = "POST"
body = "simple request body"
}
exporter.http attributes
| Name and description | Required | Value |
|---|---|---|
The request body as a simple string. | false | string |
The request body template. Supports template functions like | false | string |
Certificate Authority (CA) in PEM (RFC 1421) format. | false | string |
Client certificate in PEM (RFC 1421) format. | false | string |
Client key in PEM (RFC 1421) format. | false | string |
A map of request header field names and values. | false | map |
Disables verification of the server's certificate chain and hostname. Defaults to | false | bool |
The HTTP method for the request (e.g., | true | string |
The request timeout in milliseconds. | false | int |
The URL for the request. Supported schemes are | true | string |
exporter multi
Export schema to multiple exporters.
// Export to multiple HTTP endpoints with fail-fast behavior (default).
exporter "multi" "webhooks" {
exporters = [
exporter.http.webhook1,
exporter.http.webhook2,
]
}
// Export to both SQL and HCL formats, continue on errors.
exporter "multi" "all" {
exporters = [
exporter.sql.file,
exporter.hcl.file,
]
on_error = CONTINUE // Defaults to FAIL.
}
exporter.multi attributes
| Name and description | Required | Value |
|---|---|---|
List of exporter references to execute in sequence. | true | List of object reference to |
Error handling mode. Defaults to | false |
|
exporter sql
Export schema as SQL.
// Single file output.
exporter "sql" "file" {
path = "schema.sql"
indent = " "
}
// Split by object (directory output).
exporter "sql" "dir" {
path = "schema/sql"
split_by = object
naming = lower
}
exporter.sql attributes
| Name and description | Required | Value |
|---|---|---|
Indentation string for SQL output (e.g., " " for 2 spaces). | false | string |
Naming convention for split files: | false |
|
Output path. If | true | string |
Split strategy. Only | false |
|
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
| Name | Required | Value |
|---|---|---|
skip_errors | false | bool |
hook.sql blocks
hook.transaction
hook.transaction attributes
| Name | Required | Value |
|---|---|---|
after_begin | false | List of strings |
before_commit | false | List of strings |
before_rollback | false | List of strings |
lint
The lint block defines the linting configuration.
lint {
destructive {
error = false
}
concurrent_index {
error = true
}
naming {
force = true
}
}
lint attributes
| Name | Required | Value |
|---|---|---|
format | false | string |
latest | false | int |
log | false | string |
review | false |
|
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 |
|---|---|---|
The | false | bool |
The | false | bool |
The | 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
| Name | Required | Value |
|---|---|---|
check_create | false | bool |
check_drop | false | bool |
check_txmode | false | bool |
error | false | bool |
force | false | bool |
lint.condrop
lint.condrop attributes
| Name | Required | Value |
|---|---|---|
error | false | bool |
force | false | bool |
lint.data_depend
lint.data_depend attributes
| Name | Required | Value |
|---|---|---|
error | false | bool |
force | false | bool |
lint.destructive
lint.destructive attributes
| Name | Required | Value |
|---|---|---|
error | false | bool |
force | false | bool |
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
| Name | Required | Value |
|---|---|---|
error | false | bool |
force | false | bool |
lint.naming
lint.naming attributes
| Name | Required | Value |
|---|---|---|
error | false | bool |
force | false | bool |
match | false | string |
message | false | string |
lint.naming blocks
lint.naming.check
lint.naming.check attributes
| Name | Required | Value |
|---|---|---|
match | false | string |
message | false | string |
lint.naming.column
lint.naming.column attributes
| Name | Required | Value |
|---|---|---|
match | false | string |
message | false | string |
lint.naming.foreign_key
lint.naming.foreign_key attributes
| Name | Required | Value |
|---|---|---|
match | false | string |
message | false | string |
lint.naming.index
lint.naming.index attributes
| Name | Required | Value |
|---|---|---|
match | false | string |
message | false | string |
lint.naming.schema
lint.naming.schema attributes
| Name | Required | Value |
|---|---|---|
match | false | string |
message | false | string |
lint.naming.table
lint.naming.table attributes
| Name | Required | Value |
|---|---|---|
match | false | string |
message | false | string |
lint.nestedtx
lint.nestedtx attributes
| Name | Required | Value |
|---|---|---|
error | false | bool |
force | false | bool |
lint.non_linear
lint.non_linear attributes
| Name | Required | Value |
|---|---|---|
error | false | bool |
on_edit | false |
|
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
| Name | Required | Value |
|---|---|---|
error | false | bool |
force | false | bool |
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
| Name | Required | Value |
|---|---|---|
match | true | string |
message | false | string |
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 |