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] |
check migrate_apply
check.migrate_apply blocks
check.allow
check.allow attributes
check.allow constraints
| Constraint | Value |
|---|
| Required | false |
Require Name (e.g., check.allow "name" ) | true |
check.deny
check.deny attributes
check.deny constraints
| Constraint | Value |
|---|
| Required | false |
Require Name (e.g., check.deny "name" ) | true |
check.drift
The drift block enables pre-apply drift detection. When set, Atlas compares the actual database state against the expected state from the schema registry at the current revision version before applying migrations.
check.drift attributes
| Name and description | Required | Value |
|---|
exclude
List of glob patterns to exclude from drift inspection. Defaults to env.exclude if not set. | false | List of strings |
on_error
The behavior when drift is detected. By default, drift causes the migration to abort. Set to CONTINUE to emit a warning and proceed. | false | enum (CONTINUE, FAIL)
|
check.migrate_apply constraints
| Constraint | Value |
|---|
| Required | false |
| Repeatable | true |
check schema_apply
check.schema_apply blocks
check.allow
check.allow attributes
check.allow constraints
| Constraint | Value |
|---|
| Required | false |
Require Name (e.g., check.allow "name" ) | true |
check.deny
check.deny attributes
check.deny constraints
| Constraint | Value |
|---|
| Required | false |
Require Name (e.g., check.deny "name" ) | true |
check.schema_apply constraints
| Constraint | Value |
|---|
| Required | false |
| Repeatable | true |
data aws_dsql_token
The aws_dsql_token data source generates a short-lived token for an AWS Aurora DSQL database using IAM Authentication.
data "aws_dsql_token" "db" {
region = "us-east-1"
endpoint = local.endpoint
}
data.aws_dsql_token attributes
| Name and description | Required | Value |
|---|
admin
If true, generates an admin auth token. If false (default), generates a regular user auth token. | false | bool |
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 |
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.hcl_schema blocks
data.annotation
data.annotation blocks
data.annotation.attr
data.annotation.attr attributes
| Name | Required | Value |
|---|
required | false | bool |
type | true | HCL type (string, number, bool, list(string), etc) |
data.annotation.attr constraints
| Constraint | Value |
|---|
| Required | false |
Require Name (e.g., data.annotation.attr "name" ) | true |
| Repeatable | true |
data.annotation.block
data.annotation.block attributes
data.annotation.block blocks
data.annotation.block.attr
data.annotation.block.attr attributes
| Name | Required | Value |
|---|
required | false | bool |
type | true | HCL type (string, number, bool, list(string), etc) |
data.annotation.block.attr constraints
| Constraint | Value |
|---|
| Required | false |
Require Name (e.g., data.annotation.block.attr "name" ) | true |
| Repeatable | true |
data.annotation.block.block
data.annotation.block.block attributes
data.annotation.block.block constraints
| Constraint | Value |
|---|
| Required | false |
Require Name (e.g., data.annotation.block.block "name" ) | true |
| Repeatable | true |
data.annotation.block constraints
| Constraint | Value |
|---|
| Required | false |
Require Name (e.g., data.annotation.block "name" ) | true |
| Repeatable | true |
data.annotation constraints
| Constraint | Value |
|---|
| Required | false |
| Require Name | false |
| Repeatable | true |
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
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 |
|---|
depends_on
List of groups that must complete before this group starts. | false | List of object reference to group |
match
Expression to filter which tenants belong to this group. Uses var.* to reference deployment variables. | false | Any value |
on_error
Error handling mode: FAIL stops the entire deployment, CONTINUE logs and proceeds. | false | enum (FAIL, CONTINUE)
|
order_by
Expression or list of expressions to sort tenants within this group. | false | Any value |
parallel
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 (string, number, bool, list(string), etc) |
deployment.variable blocks
deployment.variable.validation
deployment.variable.validation attributes
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
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_column
diff.add_column attributes
diff.add_column
diff.add_column attributes
diff.add_index
diff.add_index attributes
diff.add_index
diff.add_index attributes
diff.add_table
diff.add_table attributes
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.concurrent_index
diff.concurrent_index attributes
diff.drop_table
diff.drop_table attributes
diff.drop_table
diff.drop_table attributes
diff.materialized
diff.materialized attributes
diff.materialized
diff.materialized attributes
diff.session_settings
diff.session_settings attributes
diff.session_settings constraints
| Constraint | Value |
|---|
| Required | false |
| Require Name | false |
| Repeatable | true |
diff.skip
diff.skip attributes
diff.skip
diff.skip attributes
diff mysql
diff.mysql attributes
diff.mysql blocks
diff.add_column
diff.add_column attributes
diff.add_column
diff.add_column attributes
diff.add_index
diff.add_index attributes
diff.add_index
diff.add_index attributes
diff.add_table
diff.add_table attributes
diff.add_table
diff.add_table attributes
diff.concurrent_index
diff.concurrent_index attributes
diff.concurrent_index
diff.concurrent_index attributes
diff.drop_table
diff.drop_table attributes
diff.drop_table
diff.drop_table attributes
diff.materialized
diff.materialized attributes
diff.materialized
diff.materialized attributes
diff.not_null
diff.not_null attributes
| Name | Required | Value |
|---|
check | false | bool |
diff.skip
diff.skip attributes
diff.skip
diff.skip attributes
diff postgres
diff.postgres blocks
diff.add_column
diff.add_column attributes
diff.add_column
diff.add_column attributes
diff.add_index
diff.add_index attributes
diff.add_index
diff.add_index attributes
diff.add_table
diff.add_table attributes
diff.add_table
diff.add_table attributes
diff.concurrent_index
diff.concurrent_index attributes
diff.concurrent_index
diff.concurrent_index attributes
diff.drop_table
diff.drop_table attributes
diff.drop_table
diff.drop_table attributes
diff.materialized
diff.materialized attributes
diff.materialized
diff.materialized attributes
diff.not_null
diff.not_null attributes
diff.skip
diff.skip attributes
diff.skip