1. Packages
  2. Infoblox Provider
  3. API Docs
  4. CnameRecord
infoblox 2.10.0 published on Friday, Apr 25, 2025 by infobloxopen

infoblox.CnameRecord

Explore with Pulumi AI

# CNAME-record Resource

A CNAME-record maps one domain name to another (canonical) one. The infoblox.CnameRecord resource allows managing such domain name mappings in a NIOS server for CNAME records.

The following list describes the parameters you can define in the infoblox.CnameRecord resource block:

  • alias: required, specifies the alias name in the FQDN format. Example: alias1.example.com.
  • canonical: required, specifies the canonical name in the FQDN format. Example: main.example.com.
  • ttl: optional, specifies the “time to live” value for the CNAME-record. There is no default value for this parameter. If a value is not specified, then in NIOS, the value is inherited from the parent zone of the DNS record for this resource. A TTL value of 0 (zero) means caching should be disabled for this record. Example: 3600.
  • dns_view: optional, specifies the DNS view in which the zone exists. If a value is not specified, the name default is set as the DNS view. Example: dns_view_1.
  • comment: optional, describes the CNAME-record. Example: an example CNAME-record.
  • ext_attrs: optional, specifies the set of NIOS extensible attributes that are attached to the CNAME-record. Example: jsonencode({}).

Example of a CNAME-record Resource

import * as pulumi from "@pulumi/pulumi";
import * as infoblox from "@pulumi/infoblox";

// CNAME-record, minimal set of parameters
const cnameRec1 = new infoblox.CnameRecord("cnameRec1", {
    canonical: "bla-bla-bla.somewhere.in.the.net",
    alias: "hq-server.example1.org",
});
// CNAME-record, full set of parameters
const cnameRec2 = new infoblox.CnameRecord("cnameRec2", {
    dnsView: "default.nondefault_netview",
    canonical: "strange-place.somewhere.in.the.net",
    alias: "alarm-server.example3.org",
    comment: "we need to keep an eye on this strange host",
    ttl: 0,
    extAttrs: JSON.stringify({
        Site: "unknown",
        Location: "TBD",
    }),
});
Copy
import pulumi
import json
import pulumi_infoblox as infoblox

# CNAME-record, minimal set of parameters
cname_rec1 = infoblox.CnameRecord("cnameRec1",
    canonical="bla-bla-bla.somewhere.in.the.net",
    alias="hq-server.example1.org")
# CNAME-record, full set of parameters
cname_rec2 = infoblox.CnameRecord("cnameRec2",
    dns_view="default.nondefault_netview",
    canonical="strange-place.somewhere.in.the.net",
    alias="alarm-server.example3.org",
    comment="we need to keep an eye on this strange host",
    ttl=0,
    ext_attrs=json.dumps({
        "Site": "unknown",
        "Location": "TBD",
    }))
Copy
package main

import (
	"encoding/json"

	"github.com/pulumi/pulumi-terraform-provider/sdks/go/infoblox/v2/infoblox"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// CNAME-record, minimal set of parameters
		_, err := infoblox.NewCnameRecord(ctx, "cnameRec1", &infoblox.CnameRecordArgs{
			Canonical: pulumi.String("bla-bla-bla.somewhere.in.the.net"),
			Alias:     pulumi.String("hq-server.example1.org"),
		})
		if err != nil {
			return err
		}
		tmpJSON0, err := json.Marshal(map[string]interface{}{
			"Site":     "unknown",
			"Location": "TBD",
		})
		if err != nil {
			return err
		}
		json0 := string(tmpJSON0)
		// CNAME-record, full set of parameters
		_, err = infoblox.NewCnameRecord(ctx, "cnameRec2", &infoblox.CnameRecordArgs{
			DnsView:   pulumi.String("default.nondefault_netview"),
			Canonical: pulumi.String("strange-place.somewhere.in.the.net"),
			Alias:     pulumi.String("alarm-server.example3.org"),
			Comment:   pulumi.String("we need to keep an eye on this strange host"),
			Ttl:       pulumi.Float64(0),
			ExtAttrs:  pulumi.String(json0),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Pulumi;
using Infoblox = Pulumi.Infoblox;

return await Deployment.RunAsync(() => 
{
    // CNAME-record, minimal set of parameters
    var cnameRec1 = new Infoblox.CnameRecord("cnameRec1", new()
    {
        Canonical = "bla-bla-bla.somewhere.in.the.net",
        Alias = "hq-server.example1.org",
    });

    // CNAME-record, full set of parameters
    var cnameRec2 = new Infoblox.CnameRecord("cnameRec2", new()
    {
        DnsView = "default.nondefault_netview",
        Canonical = "strange-place.somewhere.in.the.net",
        Alias = "alarm-server.example3.org",
        Comment = "we need to keep an eye on this strange host",
        Ttl = 0,
        ExtAttrs = JsonSerializer.Serialize(new Dictionary<string, object?>
        {
            ["Site"] = "unknown",
            ["Location"] = "TBD",
        }),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.infoblox.CnameRecord;
import com.pulumi.infoblox.CnameRecordArgs;
import static com.pulumi.codegen.internal.Serialization.*;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        // CNAME-record, minimal set of parameters
        var cnameRec1 = new CnameRecord("cnameRec1", CnameRecordArgs.builder()
            .canonical("bla-bla-bla.somewhere.in.the.net")
            .alias("hq-server.example1.org")
            .build());

        // CNAME-record, full set of parameters
        var cnameRec2 = new CnameRecord("cnameRec2", CnameRecordArgs.builder()
            .dnsView("default.nondefault_netview")
            .canonical("strange-place.somewhere.in.the.net")
            .alias("alarm-server.example3.org")
            .comment("we need to keep an eye on this strange host")
            .ttl(0)
            .extAttrs(serializeJson(
                jsonObject(
                    jsonProperty("Site", "unknown"),
                    jsonProperty("Location", "TBD")
                )))
            .build());

    }
}
Copy
resources:
  # CNAME-record, minimal set of parameters
  cnameRec1:
    type: infoblox:CnameRecord
    properties:
      canonical: bla-bla-bla.somewhere.in.the.net
      alias: hq-server.example1.org
  # CNAME-record, full set of parameters
  cnameRec2:
    type: infoblox:CnameRecord
    properties:
      dnsView: default.nondefault_netview
      canonical: strange-place.somewhere.in.the.net
      alias: alarm-server.example3.org
      comment: we need to keep an eye on this strange host
      ttl: 0
      # disable caching
      extAttrs:
        fn::toJSON:
          Site: unknown
          Location: TBD
Copy

Create CnameRecord Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new CnameRecord(name: string, args: CnameRecordArgs, opts?: CustomResourceOptions);
@overload
def CnameRecord(resource_name: str,
                args: CnameRecordArgs,
                opts: Optional[ResourceOptions] = None)

@overload
def CnameRecord(resource_name: str,
                opts: Optional[ResourceOptions] = None,
                alias: Optional[str] = None,
                canonical: Optional[str] = None,
                cname_record_id: Optional[str] = None,
                comment: Optional[str] = None,
                dns_view: Optional[str] = None,
                ext_attrs: Optional[str] = None,
                ttl: Optional[float] = None)
func NewCnameRecord(ctx *Context, name string, args CnameRecordArgs, opts ...ResourceOption) (*CnameRecord, error)
public CnameRecord(string name, CnameRecordArgs args, CustomResourceOptions? opts = null)
public CnameRecord(String name, CnameRecordArgs args)
public CnameRecord(String name, CnameRecordArgs args, CustomResourceOptions options)
type: infoblox:CnameRecord
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. CnameRecordArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. CnameRecordArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. CnameRecordArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. CnameRecordArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. CnameRecordArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var cnameRecordResource = new Infoblox.CnameRecord("cnameRecordResource", new()
{
    Alias = "string",
    Canonical = "string",
    CnameRecordId = "string",
    Comment = "string",
    DnsView = "string",
    ExtAttrs = "string",
    Ttl = 0,
});
Copy
example, err := infoblox.NewCnameRecord(ctx, "cnameRecordResource", &infoblox.CnameRecordArgs{
	Alias:         pulumi.String("string"),
	Canonical:     pulumi.String("string"),
	CnameRecordId: pulumi.String("string"),
	Comment:       pulumi.String("string"),
	DnsView:       pulumi.String("string"),
	ExtAttrs:      pulumi.String("string"),
	Ttl:           pulumi.Float64(0),
})
Copy
var cnameRecordResource = new CnameRecord("cnameRecordResource", CnameRecordArgs.builder()
    .alias("string")
    .canonical("string")
    .cnameRecordId("string")
    .comment("string")
    .dnsView("string")
    .extAttrs("string")
    .ttl(0)
    .build());
Copy
cname_record_resource = infoblox.CnameRecord("cnameRecordResource",
    alias="string",
    canonical="string",
    cname_record_id="string",
    comment="string",
    dns_view="string",
    ext_attrs="string",
    ttl=0)
Copy
const cnameRecordResource = new infoblox.CnameRecord("cnameRecordResource", {
    alias: "string",
    canonical: "string",
    cnameRecordId: "string",
    comment: "string",
    dnsView: "string",
    extAttrs: "string",
    ttl: 0,
});
Copy
type: infoblox:CnameRecord
properties:
    alias: string
    canonical: string
    cnameRecordId: string
    comment: string
    dnsView: string
    extAttrs: string
    ttl: 0
Copy

CnameRecord Resource Properties

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

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The CnameRecord resource accepts the following input properties:

Alias This property is required. string
The alias name in FQDN format.
Canonical This property is required. string
The Canonical name in FQDN format.
CnameRecordId string
Comment string
A description about CNAME record.
DnsView string
Dns View under which the zone has been created.
ExtAttrs string
The Extensible attributes of CNAME record, as a map in JSON format
Ttl double
TTL attribute value for the record.
Alias This property is required. string
The alias name in FQDN format.
Canonical This property is required. string
The Canonical name in FQDN format.
CnameRecordId string
Comment string
A description about CNAME record.
DnsView string
Dns View under which the zone has been created.
ExtAttrs string
The Extensible attributes of CNAME record, as a map in JSON format
Ttl float64
TTL attribute value for the record.
alias This property is required. String
The alias name in FQDN format.
canonical This property is required. String
The Canonical name in FQDN format.
cnameRecordId String
comment String
A description about CNAME record.
dnsView String
Dns View under which the zone has been created.
extAttrs String
The Extensible attributes of CNAME record, as a map in JSON format
ttl Double
TTL attribute value for the record.
alias This property is required. string
The alias name in FQDN format.
canonical This property is required. string
The Canonical name in FQDN format.
cnameRecordId string
comment string
A description about CNAME record.
dnsView string
Dns View under which the zone has been created.
extAttrs string
The Extensible attributes of CNAME record, as a map in JSON format
ttl number
TTL attribute value for the record.
alias This property is required. str
The alias name in FQDN format.
canonical This property is required. str
The Canonical name in FQDN format.
cname_record_id str
comment str
A description about CNAME record.
dns_view str
Dns View under which the zone has been created.
ext_attrs str
The Extensible attributes of CNAME record, as a map in JSON format
ttl float
TTL attribute value for the record.
alias This property is required. String
The alias name in FQDN format.
canonical This property is required. String
The Canonical name in FQDN format.
cnameRecordId String
comment String
A description about CNAME record.
dnsView String
Dns View under which the zone has been created.
extAttrs String
The Extensible attributes of CNAME record, as a map in JSON format
ttl Number
TTL attribute value for the record.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
InternalId string
Ref string
NIOS object's reference, not to be set by a user.
Id string
The provider-assigned unique ID for this managed resource.
InternalId string
Ref string
NIOS object's reference, not to be set by a user.
id String
The provider-assigned unique ID for this managed resource.
internalId String
ref String
NIOS object's reference, not to be set by a user.
id string
The provider-assigned unique ID for this managed resource.
internalId string
ref string
NIOS object's reference, not to be set by a user.
id str
The provider-assigned unique ID for this managed resource.
internal_id str
ref str
NIOS object's reference, not to be set by a user.
id String
The provider-assigned unique ID for this managed resource.
internalId String
ref String
NIOS object's reference, not to be set by a user.

Look up Existing CnameRecord Resource

Get an existing CnameRecord 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?: CnameRecordState, opts?: CustomResourceOptions): CnameRecord
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        alias: Optional[str] = None,
        canonical: Optional[str] = None,
        cname_record_id: Optional[str] = None,
        comment: Optional[str] = None,
        dns_view: Optional[str] = None,
        ext_attrs: Optional[str] = None,
        internal_id: Optional[str] = None,
        ref: Optional[str] = None,
        ttl: Optional[float] = None) -> CnameRecord
func GetCnameRecord(ctx *Context, name string, id IDInput, state *CnameRecordState, opts ...ResourceOption) (*CnameRecord, error)
public static CnameRecord Get(string name, Input<string> id, CnameRecordState? state, CustomResourceOptions? opts = null)
public static CnameRecord get(String name, Output<String> id, CnameRecordState state, CustomResourceOptions options)
resources:  _:    type: infoblox:CnameRecord    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Alias string
The alias name in FQDN format.
Canonical string
The Canonical name in FQDN format.
CnameRecordId string
Comment string
A description about CNAME record.
DnsView string
Dns View under which the zone has been created.
ExtAttrs string
The Extensible attributes of CNAME record, as a map in JSON format
InternalId string
Ref string
NIOS object's reference, not to be set by a user.
Ttl double
TTL attribute value for the record.
Alias string
The alias name in FQDN format.
Canonical string
The Canonical name in FQDN format.
CnameRecordId string
Comment string
A description about CNAME record.
DnsView string
Dns View under which the zone has been created.
ExtAttrs string
The Extensible attributes of CNAME record, as a map in JSON format
InternalId string
Ref string
NIOS object's reference, not to be set by a user.
Ttl float64
TTL attribute value for the record.
alias String
The alias name in FQDN format.
canonical String
The Canonical name in FQDN format.
cnameRecordId String
comment String
A description about CNAME record.
dnsView String
Dns View under which the zone has been created.
extAttrs String
The Extensible attributes of CNAME record, as a map in JSON format
internalId String
ref String
NIOS object's reference, not to be set by a user.
ttl Double
TTL attribute value for the record.
alias string
The alias name in FQDN format.
canonical string
The Canonical name in FQDN format.
cnameRecordId string
comment string
A description about CNAME record.
dnsView string
Dns View under which the zone has been created.
extAttrs string
The Extensible attributes of CNAME record, as a map in JSON format
internalId string
ref string
NIOS object's reference, not to be set by a user.
ttl number
TTL attribute value for the record.
alias str
The alias name in FQDN format.
canonical str
The Canonical name in FQDN format.
cname_record_id str
comment str
A description about CNAME record.
dns_view str
Dns View under which the zone has been created.
ext_attrs str
The Extensible attributes of CNAME record, as a map in JSON format
internal_id str
ref str
NIOS object's reference, not to be set by a user.
ttl float
TTL attribute value for the record.
alias String
The alias name in FQDN format.
canonical String
The Canonical name in FQDN format.
cnameRecordId String
comment String
A description about CNAME record.
dnsView String
Dns View under which the zone has been created.
extAttrs String
The Extensible attributes of CNAME record, as a map in JSON format
internalId String
ref String
NIOS object's reference, not to be set by a user.
ttl Number
TTL attribute value for the record.

Package Details

Repository
infoblox infobloxopen/terraform-provider-infoblox
License
Notes
This Pulumi package is based on the infoblox Terraform Provider.