DnsRecord

Provides a DigitalOcean DNS record resource.

Example Usage

using Pulumi;
using DigitalOcean = Pulumi.DigitalOcean;

class MyStack : Stack
{
    public MyStack()
    {
        var @default = new DigitalOcean.Domain("default", new DigitalOcean.DomainArgs
        {
            Name = "example.com",
        });
        // Add an A record to the domain for www.example.com.
        var www = new DigitalOcean.DnsRecord("www", new DigitalOcean.DnsRecordArgs
        {
            Domain = @default.Name,
            Type = "A",
            Value = "192.168.0.11",
        });
        // Add a MX record for the example.com domain itself.
        var mx = new DigitalOcean.DnsRecord("mx", new DigitalOcean.DnsRecordArgs
        {
            Domain = @default.Name,
            Type = "MX",
            Priority = 10,
            Value = "mail.example.com.",
        });
        this.WwwFqdn = www.Fqdn;
        this.MxFqdn = mx.Fqdn;
    }

    [Output("wwwFqdn")]
    public Output<string> WwwFqdn { get; set; }
    [Output("mxFqdn")]
    public Output<string> MxFqdn { get; set; }
}

Coming soon!

import pulumi
import pulumi_digitalocean as digitalocean

default = digitalocean.Domain("default", name="example.com")
# Add an A record to the domain for www.example.com.
www = digitalocean.DnsRecord("www",
    domain=default.name,
    type="A",
    value="192.168.0.11")
# Add a MX record for the example.com domain itself.
mx = digitalocean.DnsRecord("mx",
    domain=default.name,
    type="MX",
    priority=10,
    value="mail.example.com.")
pulumi.export("wwwFqdn", www.fqdn)
pulumi.export("mxFqdn", mx.fqdn)
import * as pulumi from "@pulumi/pulumi";
import * as digitalocean from "@pulumi/digitalocean";

const _default = new digitalocean.Domain("default", {name: "example.com"});
// Add an A record to the domain for www.example.com.
const www = new digitalocean.DnsRecord("www", {
    domain: _default.name,
    type: "A",
    value: "192.168.0.11",
});
// Add a MX record for the example.com domain itself.
const mx = new digitalocean.DnsRecord("mx", {
    domain: _default.name,
    type: "MX",
    priority: 10,
    value: "mail.example.com.",
});
export const wwwFqdn = www.fqdn;
export const mxFqdn = mx.fqdn;

Create a DnsRecord Resource

def DnsRecord(resource_name, opts=None, domain=None, flags=None, name=None, port=None, priority=None, tag=None, ttl=None, type=None, value=None, weight=None, __props__=None);
func NewDnsRecord(ctx *Context, name string, args DnsRecordArgs, opts ...ResourceOption) (*DnsRecord, error)
public DnsRecord(string name, DnsRecordArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args DnsRecordArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
opts ResourceOptions
A bag of options that control this resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args DnsRecordArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args DnsRecordArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

DnsRecord Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The DnsRecord resource accepts the following input properties:

Domain string

The domain to add the record to.

Type string

The type of record. Must be one of A, AAAA, CAA, CNAME, MX, NS, TXT, or SRV.

Value string

The value of the record.

Flags int

The flags of the record. Only valid when type is CAA. Must be between 0 and 255.

Name string

The name of the record. Use @ for records on domain’s name itself.

Port int

The port of the record. Only valid when type is SRV. Must be between 1 and 65535.

Priority int

The priority of the record. Only valid when type is MX or SRV. Must be between 0 and 65535.

Tag string

The tag of the record. Only valid when type is CAA. Must be one of issue, issuewild, or iodef.

Ttl int

The time to live for the record, in seconds. Must be at least 0.

Weight int

The weight of the record. Only valid when type is SRV. Must be between 0 and 65535.

Domain string

The domain to add the record to.

Type string

The type of record. Must be one of A, AAAA, CAA, CNAME, MX, NS, TXT, or SRV.

Value string

The value of the record.

Flags int

The flags of the record. Only valid when type is CAA. Must be between 0 and 255.

Name string

The name of the record. Use @ for records on domain’s name itself.

Port int

The port of the record. Only valid when type is SRV. Must be between 1 and 65535.

Priority int

The priority of the record. Only valid when type is MX or SRV. Must be between 0 and 65535.

Tag string

The tag of the record. Only valid when type is CAA. Must be one of issue, issuewild, or iodef.

Ttl int

The time to live for the record, in seconds. Must be at least 0.

Weight int

The weight of the record. Only valid when type is SRV. Must be between 0 and 65535.

domain string

The domain to add the record to.

type RecordType

The type of record. Must be one of A, AAAA, CAA, CNAME, MX, NS, TXT, or SRV.

value string

The value of the record.

flags number

The flags of the record. Only valid when type is CAA. Must be between 0 and 255.

name string

The name of the record. Use @ for records on domain’s name itself.

port number

The port of the record. Only valid when type is SRV. Must be between 1 and 65535.

priority number

The priority of the record. Only valid when type is MX or SRV. Must be between 0 and 65535.

tag string

The tag of the record. Only valid when type is CAA. Must be one of issue, issuewild, or iodef.

ttl number

The time to live for the record, in seconds. Must be at least 0.

weight number

The weight of the record. Only valid when type is SRV. Must be between 0 and 65535.

domain str

The domain to add the record to.

type str

The type of record. Must be one of A, AAAA, CAA, CNAME, MX, NS, TXT, or SRV.

value str

The value of the record.

flags float

The flags of the record. Only valid when type is CAA. Must be between 0 and 255.

name str

The name of the record. Use @ for records on domain’s name itself.

port float

The port of the record. Only valid when type is SRV. Must be between 1 and 65535.

priority float

The priority of the record. Only valid when type is MX or SRV. Must be between 0 and 65535.

tag str

The tag of the record. Only valid when type is CAA. Must be one of issue, issuewild, or iodef.

ttl float

The time to live for the record, in seconds. Must be at least 0.

weight float

The weight of the record. Only valid when type is SRV. Must be between 0 and 65535.

Outputs

All input properties are implicitly available as output properties. Additionally, the DnsRecord resource produces the following output properties:

Fqdn string

The FQDN of the record

Id string
The provider-assigned unique ID for this managed resource.
Fqdn string

The FQDN of the record

Id string
The provider-assigned unique ID for this managed resource.
fqdn string

The FQDN of the record

id string
The provider-assigned unique ID for this managed resource.
fqdn str

The FQDN of the record

id str
The provider-assigned unique ID for this managed resource.

Look up an Existing DnsRecord Resource

Get an existing DnsRecord resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: DnsRecordState, opts?: CustomResourceOptions): DnsRecord
static get(resource_name, id, opts=None, domain=None, flags=None, fqdn=None, name=None, port=None, priority=None, tag=None, ttl=None, type=None, value=None, weight=None, __props__=None);
func GetDnsRecord(ctx *Context, name string, id IDInput, state *DnsRecordState, opts ...ResourceOption) (*DnsRecord, error)
public static DnsRecord Get(string name, Input<string> id, DnsRecordState? state, CustomResourceOptions? opts = null)
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.

The following state arguments are supported:

Domain string

The domain to add the record to.

Flags int

The flags of the record. Only valid when type is CAA. Must be between 0 and 255.

Fqdn string

The FQDN of the record

Name string

The name of the record. Use @ for records on domain’s name itself.

Port int

The port of the record. Only valid when type is SRV. Must be between 1 and 65535.

Priority int

The priority of the record. Only valid when type is MX or SRV. Must be between 0 and 65535.

Tag string

The tag of the record. Only valid when type is CAA. Must be one of issue, issuewild, or iodef.

Ttl int

The time to live for the record, in seconds. Must be at least 0.

Type string

The type of record. Must be one of A, AAAA, CAA, CNAME, MX, NS, TXT, or SRV.

Value string

The value of the record.

Weight int

The weight of the record. Only valid when type is SRV. Must be between 0 and 65535.

Domain string

The domain to add the record to.

Flags int

The flags of the record. Only valid when type is CAA. Must be between 0 and 255.

Fqdn string

The FQDN of the record

Name string

The name of the record. Use @ for records on domain’s name itself.

Port int

The port of the record. Only valid when type is SRV. Must be between 1 and 65535.

Priority int

The priority of the record. Only valid when type is MX or SRV. Must be between 0 and 65535.

Tag string

The tag of the record. Only valid when type is CAA. Must be one of issue, issuewild, or iodef.

Ttl int

The time to live for the record, in seconds. Must be at least 0.

Type string

The type of record. Must be one of A, AAAA, CAA, CNAME, MX, NS, TXT, or SRV.

Value string

The value of the record.

Weight int

The weight of the record. Only valid when type is SRV. Must be between 0 and 65535.

domain string

The domain to add the record to.

flags number

The flags of the record. Only valid when type is CAA. Must be between 0 and 255.

fqdn string

The FQDN of the record

name string

The name of the record. Use @ for records on domain’s name itself.

port number

The port of the record. Only valid when type is SRV. Must be between 1 and 65535.

priority number

The priority of the record. Only valid when type is MX or SRV. Must be between 0 and 65535.

tag string

The tag of the record. Only valid when type is CAA. Must be one of issue, issuewild, or iodef.

ttl number

The time to live for the record, in seconds. Must be at least 0.

type RecordType

The type of record. Must be one of A, AAAA, CAA, CNAME, MX, NS, TXT, or SRV.

value string

The value of the record.

weight number

The weight of the record. Only valid when type is SRV. Must be between 0 and 65535.

domain str

The domain to add the record to.

flags float

The flags of the record. Only valid when type is CAA. Must be between 0 and 255.

fqdn str

The FQDN of the record

name str

The name of the record. Use @ for records on domain’s name itself.

port float

The port of the record. Only valid when type is SRV. Must be between 1 and 65535.

priority float

The priority of the record. Only valid when type is MX or SRV. Must be between 0 and 65535.

tag str

The tag of the record. Only valid when type is CAA. Must be one of issue, issuewild, or iodef.

ttl float

The time to live for the record, in seconds. Must be at least 0.

type str

The type of record. Must be one of A, AAAA, CAA, CNAME, MX, NS, TXT, or SRV.

value str

The value of the record.

weight float

The weight of the record. Only valid when type is SRV. Must be between 0 and 65535.

Package Details

Repository
https://github.com/pulumi/pulumi-digitalocean
License
Apache-2.0
Notes
This Pulumi package is based on the digitalocean Terraform Provider.