OpenMCF logoOpenMCF

Loading...

Civo DNS Record

Manages individual DNS records within a Civo DNS zone. The component creates a single record of any supported type (A, AAAA, CNAME, MX, TXT, SRV, NS), validates the manifest, and exposes the record ID and fully qualified hostname as stack outputs.

What Gets Created

When you deploy a CivoDnsRecord resource, OpenMCF provisions:

  • Civo DNS Domain Record --- a DNS record of the specified type attached to an existing Civo DNS zone, created via the civo.DnsDomainRecord Pulumi resource
  • Labels --- key-value metadata derived from metadata.labels applied to internal tracking (resource name, kind, organization, environment)

Prerequisites

  • Civo credentials configured via environment variables or OpenMCF provider config
  • An existing Civo DNS Zone --- either supply the zone ID directly or reference a CivoDnsZone resource using valueFrom
  • A valid record value appropriate for the chosen record type (e.g., an IPv4 address for A records, a hostname for CNAME records)

Quick Start

Create a file civo-dns-record.yaml:

apiVersion: civo.openmcf.org/v1
kind: CivoDnsRecord
metadata:
  name: www-record
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: dev.CivoDnsRecord.www-record
spec:
  zoneId:
    value: "a1b2c3d4-zone-id"
  name: www
  type: A
  value: "203.0.113.10"

Deploy:

openmcf apply -f civo-dns-record.yaml

This creates an A record for www in the specified DNS zone pointing to 203.0.113.10 with a default TTL of 3600 seconds (1 hour).

Configuration Reference

Required Fields

FieldTypeDescriptionValidation
zoneIdStringValueOrRefThe ID of the Civo DNS zone where the record will be created. Accepts a literal value string or a valueFrom reference to a CivoDnsZone resource.Required
namestringThe DNS record name (e.g., "www", "api", "@" for the zone apex).Required
typeRecordTypeThe DNS record type. One of: A, AAAA, CNAME, MX, TXT, SRV, NS.Required; must not be record_type_unspecified
valuestringThe record value. Format depends on the record type (see notes below).Required

Value format by record type:

TypeExpected value formatExample
AIPv4 address"192.0.2.1"
AAAAIPv6 address"2001:db8::1"
CNAMETarget hostname"example.com"
MXMail server hostname"mail.example.com"
TXTArbitrary text"v=spf1 include:_spf.google.com ~all"
SRVPriority weight port target"10 60 5060 sip.example.com"
NSNameserver hostname"ns1.example.com"

Optional Fields

FieldTypeDefaultDescription
ttlint323600Time to live in seconds. Determines how long resolvers cache the record. Valid range: 60--86400 (1 minute to 24 hours). A value of 0 uses the default (3600).
priorityint320Priority for MX and SRV records. Lower values indicate higher priority. Range: 0--65535. Required when type is MX.

Cross-Field Validation

  • When type is MX, the priority field must be greater than 0.

Zone ID Reference Syntax

The zoneId field supports two forms:

Literal value --- supply the zone ID directly:

zoneId:
  value: "a1b2c3d4-zone-id"

Resource reference --- resolve the zone ID from a CivoDnsZone resource at deploy time. The default kind is CivoDnsZone and the default field path is status.outputs.zone_id, so only the name is required:

zoneId:
  valueFrom:
    name: my-zone

Examples

A Record with Custom TTL

An A record pointing a subdomain to an IPv4 address with a 5-minute TTL:

apiVersion: civo.openmcf.org/v1
kind: CivoDnsRecord
metadata:
  name: api-a-record
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: prod.CivoDnsRecord.api-a-record
spec:
  zoneId:
    valueFrom:
      name: my-zone
  name: api
  type: A
  value: "203.0.113.50"
  ttl: 300

MX Record with Priority

A mail exchange record directing email to a mail server with priority 10:

apiVersion: civo.openmcf.org/v1
kind: CivoDnsRecord
metadata:
  name: mail-mx-record
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: prod.CivoDnsRecord.mail-mx-record
spec:
  zoneId:
    value: "a1b2c3d4-zone-id"
  name: "@"
  type: MX
  value: "mail.example.com"
  ttl: 3600
  priority: 10

CNAME Record Referencing a DNS Zone

A CNAME alias that resolves the zone ID from a CivoDnsZone resource:

apiVersion: civo.openmcf.org/v1
kind: CivoDnsRecord
metadata:
  name: docs-cname
  labels:
    openmcf.org/provisioner: pulumi
    pulumi.openmcf.org/organization: my-org
    pulumi.openmcf.org/project: my-project
    pulumi.openmcf.org/stack.name: staging.CivoDnsRecord.docs-cname
spec:
  zoneId:
    valueFrom:
      name: my-zone
  name: docs
  type: CNAME
  value: "docs-hosting.example.com"
  ttl: 600

Stack Outputs

After deployment, the following outputs are available in status.outputs:

OutputTypeDescription
recordIdstringUnique identifier of the DNS record, assigned by Civo
hostnamestringThe fully qualified hostname of the DNS record (e.g., "www.example.com")
recordTypestringThe DNS record type that was created (e.g., "A", "CNAME")
accountIdstringThe Civo account ID where the record was created

Related Components

  • CivoDnsZone --- the parent DNS zone where records are created; can be referenced via valueFrom in the zoneId field
  • CivoKubernetesCluster --- Kubernetes clusters whose ingress addresses are common targets for A and CNAME records
  • CivoIpAddress --- reserved IP addresses that can be used as A record values for stable endpoints

Next article

Civo DNS Zone

Civo DNS Zone Provisions a DNS zone (domain) on Civo Cloud with declarative DNS record management. The component creates the zone and any associated records in a single manifest, supporting A, AAAA, CNAME, MX, TXT, and other standard record types with configurable TTLs and cross-resource value references. What Gets Created When you deploy a CivoDnsZone resource, OpenMCF provisions: Civo DNS Domain — a civodnsdomainname resource representing the DNS zone for the specified domain DNS Records —...
Read next article
Presets
2 ready-to-deploy configurationsView presets →