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

dokploy_security (Resource)

HTTP basic-auth credentials that protect a Dokploy application.

~> Dokploy stores and returns password in cleartext. The attribute is sensitive, so Terraform does not print it, but anyone with API access to the server can read it, and the Terraform state holds it in cleartext like any other attribute. The password_wo companion keeps it out of the state.

Example Usage

terraform
# Basic-auth in front of a staging application.
resource "dokploy_security" "staging_gate" {
  application_id = dokploy_application.staging.id
  username       = "preview"
  password       = var.staging_password
}

Schema

Required

  • application_id (String) Id of the application that owns this record. A change forces a replacement: the Dokploy update endpoint for this record type has no parent field, so a record cannot move between applications.
  • username (String) Basic-auth username.

Optional

NOTE: Write-only arguments are supported in Terraform 1.11 and later.

  • password (String, Sensitive) Basic-auth password. Set this attribute or password_wo.
  • password_wo (String, Sensitive, Write-only) Write-only form of password. Terraform keeps it out of the plan and the state. It needs Terraform 1.11 or later. Set exactly one of password and password_wo. A new value reaches the server only when password_wo_version changes.
  • password_wo_version (Number) Version of password_wo. Change it to send the current password_wo value to the server. It needs password_wo.

Read-Only

  • id (String) Record id.

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_security.staging_gate
  id = "s1a2b3c4d5e6f7g8h9i0j"
}

The terraform import command can be used, for example:

shell
terraform import dokploy_security.staging_gate s1a2b3c4d5e6f7g8h9i0j