RunR v0.7.5

Documentation

runr_domain (Resource)

A custom domain of a project. Create the TXT record (verification_name / verification_value) and the record in dns_targets at your DNS provider; the domain serves once it is verified (verify = true waits for that, or run runr domains verify).

With environment the domain routes to one environment of the project, with the DNS targets and certificates of the region the environment runs in. Import with <project name or id>/<domain> or <project name or id>/<environment>/<domain>.

Example Usage#

resource "runr_domain" "api" {
  project_id = runr_project.api.id
  domain     = "api.example.com"
  tls_mode   = "cert-manager"
}

# Publish the records at your DNS provider, e.g. with the cloudflare provider:
#   TXT   runr_domain.api.verification_name  = runr_domain.api.verification_value
#   CNAME runr_domain.api.dns_targets[0].name = runr_domain.api.dns_targets[0].value
output "dns_records" {
  value = concat(
    [{ type = runr_domain.api.verification_type, name = runr_domain.api.verification_name, value = runr_domain.api.verification_value }],
    runr_domain.api.dns_targets,
  )
}

# A domain of the staging environment: it routes to staging's workload, with the DNS targets of
# the region staging runs in.
resource "runr_domain" "staging" {
  project_id  = runr_project.api.id
  environment = runr_environment.staging.name
  domain      = "staging.example.com"
}

Schema#

Required#

  • domain (String) Host name, e.g. api.example.com.
  • project_id (String) Project id.

Optional#

  • certificate (String) PEM certificate chain (tls_mode = "custom").
  • environment (String) Environment the domain routes to (runr_environment.<name>.name or its id). Left out (or production): the project's own workload. Changing it adds the domain anew.
  • private_key (String, Sensitive) PEM private key (tls_mode = "custom").
  • tls_mode (String) HTTPS certificate: none (the region's default certificate, which does not name the domain), cert-manager (a certificate for the domain from the region's cert-manager issuer) or custom. Left out, RunR chooses when the domain is created — cert-manager where the region issues certificates, none elsewhere — and the mode the domain has is kept (also one set in the console or with runr domains tls).
  • verify (Boolean) Wait at create until the DNS records are found and the domain is active (default false).
  • verify_timeout (String) How long verify waits (Go duration, default 10m).

Read-Only#

  • dns_targets (List of Object) Records that route the domain to the project (type, name, value). (see below for nested schema)
  • id (String) Domain id.
  • status (String) pending, verified, active or error.
  • url (String) URL of the domain.
  • verification_name (String) Ownership record name.
  • verification_type (String) Ownership record type (TXT).
  • verification_value (String) Ownership record value.

Nested Schema for dns_targets#

Read-Only:

  • name (String)
  • type (String)
  • value (String)

Import#

Import is supported using the following syntax:

The terraform import command can be used, for example:

# <project name or id>/<domain>
terraform import runr_domain.api orders-api/api.example.com

# A domain of an environment: <project name or id>/<environment>/<domain>
terraform import runr_domain.staging orders-api/staging/staging.example.com

RunR v0.7.5 · MIT License