skip to content
wihan.dev
view as markdown
browse the dokploy docs

dokploy_project (Resource)

A Dokploy project. Dokploy creates a default production environment with each project. Service resources reference its id through production_environment_id. The environments attribute lists every environment in the project.

Example Usage

terraform
resource "dokploy_project" "example" {
  name        = "my-project"
  description = "Managed by Terraform"

  # Variables that each service in the project can reference as
  # ${{project.KEY}}. Use Terraform sensitive variables for secret values.
  env = <<-EOT
    REGION=eu-west-1
  EOT

  # Labels from dokploy_tag records. Omit the attribute for no tags.
  tag_ids = [dokploy_tag.production.id]
}

resource "dokploy_tag" "production" {
  name  = "production"
  color = "#0a8a74"
}

output "production_environment_id" {
  value = dokploy_project.example.production_environment_id
}

Schema

Required

  • name (String) Project name.

Optional

  • description (String) Free-form description.
  • env (String) Variables that each service in the project can reference, as KEY=value lines. A service reads them through the ${{project.KEY}} syntax; an environment does not inherit them into its own env. An omitted value and "" both read back as null. Omit the attribute to clear it.
  • tag_ids (Set of String) Ids of the dokploy_tag records that the project carries. The provider sends the whole set on each change, so the assignments in Dokploy match the set exactly. Omit the attribute to clear them.

Read-Only

  • created_at (String) Creation timestamp from the server.
  • environments (Attributes List) Environments in this project, the auto-created production environment included. (see nested schema for environments)
  • id (String) Project id.
  • production_environment_id (String) Id of the default environment. Dokploy creates it with the project and names it production. The provider selects it with the server’s isDefault flag, not by name, so a rename does not change the value. Use it as the environment_id of a service in the default environment.

Nested Schema for environments

Read-Only:

  • id (String) Environment id.
  • name (String) Environment name.

Import

Import is supported using the following syntax:

In Terraform v1.5.0 and later, the import block can be used with the id attribute, for example:

terraform
import {
  to = dokploy_project.example
  id = "V1StGXR8_Z5jdHi6B-myT"
}

The terraform import command can be used, for example:

shell
terraform import dokploy_project.example V1StGXR8_Z5jdHi6B-myT