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 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_schema | false | bool |
drop_table | false | bool |
drop_trigger | 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 |