1. Packages
  2. Ionoscloud Provider
  3. API Docs
  4. DnsRecord
ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud

ionoscloud.DnsRecord

Explore with Pulumi AI

ionoscloud logo
ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud

    Manages a DNS Record.

    ⚠️ Only tokens are accepted for authorization in the ionoscloud_dns_record resource. Please ensure you are using tokens as other methods will not be valid.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = new ionoscloud.DnsZone("example", {
        description: "description",
        enabled: false,
    });
    const recordexample = new ionoscloud.DnsRecord("recordexample", {
        zoneId: example.dnsZoneId,
        type: "CNAME",
        content: "1.2.3.4",
        ttl: 2000,
        priority: 1024,
        enabled: false,
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.DnsZone("example",
        description="description",
        enabled=False)
    recordexample = ionoscloud.DnsRecord("recordexample",
        zone_id=example.dns_zone_id,
        type="CNAME",
        content="1.2.3.4",
        ttl=2000,
        priority=1024,
        enabled=False)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := ionoscloud.NewDnsZone(ctx, "example", &ionoscloud.DnsZoneArgs{
    			Description: pulumi.String("description"),
    			Enabled:     pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = ionoscloud.NewDnsRecord(ctx, "recordexample", &ionoscloud.DnsRecordArgs{
    			ZoneId:   example.DnsZoneId,
    			Type:     pulumi.String("CNAME"),
    			Content:  pulumi.String("1.2.3.4"),
    			Ttl:      pulumi.Float64(2000),
    			Priority: pulumi.Float64(1024),
    			Enabled:  pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Ionoscloud.DnsZone("example", new()
        {
            Description = "description",
            Enabled = false,
        });
    
        var recordexample = new Ionoscloud.DnsRecord("recordexample", new()
        {
            ZoneId = example.DnsZoneId,
            Type = "CNAME",
            Content = "1.2.3.4",
            Ttl = 2000,
            Priority = 1024,
            Enabled = false,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.DnsZone;
    import com.pulumi.ionoscloud.DnsZoneArgs;
    import com.pulumi.ionoscloud.DnsRecord;
    import com.pulumi.ionoscloud.DnsRecordArgs;
    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) {
            var example = new DnsZone("example", DnsZoneArgs.builder()
                .description("description")
                .enabled(false)
                .build());
    
            var recordexample = new DnsRecord("recordexample", DnsRecordArgs.builder()
                .zoneId(example.dnsZoneId())
                .type("CNAME")
                .content("1.2.3.4")
                .ttl(2000)
                .priority(1024)
                .enabled(false)
                .build());
    
        }
    }
    
    resources:
      example:
        type: ionoscloud:DnsZone
        properties:
          description: description
          enabled: false
      recordexample:
        type: ionoscloud:DnsRecord
        properties:
          zoneId: ${example.dnsZoneId}
          type: CNAME
          content: 1.2.3.4
          ttl: 2000
          priority: 1024
          enabled: false
    

    Create DnsRecord Resource

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

    Constructor syntax

    new DnsRecord(name: string, args: DnsRecordArgs, opts?: CustomResourceOptions);
    @overload
    def DnsRecord(resource_name: str,
                  args: DnsRecordArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def DnsRecord(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  content: Optional[str] = None,
                  type: Optional[str] = None,
                  zone_id: Optional[str] = None,
                  dns_record_id: Optional[str] = None,
                  enabled: Optional[bool] = None,
                  name: Optional[str] = None,
                  priority: Optional[float] = None,
                  timeouts: Optional[DnsRecordTimeoutsArgs] = None,
                  ttl: Optional[float] = None)
    func NewDnsRecord(ctx *Context, name string, args DnsRecordArgs, opts ...ResourceOption) (*DnsRecord, error)
    public DnsRecord(string name, DnsRecordArgs args, CustomResourceOptions? opts = null)
    public DnsRecord(String name, DnsRecordArgs args)
    public DnsRecord(String name, DnsRecordArgs args, CustomResourceOptions options)
    
    type: ionoscloud:DnsRecord
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    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.
    args DnsRecordArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control 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.
    name String
    The unique name of the resource.
    args DnsRecordArgs
    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 dnsRecordResource = new Ionoscloud.DnsRecord("dnsRecordResource", new()
    {
        Content = "string",
        Type = "string",
        ZoneId = "string",
        DnsRecordId = "string",
        Enabled = false,
        Name = "string",
        Priority = 0,
        Timeouts = new Ionoscloud.Inputs.DnsRecordTimeoutsArgs
        {
            Create = "string",
            Default = "string",
            Delete = "string",
            Update = "string",
        },
        Ttl = 0,
    });
    
    example, err := ionoscloud.NewDnsRecord(ctx, "dnsRecordResource", &ionoscloud.DnsRecordArgs{
    	Content:     pulumi.String("string"),
    	Type:        pulumi.String("string"),
    	ZoneId:      pulumi.String("string"),
    	DnsRecordId: pulumi.String("string"),
    	Enabled:     pulumi.Bool(false),
    	Name:        pulumi.String("string"),
    	Priority:    pulumi.Float64(0),
    	Timeouts: &ionoscloud.DnsRecordTimeoutsArgs{
    		Create:  pulumi.String("string"),
    		Default: pulumi.String("string"),
    		Delete:  pulumi.String("string"),
    		Update:  pulumi.String("string"),
    	},
    	Ttl: pulumi.Float64(0),
    })
    
    var dnsRecordResource = new DnsRecord("dnsRecordResource", DnsRecordArgs.builder()
        .content("string")
        .type("string")
        .zoneId("string")
        .dnsRecordId("string")
        .enabled(false)
        .name("string")
        .priority(0)
        .timeouts(DnsRecordTimeoutsArgs.builder()
            .create("string")
            .default_("string")
            .delete("string")
            .update("string")
            .build())
        .ttl(0)
        .build());
    
    dns_record_resource = ionoscloud.DnsRecord("dnsRecordResource",
        content="string",
        type="string",
        zone_id="string",
        dns_record_id="string",
        enabled=False,
        name="string",
        priority=0,
        timeouts={
            "create": "string",
            "default": "string",
            "delete": "string",
            "update": "string",
        },
        ttl=0)
    
    const dnsRecordResource = new ionoscloud.DnsRecord("dnsRecordResource", {
        content: "string",
        type: "string",
        zoneId: "string",
        dnsRecordId: "string",
        enabled: false,
        name: "string",
        priority: 0,
        timeouts: {
            create: "string",
            "default": "string",
            "delete": "string",
            update: "string",
        },
        ttl: 0,
    });
    
    type: ionoscloud:DnsRecord
    properties:
        content: string
        dnsRecordId: string
        enabled: false
        name: string
        priority: 0
        timeouts:
            create: string
            default: string
            delete: string
            update: string
        ttl: 0
        type: string
        zoneId: string
    

    DnsRecord 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 DnsRecord resource accepts the following input properties:

    Content string
    [string] The content of the DNS Record.
    Type string
    [string] The type of the DNS Record, can have one of these values: A, AAAA, CNAME, ALIAS, MX, NS, SRV, TXT, CAA, SSHFP, TLSA, SMIMEA, DS, HTTPS, SVCB, OPENPGPKEY, CERT, URI, RP, LOC. More details about types can be found here.
    ZoneId string
    [string] The DNS Zone ID in which the DNS Record will be created.
    DnsRecordId string
    Enabled bool
    [bool] Indicates if the DNS Record is active or not. Default is true.
    Name string
    [string] The name of the DNS Record.
    Priority double
    [int] The priority for the DNS Record.
    Timeouts DnsRecordTimeouts
    Ttl double
    [int] Time to live for the DNS Record. Default is 3600.
    Content string
    [string] The content of the DNS Record.
    Type string
    [string] The type of the DNS Record, can have one of these values: A, AAAA, CNAME, ALIAS, MX, NS, SRV, TXT, CAA, SSHFP, TLSA, SMIMEA, DS, HTTPS, SVCB, OPENPGPKEY, CERT, URI, RP, LOC. More details about types can be found here.
    ZoneId string
    [string] The DNS Zone ID in which the DNS Record will be created.
    DnsRecordId string
    Enabled bool
    [bool] Indicates if the DNS Record is active or not. Default is true.
    Name string
    [string] The name of the DNS Record.
    Priority float64
    [int] The priority for the DNS Record.
    Timeouts DnsRecordTimeoutsArgs
    Ttl float64
    [int] Time to live for the DNS Record. Default is 3600.
    content String
    [string] The content of the DNS Record.
    type String
    [string] The type of the DNS Record, can have one of these values: A, AAAA, CNAME, ALIAS, MX, NS, SRV, TXT, CAA, SSHFP, TLSA, SMIMEA, DS, HTTPS, SVCB, OPENPGPKEY, CERT, URI, RP, LOC. More details about types can be found here.
    zoneId String
    [string] The DNS Zone ID in which the DNS Record will be created.
    dnsRecordId String
    enabled Boolean
    [bool] Indicates if the DNS Record is active or not. Default is true.
    name String
    [string] The name of the DNS Record.
    priority Double
    [int] The priority for the DNS Record.
    timeouts DnsRecordTimeouts
    ttl Double
    [int] Time to live for the DNS Record. Default is 3600.
    content string
    [string] The content of the DNS Record.
    type string
    [string] The type of the DNS Record, can have one of these values: A, AAAA, CNAME, ALIAS, MX, NS, SRV, TXT, CAA, SSHFP, TLSA, SMIMEA, DS, HTTPS, SVCB, OPENPGPKEY, CERT, URI, RP, LOC. More details about types can be found here.
    zoneId string
    [string] The DNS Zone ID in which the DNS Record will be created.
    dnsRecordId string
    enabled boolean
    [bool] Indicates if the DNS Record is active or not. Default is true.
    name string
    [string] The name of the DNS Record.
    priority number
    [int] The priority for the DNS Record.
    timeouts DnsRecordTimeouts
    ttl number
    [int] Time to live for the DNS Record. Default is 3600.
    content str
    [string] The content of the DNS Record.
    type str
    [string] The type of the DNS Record, can have one of these values: A, AAAA, CNAME, ALIAS, MX, NS, SRV, TXT, CAA, SSHFP, TLSA, SMIMEA, DS, HTTPS, SVCB, OPENPGPKEY, CERT, URI, RP, LOC. More details about types can be found here.
    zone_id str
    [string] The DNS Zone ID in which the DNS Record will be created.
    dns_record_id str
    enabled bool
    [bool] Indicates if the DNS Record is active or not. Default is true.
    name str
    [string] The name of the DNS Record.
    priority float
    [int] The priority for the DNS Record.
    timeouts DnsRecordTimeoutsArgs
    ttl float
    [int] Time to live for the DNS Record. Default is 3600.
    content String
    [string] The content of the DNS Record.
    type String
    [string] The type of the DNS Record, can have one of these values: A, AAAA, CNAME, ALIAS, MX, NS, SRV, TXT, CAA, SSHFP, TLSA, SMIMEA, DS, HTTPS, SVCB, OPENPGPKEY, CERT, URI, RP, LOC. More details about types can be found here.
    zoneId String
    [string] The DNS Zone ID in which the DNS Record will be created.
    dnsRecordId String
    enabled Boolean
    [bool] Indicates if the DNS Record is active or not. Default is true.
    name String
    [string] The name of the DNS Record.
    priority Number
    [int] The priority for the DNS Record.
    timeouts Property Map
    ttl Number
    [int] Time to live for the DNS Record. Default is 3600.

    Outputs

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

    Fqdn string
    Fully qualified domain name
    Id string
    The provider-assigned unique ID for this managed resource.
    Fqdn string
    Fully qualified domain name
    Id string
    The provider-assigned unique ID for this managed resource.
    fqdn String
    Fully qualified domain name
    id String
    The provider-assigned unique ID for this managed resource.
    fqdn string
    Fully qualified domain name
    id string
    The provider-assigned unique ID for this managed resource.
    fqdn str
    Fully qualified domain name
    id str
    The provider-assigned unique ID for this managed resource.
    fqdn String
    Fully qualified domain name
    id String
    The provider-assigned unique ID for this managed resource.

    Look up 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
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            content: Optional[str] = None,
            dns_record_id: Optional[str] = None,
            enabled: Optional[bool] = None,
            fqdn: Optional[str] = None,
            name: Optional[str] = None,
            priority: Optional[float] = None,
            timeouts: Optional[DnsRecordTimeoutsArgs] = None,
            ttl: Optional[float] = None,
            type: Optional[str] = None,
            zone_id: Optional[str] = None) -> DnsRecord
    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)
    public static DnsRecord get(String name, Output<String> id, DnsRecordState state, CustomResourceOptions options)
    resources:  _:    type: ionoscloud:DnsRecord    get:      id: ${id}
    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.
    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:
    Content string
    [string] The content of the DNS Record.
    DnsRecordId string
    Enabled bool
    [bool] Indicates if the DNS Record is active or not. Default is true.
    Fqdn string
    Fully qualified domain name
    Name string
    [string] The name of the DNS Record.
    Priority double
    [int] The priority for the DNS Record.
    Timeouts DnsRecordTimeouts
    Ttl double
    [int] Time to live for the DNS Record. Default is 3600.
    Type string
    [string] The type of the DNS Record, can have one of these values: A, AAAA, CNAME, ALIAS, MX, NS, SRV, TXT, CAA, SSHFP, TLSA, SMIMEA, DS, HTTPS, SVCB, OPENPGPKEY, CERT, URI, RP, LOC. More details about types can be found here.
    ZoneId string
    [string] The DNS Zone ID in which the DNS Record will be created.
    Content string
    [string] The content of the DNS Record.
    DnsRecordId string
    Enabled bool
    [bool] Indicates if the DNS Record is active or not. Default is true.
    Fqdn string
    Fully qualified domain name
    Name string
    [string] The name of the DNS Record.
    Priority float64
    [int] The priority for the DNS Record.
    Timeouts DnsRecordTimeoutsArgs
    Ttl float64
    [int] Time to live for the DNS Record. Default is 3600.
    Type string
    [string] The type of the DNS Record, can have one of these values: A, AAAA, CNAME, ALIAS, MX, NS, SRV, TXT, CAA, SSHFP, TLSA, SMIMEA, DS, HTTPS, SVCB, OPENPGPKEY, CERT, URI, RP, LOC. More details about types can be found here.
    ZoneId string
    [string] The DNS Zone ID in which the DNS Record will be created.
    content String
    [string] The content of the DNS Record.
    dnsRecordId String
    enabled Boolean
    [bool] Indicates if the DNS Record is active or not. Default is true.
    fqdn String
    Fully qualified domain name
    name String
    [string] The name of the DNS Record.
    priority Double
    [int] The priority for the DNS Record.
    timeouts DnsRecordTimeouts
    ttl Double
    [int] Time to live for the DNS Record. Default is 3600.
    type String
    [string] The type of the DNS Record, can have one of these values: A, AAAA, CNAME, ALIAS, MX, NS, SRV, TXT, CAA, SSHFP, TLSA, SMIMEA, DS, HTTPS, SVCB, OPENPGPKEY, CERT, URI, RP, LOC. More details about types can be found here.
    zoneId String
    [string] The DNS Zone ID in which the DNS Record will be created.
    content string
    [string] The content of the DNS Record.
    dnsRecordId string
    enabled boolean
    [bool] Indicates if the DNS Record is active or not. Default is true.
    fqdn string
    Fully qualified domain name
    name string
    [string] The name of the DNS Record.
    priority number
    [int] The priority for the DNS Record.
    timeouts DnsRecordTimeouts
    ttl number
    [int] Time to live for the DNS Record. Default is 3600.
    type string
    [string] The type of the DNS Record, can have one of these values: A, AAAA, CNAME, ALIAS, MX, NS, SRV, TXT, CAA, SSHFP, TLSA, SMIMEA, DS, HTTPS, SVCB, OPENPGPKEY, CERT, URI, RP, LOC. More details about types can be found here.
    zoneId string
    [string] The DNS Zone ID in which the DNS Record will be created.
    content str
    [string] The content of the DNS Record.
    dns_record_id str
    enabled bool
    [bool] Indicates if the DNS Record is active or not. Default is true.
    fqdn str
    Fully qualified domain name
    name str
    [string] The name of the DNS Record.
    priority float
    [int] The priority for the DNS Record.
    timeouts DnsRecordTimeoutsArgs
    ttl float
    [int] Time to live for the DNS Record. Default is 3600.
    type str
    [string] The type of the DNS Record, can have one of these values: A, AAAA, CNAME, ALIAS, MX, NS, SRV, TXT, CAA, SSHFP, TLSA, SMIMEA, DS, HTTPS, SVCB, OPENPGPKEY, CERT, URI, RP, LOC. More details about types can be found here.
    zone_id str
    [string] The DNS Zone ID in which the DNS Record will be created.
    content String
    [string] The content of the DNS Record.
    dnsRecordId String
    enabled Boolean
    [bool] Indicates if the DNS Record is active or not. Default is true.
    fqdn String
    Fully qualified domain name
    name String
    [string] The name of the DNS Record.
    priority Number
    [int] The priority for the DNS Record.
    timeouts Property Map
    ttl Number
    [int] Time to live for the DNS Record. Default is 3600.
    type String
    [string] The type of the DNS Record, can have one of these values: A, AAAA, CNAME, ALIAS, MX, NS, SRV, TXT, CAA, SSHFP, TLSA, SMIMEA, DS, HTTPS, SVCB, OPENPGPKEY, CERT, URI, RP, LOC. More details about types can be found here.
    zoneId String
    [string] The DNS Zone ID in which the DNS Record will be created.

    Supporting Types

    DnsRecordTimeouts, DnsRecordTimeoutsArgs

    Create string
    Default string
    Delete string
    Update string
    Create string
    Default string
    Delete string
    Update string
    create String
    default_ String
    delete String
    update String
    create string
    default string
    delete string
    update string
    create String
    default String
    delete String
    update String

    Import

    In order to import a DNS Record, you can define an empty DNS Record resource in the plan:

    hcl

    resource “ionoscloud_dns_record” “example” {

    }

    The resource can be imported using the zone_id and the record_id, for example:

    $ pulumi import ionoscloud:index/dnsRecord:DnsRecord example zone_id/record_id
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    ionoscloud ionos-cloud/terraform-provider-ionoscloud
    License
    Notes
    This Pulumi package is based on the ionoscloud Terraform Provider.
    ionoscloud logo
    ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud