1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. PrivateDnsRecord
tencentcloud 1.81.187 published on Monday, Apr 28, 2025 by tencentcloudstack

tencentcloud.PrivateDnsRecord

Explore with Pulumi AI

Provide a resource to create a Private Dns Record.

Example Usage

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

// create vpc
const vpc = new tencentcloud.Vpc("vpc", {cidrBlock: "10.0.0.0/16"});
// create private dns zone
const examplePrivateDnsZone = new tencentcloud.PrivateDnsZone("examplePrivateDnsZone", {
    domain: "domain.com",
    remark: "remark.",
    vpcSets: [{
        region: "ap-guangzhou",
        uniqVpcId: vpc.vpcId,
    }],
    dnsForwardStatus: "DISABLED",
    cnameSpeedupStatus: "ENABLED",
    tags: {
        createdBy: "terraform",
    },
});
// create private dns record
const examplePrivateDnsRecord = new tencentcloud.PrivateDnsRecord("examplePrivateDnsRecord", {
    zoneId: examplePrivateDnsZone.privateDnsZoneId,
    recordType: "A",
    recordValue: "192.168.1.2",
    subDomain: "www",
    ttl: 300,
    weight: 1,
    mx: 0,
});
Copy
import pulumi
import pulumi_tencentcloud as tencentcloud

# create vpc
vpc = tencentcloud.Vpc("vpc", cidr_block="10.0.0.0/16")
# create private dns zone
example_private_dns_zone = tencentcloud.PrivateDnsZone("examplePrivateDnsZone",
    domain="domain.com",
    remark="remark.",
    vpc_sets=[{
        "region": "ap-guangzhou",
        "uniq_vpc_id": vpc.vpc_id,
    }],
    dns_forward_status="DISABLED",
    cname_speedup_status="ENABLED",
    tags={
        "createdBy": "terraform",
    })
# create private dns record
example_private_dns_record = tencentcloud.PrivateDnsRecord("examplePrivateDnsRecord",
    zone_id=example_private_dns_zone.private_dns_zone_id,
    record_type="A",
    record_value="192.168.1.2",
    sub_domain="www",
    ttl=300,
    weight=1,
    mx=0)
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		// create vpc
		vpc, err := tencentcloud.NewVpc(ctx, "vpc", &tencentcloud.VpcArgs{
			CidrBlock: pulumi.String("10.0.0.0/16"),
		})
		if err != nil {
			return err
		}
		// create private dns zone
		examplePrivateDnsZone, err := tencentcloud.NewPrivateDnsZone(ctx, "examplePrivateDnsZone", &tencentcloud.PrivateDnsZoneArgs{
			Domain: pulumi.String("domain.com"),
			Remark: pulumi.String("remark."),
			VpcSets: tencentcloud.PrivateDnsZoneVpcSetArray{
				&tencentcloud.PrivateDnsZoneVpcSetArgs{
					Region:    pulumi.String("ap-guangzhou"),
					UniqVpcId: vpc.VpcId,
				},
			},
			DnsForwardStatus:   pulumi.String("DISABLED"),
			CnameSpeedupStatus: pulumi.String("ENABLED"),
			Tags: pulumi.StringMap{
				"createdBy": pulumi.String("terraform"),
			},
		})
		if err != nil {
			return err
		}
		// create private dns record
		_, err = tencentcloud.NewPrivateDnsRecord(ctx, "examplePrivateDnsRecord", &tencentcloud.PrivateDnsRecordArgs{
			ZoneId:      examplePrivateDnsZone.PrivateDnsZoneId,
			RecordType:  pulumi.String("A"),
			RecordValue: pulumi.String("192.168.1.2"),
			SubDomain:   pulumi.String("www"),
			Ttl:         pulumi.Float64(300),
			Weight:      pulumi.Float64(1),
			Mx:          pulumi.Float64(0),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;

return await Deployment.RunAsync(() => 
{
    // create vpc
    var vpc = new Tencentcloud.Vpc("vpc", new()
    {
        CidrBlock = "10.0.0.0/16",
    });

    // create private dns zone
    var examplePrivateDnsZone = new Tencentcloud.PrivateDnsZone("examplePrivateDnsZone", new()
    {
        Domain = "domain.com",
        Remark = "remark.",
        VpcSets = new[]
        {
            new Tencentcloud.Inputs.PrivateDnsZoneVpcSetArgs
            {
                Region = "ap-guangzhou",
                UniqVpcId = vpc.VpcId,
            },
        },
        DnsForwardStatus = "DISABLED",
        CnameSpeedupStatus = "ENABLED",
        Tags = 
        {
            { "createdBy", "terraform" },
        },
    });

    // create private dns record
    var examplePrivateDnsRecord = new Tencentcloud.PrivateDnsRecord("examplePrivateDnsRecord", new()
    {
        ZoneId = examplePrivateDnsZone.PrivateDnsZoneId,
        RecordType = "A",
        RecordValue = "192.168.1.2",
        SubDomain = "www",
        Ttl = 300,
        Weight = 1,
        Mx = 0,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.Vpc;
import com.pulumi.tencentcloud.VpcArgs;
import com.pulumi.tencentcloud.PrivateDnsZone;
import com.pulumi.tencentcloud.PrivateDnsZoneArgs;
import com.pulumi.tencentcloud.inputs.PrivateDnsZoneVpcSetArgs;
import com.pulumi.tencentcloud.PrivateDnsRecord;
import com.pulumi.tencentcloud.PrivateDnsRecordArgs;
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) {
        // create vpc
        var vpc = new Vpc("vpc", VpcArgs.builder()
            .cidrBlock("10.0.0.0/16")
            .build());

        // create private dns zone
        var examplePrivateDnsZone = new PrivateDnsZone("examplePrivateDnsZone", PrivateDnsZoneArgs.builder()
            .domain("domain.com")
            .remark("remark.")
            .vpcSets(PrivateDnsZoneVpcSetArgs.builder()
                .region("ap-guangzhou")
                .uniqVpcId(vpc.vpcId())
                .build())
            .dnsForwardStatus("DISABLED")
            .cnameSpeedupStatus("ENABLED")
            .tags(Map.of("createdBy", "terraform"))
            .build());

        // create private dns record
        var examplePrivateDnsRecord = new PrivateDnsRecord("examplePrivateDnsRecord", PrivateDnsRecordArgs.builder()
            .zoneId(examplePrivateDnsZone.privateDnsZoneId())
            .recordType("A")
            .recordValue("192.168.1.2")
            .subDomain("www")
            .ttl(300)
            .weight(1)
            .mx(0)
            .build());

    }
}
Copy
resources:
  # create vpc
  vpc:
    type: tencentcloud:Vpc
    properties:
      cidrBlock: 10.0.0.0/16
  # create private dns zone
  examplePrivateDnsZone:
    type: tencentcloud:PrivateDnsZone
    properties:
      domain: domain.com
      remark: remark.
      vpcSets:
        - region: ap-guangzhou
          uniqVpcId: ${vpc.vpcId}
      dnsForwardStatus: DISABLED
      cnameSpeedupStatus: ENABLED
      tags:
        createdBy: terraform
  # create private dns record
  examplePrivateDnsRecord:
    type: tencentcloud:PrivateDnsRecord
    properties:
      zoneId: ${examplePrivateDnsZone.privateDnsZoneId}
      recordType: A
      recordValue: 192.168.1.2
      subDomain: www
      ttl: 300
      weight: 1
      mx: 0
Copy

Create PrivateDnsRecord Resource

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

Constructor syntax

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

@overload
def PrivateDnsRecord(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     record_type: Optional[str] = None,
                     record_value: Optional[str] = None,
                     sub_domain: Optional[str] = None,
                     zone_id: Optional[str] = None,
                     mx: Optional[float] = None,
                     private_dns_record_id: Optional[str] = None,
                     ttl: Optional[float] = None,
                     weight: Optional[float] = None)
func NewPrivateDnsRecord(ctx *Context, name string, args PrivateDnsRecordArgs, opts ...ResourceOption) (*PrivateDnsRecord, error)
public PrivateDnsRecord(string name, PrivateDnsRecordArgs args, CustomResourceOptions? opts = null)
public PrivateDnsRecord(String name, PrivateDnsRecordArgs args)
public PrivateDnsRecord(String name, PrivateDnsRecordArgs args, CustomResourceOptions options)
type: tencentcloud:PrivateDnsRecord
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. PrivateDnsRecordArgs
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. PrivateDnsRecordArgs
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. PrivateDnsRecordArgs
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. PrivateDnsRecordArgs
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. PrivateDnsRecordArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

RecordType This property is required. string
Record type. Valid values: A, AAAA, CNAME, MX, TXT, PTR.
RecordValue This property is required. string
Record value, such as IP: 192.168.10.2, CNAME: cname.qcloud.com, and MX: mail.qcloud.com.
SubDomain This property is required. string
Subdomain, such as www, m, and @.
ZoneId This property is required. string
Private domain ID.
Mx double
MX priority, which is required when the record type is MX. Valid values: 5, 10, 15, 20, 30, 40, 50.
PrivateDnsRecordId string
ID of the resource.
Ttl double
Record cache time. The smaller the value, the faster the record will take effect. Value range: 1~86400s.
Weight double
Record weight. Value range: 1~100.
RecordType This property is required. string
Record type. Valid values: A, AAAA, CNAME, MX, TXT, PTR.
RecordValue This property is required. string
Record value, such as IP: 192.168.10.2, CNAME: cname.qcloud.com, and MX: mail.qcloud.com.
SubDomain This property is required. string
Subdomain, such as www, m, and @.
ZoneId This property is required. string
Private domain ID.
Mx float64
MX priority, which is required when the record type is MX. Valid values: 5, 10, 15, 20, 30, 40, 50.
PrivateDnsRecordId string
ID of the resource.
Ttl float64
Record cache time. The smaller the value, the faster the record will take effect. Value range: 1~86400s.
Weight float64
Record weight. Value range: 1~100.
recordType This property is required. String
Record type. Valid values: A, AAAA, CNAME, MX, TXT, PTR.
recordValue This property is required. String
Record value, such as IP: 192.168.10.2, CNAME: cname.qcloud.com, and MX: mail.qcloud.com.
subDomain This property is required. String
Subdomain, such as www, m, and @.
zoneId This property is required. String
Private domain ID.
mx Double
MX priority, which is required when the record type is MX. Valid values: 5, 10, 15, 20, 30, 40, 50.
privateDnsRecordId String
ID of the resource.
ttl Double
Record cache time. The smaller the value, the faster the record will take effect. Value range: 1~86400s.
weight Double
Record weight. Value range: 1~100.
recordType This property is required. string
Record type. Valid values: A, AAAA, CNAME, MX, TXT, PTR.
recordValue This property is required. string
Record value, such as IP: 192.168.10.2, CNAME: cname.qcloud.com, and MX: mail.qcloud.com.
subDomain This property is required. string
Subdomain, such as www, m, and @.
zoneId This property is required. string
Private domain ID.
mx number
MX priority, which is required when the record type is MX. Valid values: 5, 10, 15, 20, 30, 40, 50.
privateDnsRecordId string
ID of the resource.
ttl number
Record cache time. The smaller the value, the faster the record will take effect. Value range: 1~86400s.
weight number
Record weight. Value range: 1~100.
record_type This property is required. str
Record type. Valid values: A, AAAA, CNAME, MX, TXT, PTR.
record_value This property is required. str
Record value, such as IP: 192.168.10.2, CNAME: cname.qcloud.com, and MX: mail.qcloud.com.
sub_domain This property is required. str
Subdomain, such as www, m, and @.
zone_id This property is required. str
Private domain ID.
mx float
MX priority, which is required when the record type is MX. Valid values: 5, 10, 15, 20, 30, 40, 50.
private_dns_record_id str
ID of the resource.
ttl float
Record cache time. The smaller the value, the faster the record will take effect. Value range: 1~86400s.
weight float
Record weight. Value range: 1~100.
recordType This property is required. String
Record type. Valid values: A, AAAA, CNAME, MX, TXT, PTR.
recordValue This property is required. String
Record value, such as IP: 192.168.10.2, CNAME: cname.qcloud.com, and MX: mail.qcloud.com.
subDomain This property is required. String
Subdomain, such as www, m, and @.
zoneId This property is required. String
Private domain ID.
mx Number
MX priority, which is required when the record type is MX. Valid values: 5, 10, 15, 20, 30, 40, 50.
privateDnsRecordId String
ID of the resource.
ttl Number
Record cache time. The smaller the value, the faster the record will take effect. Value range: 1~86400s.
weight Number
Record weight. Value range: 1~100.

Outputs

All input properties are implicitly available as output properties. Additionally, the PrivateDnsRecord 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 PrivateDnsRecord Resource

Get an existing PrivateDnsRecord 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?: PrivateDnsRecordState, opts?: CustomResourceOptions): PrivateDnsRecord
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        mx: Optional[float] = None,
        private_dns_record_id: Optional[str] = None,
        record_type: Optional[str] = None,
        record_value: Optional[str] = None,
        sub_domain: Optional[str] = None,
        ttl: Optional[float] = None,
        weight: Optional[float] = None,
        zone_id: Optional[str] = None) -> PrivateDnsRecord
func GetPrivateDnsRecord(ctx *Context, name string, id IDInput, state *PrivateDnsRecordState, opts ...ResourceOption) (*PrivateDnsRecord, error)
public static PrivateDnsRecord Get(string name, Input<string> id, PrivateDnsRecordState? state, CustomResourceOptions? opts = null)
public static PrivateDnsRecord get(String name, Output<String> id, PrivateDnsRecordState state, CustomResourceOptions options)
resources:  _:    type: tencentcloud:PrivateDnsRecord    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:
Mx double
MX priority, which is required when the record type is MX. Valid values: 5, 10, 15, 20, 30, 40, 50.
PrivateDnsRecordId string
ID of the resource.
RecordType string
Record type. Valid values: A, AAAA, CNAME, MX, TXT, PTR.
RecordValue string
Record value, such as IP: 192.168.10.2, CNAME: cname.qcloud.com, and MX: mail.qcloud.com.
SubDomain string
Subdomain, such as www, m, and @.
Ttl double
Record cache time. The smaller the value, the faster the record will take effect. Value range: 1~86400s.
Weight double
Record weight. Value range: 1~100.
ZoneId string
Private domain ID.
Mx float64
MX priority, which is required when the record type is MX. Valid values: 5, 10, 15, 20, 30, 40, 50.
PrivateDnsRecordId string
ID of the resource.
RecordType string
Record type. Valid values: A, AAAA, CNAME, MX, TXT, PTR.
RecordValue string
Record value, such as IP: 192.168.10.2, CNAME: cname.qcloud.com, and MX: mail.qcloud.com.
SubDomain string
Subdomain, such as www, m, and @.
Ttl float64
Record cache time. The smaller the value, the faster the record will take effect. Value range: 1~86400s.
Weight float64
Record weight. Value range: 1~100.
ZoneId string
Private domain ID.
mx Double
MX priority, which is required when the record type is MX. Valid values: 5, 10, 15, 20, 30, 40, 50.
privateDnsRecordId String
ID of the resource.
recordType String
Record type. Valid values: A, AAAA, CNAME, MX, TXT, PTR.
recordValue String
Record value, such as IP: 192.168.10.2, CNAME: cname.qcloud.com, and MX: mail.qcloud.com.
subDomain String
Subdomain, such as www, m, and @.
ttl Double
Record cache time. The smaller the value, the faster the record will take effect. Value range: 1~86400s.
weight Double
Record weight. Value range: 1~100.
zoneId String
Private domain ID.
mx number
MX priority, which is required when the record type is MX. Valid values: 5, 10, 15, 20, 30, 40, 50.
privateDnsRecordId string
ID of the resource.
recordType string
Record type. Valid values: A, AAAA, CNAME, MX, TXT, PTR.
recordValue string
Record value, such as IP: 192.168.10.2, CNAME: cname.qcloud.com, and MX: mail.qcloud.com.
subDomain string
Subdomain, such as www, m, and @.
ttl number
Record cache time. The smaller the value, the faster the record will take effect. Value range: 1~86400s.
weight number
Record weight. Value range: 1~100.
zoneId string
Private domain ID.
mx float
MX priority, which is required when the record type is MX. Valid values: 5, 10, 15, 20, 30, 40, 50.
private_dns_record_id str
ID of the resource.
record_type str
Record type. Valid values: A, AAAA, CNAME, MX, TXT, PTR.
record_value str
Record value, such as IP: 192.168.10.2, CNAME: cname.qcloud.com, and MX: mail.qcloud.com.
sub_domain str
Subdomain, such as www, m, and @.
ttl float
Record cache time. The smaller the value, the faster the record will take effect. Value range: 1~86400s.
weight float
Record weight. Value range: 1~100.
zone_id str
Private domain ID.
mx Number
MX priority, which is required when the record type is MX. Valid values: 5, 10, 15, 20, 30, 40, 50.
privateDnsRecordId String
ID of the resource.
recordType String
Record type. Valid values: A, AAAA, CNAME, MX, TXT, PTR.
recordValue String
Record value, such as IP: 192.168.10.2, CNAME: cname.qcloud.com, and MX: mail.qcloud.com.
subDomain String
Subdomain, such as www, m, and @.
ttl Number
Record cache time. The smaller the value, the faster the record will take effect. Value range: 1~86400s.
weight Number
Record weight. Value range: 1~100.
zoneId String
Private domain ID.

Import

Private Dns Record can be imported, e.g.

$ pulumi import tencentcloud:index/privateDnsRecord:PrivateDnsRecord example zone-iza3a33s#1983030
Copy

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

Package Details

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