dokploy_environment (Data Source)
Look up a Dokploy environment by id, or by name within a project. For the default environment, dokploy_project.production_environment_id gives the id without a lookup.
Example Usage
# By id.
data "dokploy_environment" "by_id" {
id = "Ux7kFq2mNp4RtWvYzAbCd"
}
# By name within a project: the usual way to reach the production
# environment that Dokploy creates automatically.
data "dokploy_environment" "production" {
project_id = dokploy_project.example.id
name = "production"
}
resource "dokploy_postgres" "db" {
name = "db"
environment_id = data.dokploy_environment.production.id
database_name = "app"
database_user = "app"
database_password = var.db_password
}Schema
Optional
id(String) Environment id. Set this attribute, or set bothproject_idandname.name(String) Exact environment name. The lookup searches withinproject_idand errors when zero or many environments match. Dokploy does not enforce unique names.project_id(String) Id of the project to search. Required withname.
Read-Only
description(String) Free-form description.env(String, Sensitive) Variables that each service in this environment shares, exactly as Dokploy stores them. The attribute is sensitive because it usually holds credentials that this provider did not write. The plan output redacts it, but the state stores it in plain text, like all Terraform data.is_default(Boolean) True for theproductionenvironment that Dokploy creates with each project.