atlas
The atlas
is an optional block for login to Atlas Cloud.
Blocks
atlas.cloud
atlas.cloud
attributes
Name | Required | Value |
---|
token | true | string |
atlas.cloud
constraints
Constraint | Value |
---|
Required | true |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Allow Qualifier | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
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
}
Attributes
Constraints
Constraint | Value |
---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
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"
}
...
}
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 |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
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"
]
}
Attributes
Constraints
Constraint | Value |
---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
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"
]
}
Attributes
Constraints
Constraint | Value |
---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
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" {}
Attributes
Name | Required | Value |
---|
region | false | string |
Constraints
Constraint | Value |
---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
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
}
}
Attributes
Name | Required | Value |
---|
path | false | string |
paths | false | List of strings |
vars | false | map |
Constraints
Constraint | Value |
---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
data remote_dir
The remote_dir
data source reads the state of a migration directory from Atlas Cloud.
data "remote_dir" "migrations" {
name = "myapp"
}
Attributes
Name | Required | Value |
---|
name | true | string |
tag | false | string |
Constraints
Constraint | Value |
---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
data remote_schema
Attributes
Constraints
Constraint | Value |
---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
data runtimevar
The runtimevar
data source allows fetching runtime variables from a remote source.
Attributes
Name | Required | Value |
---|
url | true | string |
Constraints
Constraint | Value |
---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
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]
}
Attributes
Name | Required | Value |
---|
args | false | Any value |
query | true | string |
url | true | string |
Constraints
Constraint | Value |
---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
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"
}
}
Attributes
Name | Required | Value |
---|
path | true | string |
vars | false | map |
Constraints
Constraint | Value |
---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
diff
The diff
block defines the diffing configuration
diff {
concurrent_index {
add = true
drop = true
}
}
Blocks
diff.concurrent_index
diff.concurrent_index
attributes
diff.concurrent_index
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
diff.skip
diff.skip
attributes
diff.skip
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Allow Qualifier | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
docker clickhouse
Attributes
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.build
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
docker mariadb
Attributes
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.build
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
docker mysql
Attributes
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.build
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
docker postgres
Attributes
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.build
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
docker sqlserver
Attributes
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.build
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env
The env
block describes an environment block that can be selected by using the --env
flag.
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 |
Blocks
env.diff
The diff
block defines the diffing configuration
diff {
concurrent_index {
add = true
drop = true
}
}
env.diff
blocks
env.diff.concurrent_index
env.diff.concurrent_index
attributes
env.diff.concurrent_index
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.diff.skip
env.diff.skip
attributes
env.diff.skip
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.diff
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
The format
block defines the output format of the different commands
format {
migrate {
diff = "{{ sql . \" \" }}"
}
}
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.lint
The lint
block defines the linting configuration
lint {
destructive {
error = false
}
concurrent_index {
error = true
}
}
env.lint
attributes
env.lint
blocks
env.lint.concurrent_index
env.lint.concurrent_index
attributes
env.lint.concurrent_index
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.lint.condrop
env.lint.condrop
attributes
Name | Required | Value |
---|
error | false | bool |
env.lint.condrop
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.lint.data_depend
env.lint.data_depend
attributes
Name | Required | Value |
---|
error | false | bool |
env.lint.data_depend
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.lint.destructive
env.lint.destructive
attributes
Name | Required | Value |
---|
error | false | bool |
env.lint.destructive
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.lint.git
env.lint.git
attributes
Name | Required | Value |
---|
base | false | string |
dir | false | string |
env.lint.git
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.lint.incompatible
env.lint.incompatible
attributes
Name | Required | Value |
---|
error | false | bool |
env.lint.incompatible
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.lint.naming
env.lint.naming
attributes
env.lint.naming
blocks
env.lint.naming.check
env.lint.naming.check
attributes
env.lint.naming.check
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.lint.naming.column
env.lint.naming.column
attributes
env.lint.naming.column
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.lint.naming.foreign_key
env.lint.naming.foreign_key
attributes
env.lint.naming.foreign_key
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.lint.naming.index
env.lint.naming.index
attributes
env.lint.naming.index
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.lint.naming.schema
env.lint.naming.schema
attributes
env.lint.naming.schema
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.lint.naming.table
env.lint.naming.table
attributes
env.lint.naming.table
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.lint.naming
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.lint.non_linear
env.lint.non_linear
attributes
Name | Required | Value |
---|
error | false | bool |
env.lint.non_linear
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.lint
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | 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.migrate
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.log.schema
env.log.schema
attributes
env.log.schema
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.log
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.migration
The migration
block defines the migration configuration
migration {
dir = "file://migrations"
repo {
name = "app"
}
}
env.migration
attributes
Name | Required | Value |
---|
baseline | false | string |
dir | false | string |
exclude | false | List of strings |
exec_order | false | enum (LINEAR, linear, LINEAR_SKIP, linear-skip, NON_LINEAR, non-linear)
|
format | false | Migration format can be one of: enum (atlas, golang-migrate, goose, flyway, liquibase, dbmate) string
|
lock_timeout | false | string |
revisions_schema | false | string |
env.migration
blocks
env.migration.repo
The repository configuration for the migrations directory in the registry
env.migration.repo
attributes
Name | Required | Value |
---|
name | true | string |
env.migration.repo
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.migration
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.schema
The configuration for the desired schema
schema {
src = "file://schema.hcl"
repo {
name = "app"
}
}
env.schema
attributes
Name | Required | Value |
---|
src | true | string |
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.schema.repo
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.schema
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
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.migrate
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.test.schema
env.test.schema
attributes
Name | Required | Value |
---|
src | true | List of strings |
vars | false | map |
env.test.schema
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
env.test
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Allow Qualifier | false |
Repeatable | true |
Allow unknown blocks | false |
Allow unknown attributes | true |
hook sql
The hook "sql" "name"
block defines an SQL hook configuration.
hook "sql" "timeout" {
transaction {
after_begin = [
"SET statement_timeout TO '50ms'",
]
}
}
Attributes
Blocks
hook.transaction
hook.transaction
attributes
hook.transaction
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|
Required | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
lint
The lint
block defines the linting configuration
lint {
destructive {
error = false
}
concurrent_index {
error = true
}
}
Attributes
Blocks
lint.concurrent_index
lint.concurrent_index
attributes
lint.concurrent_index
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
lint.condrop
lint.condrop
attributes
Name | Required | Value |
---|
error | false | bool |
lint.condrop
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
lint.data_depend
lint.data_depend
attributes
Name | Required | Value |
---|
error | false | bool |
lint.data_depend
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
lint.destructive
lint.destructive
attributes
Name | Required | Value |
---|
error | false | bool |
lint.destructive
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
lint.git
lint.git
attributes
Name | Required | Value |
---|
base | false | string |
dir | false | string |
lint.git
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
lint.incompatible
lint.incompatible
attributes
Name | Required | Value |
---|
error | false | bool |
lint.incompatible
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
lint.naming
lint.naming
attributes
lint.naming
blocks
lint.naming.check
lint.naming.check
attributes
lint.naming.check
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
lint.naming.column
lint.naming.column
attributes
lint.naming.column
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
lint.naming.foreign_key
lint.naming.foreign_key
attributes
lint.naming.foreign_key
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
lint.naming.index
lint.naming.index
attributes
lint.naming.index
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
lint.naming.schema
lint.naming.schema
attributes
lint.naming.schema
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
lint.naming.table
lint.naming.table
attributes
lint.naming.table
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
lint.naming
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
lint.non_linear
lint.non_linear
attributes
Name | Required | Value |
---|
error | false | bool |
lint.non_linear
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Allow Qualifier | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | 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
}
}
}
Blocks
test.migrate
test.migrate
attributes
Name | Required | Value |
---|
src | true | List of strings |
vars | false | map |
test.migrate
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
test.schema
test.schema
attributes
Name | Required | Value |
---|
src | true | List of strings |
vars | false | map |
test.schema
constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |
Constraints
Constraint | Value |
---|
Required | false |
Require Name | false |
Allow Qualifier | false |
Repeatable | false |
Allow unknown blocks | false |
Allow unknown attributes | false |