1. Packages
  2. Ionoscloud
  3. API Docs
  4. dns
  5. Record
IonosCloud v0.2.2 published on Monday, May 12, 2025 by ionos-cloud

ionoscloud.dns.Record

Explore with Pulumi AI

ionoscloud logo
IonosCloud v0.2.2 published on Monday, May 12, 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 "@ionos-cloud/sdk-pulumi";
    
    const example = new ionoscloud.dns.Zone("example", {
        name: "example.com",
        description: "description",
        enabled: false,
    });
    const recordexample = new ionoscloud.dns.Record("recordexample", {
        zoneId: example.id,
        name: "recordexample",
        type: "CNAME",
        content: "1.2.3.4",
        ttl: 2000,
        priority: 1024,
        enabled: false,
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.dns.Zone("example",
        name="example.com",
        description="description",
        enabled=False)
    recordexample = ionoscloud.dns.Record("recordexample",
        zone_id=example.id,
        name="recordexample",
        type="CNAME",
        content="1.2.3.4",
        ttl=2000,
        priority=1024,
        enabled=False)
    
    package main
    
    import (
    	"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/dns"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := dns.NewZone(ctx, "example", &dns.ZoneArgs{
    			Name:        pulumi.String("example.com"),
    			Description: pulumi.String("description"),
    			Enabled:     pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = dns.NewRecord(ctx, "recordexample", &dns.RecordArgs{
    			ZoneId:   example.ID(),
    			Name:     pulumi.String("recordexample"),
    			Type:     pulumi.String("CNAME"),
    			Content:  pulumi.String("1.2.3.4"),
    			Ttl:      pulumi.Int(2000),
    			Priority: pulumi.Int(1024),
    			Enabled:  pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Ionoscloud.Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Ionoscloud.Dns.Zone("example", new()
        {
            Name = "example.com",
            Description = "description",
            Enabled = false,
        });
    
        var recordexample = new Ionoscloud.Dns.Record("recordexample", new()
        {
            ZoneId = example.Id,
            Name = "recordexample",
            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.dns.Zone;
    import com.pulumi.ionoscloud.dns.ZoneArgs;
    import com.pulumi.ionoscloud.dns.Record;
    import com.pulumi.ionoscloud.dns.RecordArgs;
    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 Zone("example", ZoneArgs.builder()
                .name("example.com")
                .description("description")
                .enabled(false)
                .build());
    
            var recordexample = new Record("recordexample", RecordArgs.builder()
                .zoneId(example.id())
                .name("recordexample")
                .type("CNAME")
                .content("1.2.3.4")
                .ttl(2000)
                .priority(1024)
                .enabled(false)
                .build());
    
        }
    }
    
    resources:
      example:
        type: ionoscloud:dns:Zone
        properties:
          name: example.com
          description: description
          enabled: false
      recordexample:
        type: ionoscloud:dns:Record
        properties:
          zoneId: ${example.id}
          name: recordexample
          type: CNAME
          content: 1.2.3.4
          ttl: 2000
          priority: 1024
          enabled: false
    

    Create Record Resource

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

    Constructor syntax

    new Record(name: string, args: RecordArgs, opts?: CustomResourceOptions);
    @overload
    def Record(resource_name: str,
               args: RecordArgs,
               opts: Optional[ResourceOptions] = None)
    
    @overload
    def Record(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               content: Optional[str] = None,
               type: Optional[str] = None,
               zone_id: Optional[str] = None,
               enabled: Optional[bool] = None,
               name: Optional[str] = None,
               priority: Optional[int] = None,
               ttl: Optional[int] = None)
    func NewRecord(ctx *Context, name string, args RecordArgs, opts ...ResourceOption) (*Record, error)
    public Record(string name, RecordArgs args, CustomResourceOptions? opts = null)
    public Record(String name, RecordArgs args)
    public Record(String name, RecordArgs args, CustomResourceOptions options)
    
    type: ionoscloud:dns:Record
    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 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.
    args RecordArgs
    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 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.
    name String
    The unique name of the resource.
    args RecordArgs
    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 recordResource = new Ionoscloud.Dns.Record("recordResource", new()
    {
        Content = "string",
        Type = "string",
        ZoneId = "string",
        Enabled = false,
        Name = "string",
        Priority = 0,
        Ttl = 0,
    });
    
    example, err := dns.NewRecord(ctx, "recordResource", &dns.RecordArgs{
    	Content:  pulumi.String("string"),
    	Type:     pulumi.String("string"),
    	ZoneId:   pulumi.String("string"),
    	Enabled:  pulumi.Bool(false),
    	Name:     pulumi.String("string"),
    	Priority: pulumi.Int(0),
    	Ttl:      pulumi.Int(0),
    })
    
    var recordResource = new Record("recordResource", RecordArgs.builder()
        .content("string")
        .type("string")
        .zoneId("string")
        .enabled(false)
        .name("string")
        .priority(0)
        .ttl(0)
        .build());
    
    record_resource = ionoscloud.dns.Record("recordResource",
        content="string",
        type="string",
        zone_id="string",
        enabled=False,
        name="string",
        priority=0,
        ttl=0)
    
    const recordResource = new ionoscloud.dns.Record("recordResource", {
        content: "string",
        type: "string",
        zoneId: "string",
        enabled: false,
        name: "string",
        priority: 0,
        ttl: 0,
    });
    
    type: ionoscloud:dns:Record
    properties:
        content: string
        enabled: false
        name: string
        priority: 0
        ttl: 0
        type: string
        zoneId: string
    

    Record 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 Record 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.
    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 int
    [int] The priority for the DNS Record.
    Ttl int
    [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.
    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 int
    [int] The priority for the DNS Record.
    Ttl int
    [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.
    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 Integer
    [int] The priority for the DNS Record.
    ttl Integer
    [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.
    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.
    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.
    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 int
    [int] The priority for the DNS Record.
    ttl int
    [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.
    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.
    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 Record 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 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,
            content: Optional[str] = None,
            enabled: Optional[bool] = None,
            fqdn: Optional[str] = None,
            name: Optional[str] = None,
            priority: Optional[int] = None,
            ttl: Optional[int] = None,
            type: 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)
    public static Record get(String name, Output<String> id, RecordState state, CustomResourceOptions options)
    resources:  _:    type: ionoscloud:dns:Record    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.
    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 int
    [int] The priority for the DNS Record.
    Ttl int
    [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.
    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 int
    [int] The priority for the DNS Record.
    Ttl int
    [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.
    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 Integer
    [int] The priority for the DNS Record.
    ttl Integer
    [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.
    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.
    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.
    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 int
    [int] The priority for the DNS Record.
    ttl int
    [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.
    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.
    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.

    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:dns/record:Record example zone_id/record_id
    

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

    Package Details

    Repository
    ionoscloud ionos-cloud/pulumi-ionoscloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the ionoscloud Terraform Provider.
    ionoscloud logo
    IonosCloud v0.2.2 published on Monday, May 12, 2025 by ionos-cloud