1. Packages
  2. Vultr
  3. API Docs
  4. DnsRecord
Vultr v2.21.1 published on Monday, Jul 22, 2024 by dirien

vultr.DnsRecord

Explore with Pulumi AI

vultr logo
Vultr v2.21.1 published on Monday, Jul 22, 2024 by dirien

    Provides a Vultr DNS Record resource. This can be used to create, read, modify, and delete DNS Records.

    Example Usage

    Create a new DNS Record

    import * as pulumi from "@pulumi/pulumi";
    import * as vultr from "@ediri/vultr";
    
    const myDomain = new vultr.DnsDomain("myDomain", {
        domain: "domain.com",
        ip: "66.42.94.227",
    });
    const myRecord = new vultr.DnsRecord("myRecord", {
        data: "66.42.94.227",
        domain: myDomain.id,
        type: "A",
    });
    
    import pulumi
    import ediri_vultr as vultr
    
    my_domain = vultr.DnsDomain("myDomain",
        domain="domain.com",
        ip="66.42.94.227")
    my_record = vultr.DnsRecord("myRecord",
        data="66.42.94.227",
        domain=my_domain.id,
        type="A")
    
    package main
    
    import (
    	"github.com/dirien/pulumi-vultr/sdk/v2/go/vultr"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		myDomain, err := vultr.NewDnsDomain(ctx, "myDomain", &vultr.DnsDomainArgs{
    			Domain: pulumi.String("domain.com"),
    			Ip:     pulumi.String("66.42.94.227"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = vultr.NewDnsRecord(ctx, "myRecord", &vultr.DnsRecordArgs{
    			Data:   pulumi.String("66.42.94.227"),
    			Domain: myDomain.ID(),
    			Type:   pulumi.String("A"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Vultr = ediri.Vultr;
    
    return await Deployment.RunAsync(() => 
    {
        var myDomain = new Vultr.DnsDomain("myDomain", new()
        {
            Domain = "domain.com",
            Ip = "66.42.94.227",
        });
    
        var myRecord = new Vultr.DnsRecord("myRecord", new()
        {
            Data = "66.42.94.227",
            Domain = myDomain.Id,
            Type = "A",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.vultr.DnsDomain;
    import com.pulumi.vultr.DnsDomainArgs;
    import com.pulumi.vultr.DnsRecord;
    import com.pulumi.vultr.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 myDomain = new DnsDomain("myDomain", DnsDomainArgs.builder()
                .domain("domain.com")
                .ip("66.42.94.227")
                .build());
    
            var myRecord = new DnsRecord("myRecord", DnsRecordArgs.builder()
                .data("66.42.94.227")
                .domain(myDomain.id())
                .type("A")
                .build());
    
        }
    }
    
    resources:
      myDomain:
        type: vultr:DnsDomain
        properties:
          domain: domain.com
          ip: 66.42.94.227
      myRecord:
        type: vultr:DnsRecord
        properties:
          data: 66.42.94.227
          domain: ${myDomain.id}
          type: A
    

    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,
                  data: Optional[str] = None,
                  domain: Optional[str] = None,
                  type: Optional[str] = None,
                  name: Optional[str] = None,
                  priority: Optional[int] = None,
                  ttl: Optional[int] = 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: vultr: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 Vultr.DnsRecord("dnsRecordResource", new()
    {
        Data = "string",
        Domain = "string",
        Type = "string",
        Name = "string",
        Priority = 0,
        Ttl = 0,
    });
    
    example, err := vultr.NewDnsRecord(ctx, "dnsRecordResource", &vultr.DnsRecordArgs{
    	Data:     pulumi.String("string"),
    	Domain:   pulumi.String("string"),
    	Type:     pulumi.String("string"),
    	Name:     pulumi.String("string"),
    	Priority: pulumi.Int(0),
    	Ttl:      pulumi.Int(0),
    })
    
    var dnsRecordResource = new DnsRecord("dnsRecordResource", DnsRecordArgs.builder()
        .data("string")
        .domain("string")
        .type("string")
        .name("string")
        .priority(0)
        .ttl(0)
        .build());
    
    dns_record_resource = vultr.DnsRecord("dnsRecordResource",
        data="string",
        domain="string",
        type="string",
        name="string",
        priority=0,
        ttl=0)
    
    const dnsRecordResource = new vultr.DnsRecord("dnsRecordResource", {
        data: "string",
        domain: "string",
        type: "string",
        name: "string",
        priority: 0,
        ttl: 0,
    });
    
    type: vultr:DnsRecord
    properties:
        data: string
        domain: string
        name: string
        priority: 0
        ttl: 0
        type: 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

    The DnsRecord resource accepts the following input properties:

    Data string
    IP Address of the instance the domain is associated with.
    Domain string
    Name of the DNS Domain this record will belong to.
    Type string
    Type of record.
    Name string
    Name (subdomain) for this record.
    Priority int
    Priority of this record (only required for MX and SRV).
    Ttl int
    The time to live of this record.
    Data string
    IP Address of the instance the domain is associated with.
    Domain string
    Name of the DNS Domain this record will belong to.
    Type string
    Type of record.
    Name string
    Name (subdomain) for this record.
    Priority int
    Priority of this record (only required for MX and SRV).
    Ttl int
    The time to live of this record.
    data String
    IP Address of the instance the domain is associated with.
    domain String
    Name of the DNS Domain this record will belong to.
    type String
    Type of record.
    name String
    Name (subdomain) for this record.
    priority Integer
    Priority of this record (only required for MX and SRV).
    ttl Integer
    The time to live of this record.
    data string
    IP Address of the instance the domain is associated with.
    domain string
    Name of the DNS Domain this record will belong to.
    type string
    Type of record.
    name string
    Name (subdomain) for this record.
    priority number
    Priority of this record (only required for MX and SRV).
    ttl number
    The time to live of this record.
    data str
    IP Address of the instance the domain is associated with.
    domain str
    Name of the DNS Domain this record will belong to.
    type str
    Type of record.
    name str
    Name (subdomain) for this record.
    priority int
    Priority of this record (only required for MX and SRV).
    ttl int
    The time to live of this record.
    data String
    IP Address of the instance the domain is associated with.
    domain String
    Name of the DNS Domain this record will belong to.
    type String
    Type of record.
    name String
    Name (subdomain) for this record.
    priority Number
    Priority of this record (only required for MX and SRV).
    ttl Number
    The time to live of this record.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    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,
            data: Optional[str] = None,
            domain: Optional[str] = None,
            name: Optional[str] = None,
            priority: Optional[int] = None,
            ttl: Optional[int] = None,
            type: 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)
    Resource lookup is not supported in YAML
    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:
    Data string
    IP Address of the instance the domain is associated with.
    Domain string
    Name of the DNS Domain this record will belong to.
    Name string
    Name (subdomain) for this record.
    Priority int
    Priority of this record (only required for MX and SRV).
    Ttl int
    The time to live of this record.
    Type string
    Type of record.
    Data string
    IP Address of the instance the domain is associated with.
    Domain string
    Name of the DNS Domain this record will belong to.
    Name string
    Name (subdomain) for this record.
    Priority int
    Priority of this record (only required for MX and SRV).
    Ttl int
    The time to live of this record.
    Type string
    Type of record.
    data String
    IP Address of the instance the domain is associated with.
    domain String
    Name of the DNS Domain this record will belong to.
    name String
    Name (subdomain) for this record.
    priority Integer
    Priority of this record (only required for MX and SRV).
    ttl Integer
    The time to live of this record.
    type String
    Type of record.
    data string
    IP Address of the instance the domain is associated with.
    domain string
    Name of the DNS Domain this record will belong to.
    name string
    Name (subdomain) for this record.
    priority number
    Priority of this record (only required for MX and SRV).
    ttl number
    The time to live of this record.
    type string
    Type of record.
    data str
    IP Address of the instance the domain is associated with.
    domain str
    Name of the DNS Domain this record will belong to.
    name str
    Name (subdomain) for this record.
    priority int
    Priority of this record (only required for MX and SRV).
    ttl int
    The time to live of this record.
    type str
    Type of record.
    data String
    IP Address of the instance the domain is associated with.
    domain String
    Name of the DNS Domain this record will belong to.
    name String
    Name (subdomain) for this record.
    priority Number
    Priority of this record (only required for MX and SRV).
    ttl Number
    The time to live of this record.
    type String
    Type of record.

    Import

    DNS Records can be imported using the Dns Domain domain and DNS Record ID e.g.

    $ pulumi import vultr:index/dnsRecord:DnsRecord rec domain.com,1a0019bd-7645-4310-81bd-03bc5906940f
    

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

    Package Details

    Repository
    vultr dirien/pulumi-vultr
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the vultr Terraform Provider.
    vultr logo
    Vultr v2.21.1 published on Monday, Jul 22, 2024 by dirien