Ready to level-up your engineering skills? Join a Pulumi Workshop. Register Now

Record

Provides a Cloudflare record resource.

Example Usage

using Pulumi;
using Cloudflare = Pulumi.Cloudflare;

class MyStack : Stack
{
    public MyStack()
    {
        // Add a record to the domain
        var foobar = new Cloudflare.Record("foobar", new Cloudflare.RecordArgs
        {
            ZoneId = @var.Cloudflare_zone_id,
            Name = "terraform",
            Value = "192.168.0.11",
            Type = "A",
            Ttl = 3600,
        });
        // Add a record requiring a data map
        var _sipTls = new Cloudflare.Record("_sipTls", new Cloudflare.RecordArgs
        {
            ZoneId = @var.Cloudflare_zone_id,
            Name = "_sip._tls",
            Type = "SRV",
            Data = new Cloudflare.Inputs.RecordDataArgs
            {
                Service = "_sip",
                Proto = "_tls",
                Name = "terraform-srv",
                Priority = 0,
                Weight = 0,
                Port = 443,
                Target = "example.com",
            },
        });
    }

}
package main

import (
    "github.com/pulumi/pulumi-cloudflare/sdk/v2/go/cloudflare"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        _, err := cloudflare.NewRecord(ctx, "foobar", &cloudflare.RecordArgs{
            ZoneId: pulumi.Any(_var.Cloudflare_zone_id),
            Name:   pulumi.String("terraform"),
            Value:  pulumi.String("192.168.0.11"),
            Type:   pulumi.String("A"),
            Ttl:    pulumi.Int(3600),
        })
        if err != nil {
            return err
        }
        _, err = cloudflare.NewRecord(ctx, "_sipTls", &cloudflare.RecordArgs{
            ZoneId: pulumi.Any(_var.Cloudflare_zone_id),
            Name:   pulumi.String("_sip._tls"),
            Type:   pulumi.String("SRV"),
            Data: &cloudflare.RecordDataArgs{
                Service:  pulumi.String("_sip"),
                Proto:    pulumi.String("_tls"),
                Name:     pulumi.String("terraform-srv"),
                Priority: pulumi.Int(0),
                Weight:   pulumi.Int(0),
                Port:     pulumi.Int(443),
                Target:   pulumi.String("example.com"),
            },
        })
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_cloudflare as cloudflare

# Add a record to the domain
foobar = cloudflare.Record("foobar",
    zone_id=var["cloudflare_zone_id"],
    name="terraform",
    value="192.168.0.11",
    type="A",
    ttl=3600)
# Add a record requiring a data map
_sip_tls = cloudflare.Record("_sipTls",
    zone_id=var["cloudflare_zone_id"],
    name="_sip._tls",
    type="SRV",
    data=cloudflare.RecordDataArgs(
        service="_sip",
        proto="_tls",
        name="terraform-srv",
        priority=0,
        weight=0,
        port=443,
        target="example.com",
    ))
import * as pulumi from "@pulumi/pulumi";
import * as cloudflare from "@pulumi/cloudflare";

// Add a record to the domain
const foobar = new cloudflare.Record("foobar", {
    zoneId: _var.cloudflare_zone_id,
    name: "terraform",
    value: "192.168.0.11",
    type: "A",
    ttl: 3600,
});
// Add a record requiring a data map
const _sipTls = new cloudflare.Record("_sipTls", {
    zoneId: _var.cloudflare_zone_id,
    name: "_sip._tls",
    type: "SRV",
    data: {
        service: "_sip",
        proto: "_tls",
        name: "terraform-srv",
        priority: 0,
        weight: 0,
        port: 443,
        target: "example.com",
    },
});

Create a Record Resource

new Record(name: string, args: RecordArgs, opts?: CustomResourceOptions);
def Record(resource_name: str, opts: Optional[ResourceOptions] = None, data: Optional[RecordDataArgs] = None, name: Optional[str] = None, priority: Optional[int] = None, proxied: Optional[bool] = None, ttl: Optional[int] = None, type: Optional[str] = None, value: Optional[str] = None, zone_id: Optional[str] = None)
func NewRecord(ctx *Context, name string, args RecordArgs, opts ...ResourceOption) (*Record, error)
public Record(string name, RecordArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args RecordArgs
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 RecordArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args RecordArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

Record Resource Properties

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

Inputs

The Record resource accepts the following input properties:

Name string

The name of the record

Type string

The type of the record

ZoneId string

The DNS zone ID to add the record to

Data RecordDataArgs

Map of attributes that constitute the record value. Primarily used for LOC and SRV record types. Either this or value must be specified

Priority int

The priority of the record

Proxied bool

Whether the record gets Cloudflare’s origin protection; defaults to false.

Ttl int

The TTL of the record (automatic: ‘1’)

Value string

The (string) value of the record. Either this or data must be specified

Name string

The name of the record

Type string

The type of the record

ZoneId string

The DNS zone ID to add the record to

Data RecordData

Map of attributes that constitute the record value. Primarily used for LOC and SRV record types. Either this or value must be specified

Priority int

The priority of the record

Proxied bool

Whether the record gets Cloudflare’s origin protection; defaults to false.

Ttl int

The TTL of the record (automatic: ‘1’)

Value string

The (string) value of the record. Either this or data must be specified

name string

The name of the record

type string

The type of the record

zoneId string

The DNS zone ID to add the record to

data RecordData

Map of attributes that constitute the record value. Primarily used for LOC and SRV record types. Either this or value must be specified

priority number

The priority of the record

proxied boolean

Whether the record gets Cloudflare’s origin protection; defaults to false.

ttl number

The TTL of the record (automatic: ‘1’)

value string

The (string) value of the record. Either this or data must be specified

name str

The name of the record

type str

The type of the record

zone_id str

The DNS zone ID to add the record to

data RecordDataArgs

Map of attributes that constitute the record value. Primarily used for LOC and SRV record types. Either this or value must be specified

priority int

The priority of the record

proxied bool

Whether the record gets Cloudflare’s origin protection; defaults to false.

ttl int

The TTL of the record (automatic: ‘1’)

value str

The (string) value of the record. Either this or data must be specified

Outputs

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

CreatedOn string

The RFC3339 timestamp of when the record was created

Hostname string

The FQDN of the record

Id string
The provider-assigned unique ID for this managed resource.
Metadata Dictionary<string, object>

A key-value map of string metadata Cloudflare associates with the record

ModifiedOn string

The RFC3339 timestamp of when the record was last modified

Proxiable bool

Shows whether this record can be proxied, must be true if setting proxied=true

CreatedOn string

The RFC3339 timestamp of when the record was created

Hostname string

The FQDN of the record

Id string
The provider-assigned unique ID for this managed resource.
Metadata map[string]interface{}

A key-value map of string metadata Cloudflare associates with the record

ModifiedOn string

The RFC3339 timestamp of when the record was last modified

Proxiable bool

Shows whether this record can be proxied, must be true if setting proxied=true

createdOn string

The RFC3339 timestamp of when the record was created

hostname string

The FQDN of the record

id string
The provider-assigned unique ID for this managed resource.
metadata {[key: string]: any}

A key-value map of string metadata Cloudflare associates with the record

modifiedOn string

The RFC3339 timestamp of when the record was last modified

proxiable boolean

Shows whether this record can be proxied, must be true if setting proxied=true

created_on str

The RFC3339 timestamp of when the record was created

hostname str

The FQDN of the record

id str
The provider-assigned unique ID for this managed resource.
metadata Mapping[str, Any]

A key-value map of string metadata Cloudflare associates with the record

modified_on str

The RFC3339 timestamp of when the record was last modified

proxiable bool

Shows whether this record can be proxied, must be true if setting proxied=true

Look up an Existing Record Resource

Get an existing Record 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?: RecordState, opts?: CustomResourceOptions): Record
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, created_on: Optional[str] = None, data: Optional[RecordDataArgs] = None, hostname: Optional[str] = None, metadata: Optional[Mapping[str, Any]] = None, modified_on: Optional[str] = None, name: Optional[str] = None, priority: Optional[int] = None, proxiable: Optional[bool] = None, proxied: Optional[bool] = None, ttl: Optional[int] = None, type: Optional[str] = None, value: Optional[str] = None, zone_id: Optional[str] = None) -> Record
func GetRecord(ctx *Context, name string, id IDInput, state *RecordState, opts ...ResourceOption) (*Record, error)
public static Record Get(string name, Input<string> id, RecordState? 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:

CreatedOn string

The RFC3339 timestamp of when the record was created

Data RecordDataArgs

Map of attributes that constitute the record value. Primarily used for LOC and SRV record types. Either this or value must be specified

Hostname string

The FQDN of the record

Metadata Dictionary<string, object>

A key-value map of string metadata Cloudflare associates with the record

ModifiedOn string

The RFC3339 timestamp of when the record was last modified

Name string

The name of the record

Priority int

The priority of the record

Proxiable bool

Shows whether this record can be proxied, must be true if setting proxied=true

Proxied bool

Whether the record gets Cloudflare’s origin protection; defaults to false.

Ttl int

The TTL of the record (automatic: ‘1’)

Type string

The type of the record

Value string

The (string) value of the record. Either this or data must be specified

ZoneId string

The DNS zone ID to add the record to

CreatedOn string

The RFC3339 timestamp of when the record was created

Data RecordData

Map of attributes that constitute the record value. Primarily used for LOC and SRV record types. Either this or value must be specified

Hostname string

The FQDN of the record

Metadata map[string]interface{}

A key-value map of string metadata Cloudflare associates with the record

ModifiedOn string

The RFC3339 timestamp of when the record was last modified

Name string

The name of the record

Priority int

The priority of the record

Proxiable bool

Shows whether this record can be proxied, must be true if setting proxied=true

Proxied bool

Whether the record gets Cloudflare’s origin protection; defaults to false.

Ttl int

The TTL of the record (automatic: ‘1’)

Type string

The type of the record

Value string

The (string) value of the record. Either this or data must be specified

ZoneId string

The DNS zone ID to add the record to

createdOn string

The RFC3339 timestamp of when the record was created

data RecordData

Map of attributes that constitute the record value. Primarily used for LOC and SRV record types. Either this or value must be specified

hostname string

The FQDN of the record

metadata {[key: string]: any}

A key-value map of string metadata Cloudflare associates with the record

modifiedOn string

The RFC3339 timestamp of when the record was last modified

name string

The name of the record

priority number

The priority of the record

proxiable boolean

Shows whether this record can be proxied, must be true if setting proxied=true

proxied boolean

Whether the record gets Cloudflare’s origin protection; defaults to false.

ttl number

The TTL of the record (automatic: ‘1’)

type string

The type of the record

value string

The (string) value of the record. Either this or data must be specified

zoneId string

The DNS zone ID to add the record to

created_on str

The RFC3339 timestamp of when the record was created

data RecordDataArgs

Map of attributes that constitute the record value. Primarily used for LOC and SRV record types. Either this or value must be specified

hostname str

The FQDN of the record

metadata Mapping[str, Any]

A key-value map of string metadata Cloudflare associates with the record

modified_on str

The RFC3339 timestamp of when the record was last modified

name str

The name of the record

priority int

The priority of the record

proxiable bool

Shows whether this record can be proxied, must be true if setting proxied=true

proxied bool

Whether the record gets Cloudflare’s origin protection; defaults to false.

ttl int

The TTL of the record (automatic: ‘1’)

type str

The type of the record

value str

The (string) value of the record. Either this or data must be specified

zone_id str

The DNS zone ID to add the record to

Supporting Types

RecordData

Algorithm int
Altitude double
Certificate string
Content string
Digest string
DigestType int
Fingerprint string
Flags string
KeyTag int
LatDegrees int
LatDirection string
LatMinutes int
LatSeconds double
LongDegrees int
LongDirection string
LongMinutes int
LongSeconds double
MatchingType int
Name string

The name of the record

Order int
Port int
PrecisionHorz double
PrecisionVert double
Preference int
Priority int

The priority of the record

Proto string
Protocol int
PublicKey string
Regex string
Replacement string
Selector int
Service string
Size double
Tag string
Target string
Type int

The type of the record

Usage int
Value string

The (string) value of the record. Either this or data must be specified

Weight int
Algorithm int
Altitude float64
Certificate string
Content string
Digest string
DigestType int
Fingerprint string
Flags string
KeyTag int
LatDegrees int
LatDirection string
LatMinutes int
LatSeconds float64
LongDegrees int
LongDirection string
LongMinutes int
LongSeconds float64
MatchingType int
Name string

The name of the record

Order int
Port int
PrecisionHorz float64
PrecisionVert float64
Preference int
Priority int

The priority of the record

Proto string
Protocol int
PublicKey string
Regex string
Replacement string
Selector int
Service string
Size float64
Tag string
Target string
Type int

The type of the record

Usage int
Value string

The (string) value of the record. Either this or data must be specified

Weight int
algorithm number
altitude number
certificate string
content string
digest string
digestType number
fingerprint string
flags string
keyTag number
latDegrees number
latDirection string
latMinutes number
latSeconds number
longDegrees number
longDirection string
longMinutes number
longSeconds number
matchingType number
name string

The name of the record

order number
port number
precisionHorz number
precisionVert number
preference number
priority number

The priority of the record

proto string
protocol number
publicKey string
regex string
replacement string
selector number
service string
size number
tag string
target string
type number

The type of the record

usage number
value string

The (string) value of the record. Either this or data must be specified

weight number
algorithm int
altitude float
certificate str
content str
digest str
digest_type int
fingerprint str
flags str
key_tag int
lat_degrees int
lat_direction str
lat_minutes int
lat_seconds float
long_degrees int
long_direction str
long_minutes int
long_seconds float
matching_type int
name str

The name of the record

order int
port int
precision_horz float
precision_vert float
preference int
priority int

The priority of the record

proto str
protocol int
public_key str
regex str
replacement str
selector int
service str
size float
tag str
target str
type int

The type of the record

usage int
value str

The (string) value of the record. Either this or data must be specified

weight int

Import

Records can be imported using a composite ID formed of zone ID and record ID, e.g.

 $ pulumi import cloudflare:index/record:Record default ae36f999674d196762efcc5abb06b345/d41d8cd98f00b204e9800998ecf8427e

where* ae36f999674d196762efcc5abb06b345 - the zone ID * d41d8cd98f00b204e9800998ecf8427e - record ID as returned by API

Package Details

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