diff --git a/.changelog/3286.txt b/.changelog/3286.txt new file mode 100644 index 0000000000..a24aada958 --- /dev/null +++ b/.changelog/3286.txt @@ -0,0 +1,3 @@ +```release-note:new-resource +tencentcloud_teo_dns_record +``` \ No newline at end of file diff --git a/tencentcloud/provider.go b/tencentcloud/provider.go index b18146cc07..52ac9686dc 100644 --- a/tencentcloud/provider.go +++ b/tencentcloud/provider.go @@ -1802,6 +1802,7 @@ func Provider() *schema.Provider { "tencentcloud_teo_function_rule_priority": teo.ResourceTencentCloudTeoFunctionRulePriority(), "tencentcloud_teo_function_runtime_environment": teo.ResourceTencentCloudTeoFunctionRuntimeEnvironment(), "tencentcloud_teo_security_policy_config": teo.ResourceTencentCloudTeoSecurityPolicyConfig(), + "tencentcloud_teo_dns_record": teo.ResourceTencentCloudTeoDnsRecord(), "tencentcloud_tcm_mesh": tcm.ResourceTencentCloudTcmMesh(), "tencentcloud_tcm_cluster_attachment": tcm.ResourceTencentCloudTcmClusterAttachment(), "tencentcloud_tcm_prometheus_attachment": tcm.ResourceTencentCloudTcmPrometheusAttachment(), diff --git a/tencentcloud/provider.md b/tencentcloud/provider.md index d115782597..866af6d5a9 100644 --- a/tencentcloud/provider.md +++ b/tencentcloud/provider.md @@ -1502,6 +1502,7 @@ tencentcloud_teo_l7_acc_rule tencentcloud_teo_l7_acc_setting tencentcloud_teo_security_ip_group tencentcloud_teo_security_policy_config +tencentcloud_teo_dns_record TencentCloud ServiceMesh(TCM) Data Source diff --git a/tencentcloud/services/teo/resource_tc_teo_dns_record.go b/tencentcloud/services/teo/resource_tc_teo_dns_record.go new file mode 100644 index 0000000000..fddc28290b --- /dev/null +++ b/tencentcloud/services/teo/resource_tc_teo_dns_record.go @@ -0,0 +1,413 @@ +package teo + +import ( + "context" + "fmt" + "log" + "strings" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + teov20220901 "github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/teo/v20220901" + + tccommon "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/common" + "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/internal/helper" +) + +func ResourceTencentCloudTeoDnsRecord() *schema.Resource { + return &schema.Resource{ + Create: resourceTencentCloudTeoDnsRecordCreate, + Read: resourceTencentCloudTeoDnsRecordRead, + Update: resourceTencentCloudTeoDnsRecordUpdate, + Delete: resourceTencentCloudTeoDnsRecordDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, + Schema: map[string]*schema.Schema{ + "zone_id": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + Description: "Zone id.", + }, + + "name": { + Type: schema.TypeString, + Required: true, + Description: "DNS record name. if the domain name is in chinese, korean, or japanese, it needs to be converted to punycode before input.", + }, + + "type": { + Type: schema.TypeString, + Required: true, + Description: "DNS record type. valid values are:\n" + + " - A: points the domain name to an external ipv4 address, such as 8.8.8.8;\n" + + " - AAAA: points the domain name to an external ipv6 address;\n" + + " - MX: used for email servers. when there are multiple mx records, the lower the priority value, the higher the priority;\n" + + " - CNAME: points the domain name to another domain name, which then resolves to the final ip address;\n" + + " - TXT: identifies and describes the domain name, commonly used for domain verification and spf records (anti-spam);\n" + + " - NS: if you need to delegate the subdomain to another dns service provider for resolution, you need to add an ns record. the root domain cannot add ns records;\n" + + " - CAA: specifies the ca that can issue certificates for this site;\n" + + " - SRV: identifies a server using a service, commonly used in microsoft's directory management.\n" + + "Different record types, such as SRV and CAA records, have different requirements for host record names and record value formats. for detailed descriptions and format examples of each record type, please refer to: [introduction to dns record types](https://intl.cloud.tencent.com/document/product/1552/90453?from_cn_redirect=1#2f681022-91ab-4a9e-ac3d-0a6c454d954e).", + }, + + "content": { + Type: schema.TypeString, + Required: true, + Description: "DNS record content. fill in the corresponding content according to the type value. if the domain name is in chinese, korean, or japanese, it needs to be converted to punycode before input.", + }, + + "location": { + Type: schema.TypeString, + Computed: true, + Optional: true, + Description: "DNS record resolution route. if not specified, the default is DEFAULT, which means the default resolution route and is effective in all regions.\n\n- resolution route configuration is only applicable when type (dns record type) is A, AAAA, or CNAME.\n- resolution route configuration is only applicable to standard version and enterprise edition packages. for valid values, please refer to: [resolution routes and corresponding code enumeration](https://intl.cloud.tencent.com/document/product/1552/112542?from_cn_redirect=1).", + }, + + "ttl": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Cache time. users can specify a value range of 60-86400. the smaller the value, the faster the modification records will take effect in all regions. default value: 300. unit: seconds.", + }, + + "weight": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "DNS record weight. users can specify a value range of -1 to 100. a value of 0 means no resolution. if not specified, the default is -1, which means no weight is set. weight configuration is only applicable when type (dns record type) is A, AAAA, or CNAME. note: for the same subdomain, different dns records with the same resolution route should either all have weights set or none have weights set.", + }, + + "priority": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "MX record priority, which takes effect only when type (dns record type) is MX. the smaller the value, the higher the priority. users can specify a value range of 0-50. the default value is 0 if not specified.", + }, + "status": { + Type: schema.TypeString, + Computed: true, + Optional: true, + Description: "DNS record resolution status, the following values:\n" + + " - enable: has taken effect;\n" + + " - disable: has been disabled.", + }, + "created_on": { + Type: schema.TypeString, + Computed: true, + Description: "Creation time.", + }, + "modified_on": { + Type: schema.TypeString, + Computed: true, + Description: "Modify time.", + }, + }, + } +} + +func resourceTencentCloudTeoDnsRecordCreate(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_teo_dns_record.create")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + var ( + zoneId string + recordId string + ) + var ( + request = teov20220901.NewCreateDnsRecordRequest() + response = teov20220901.NewCreateDnsRecordResponse() + ) + + if v, ok := d.GetOk("zone_id"); ok { + zoneId = v.(string) + request.ZoneId = helper.String(zoneId) + } + + if v, ok := d.GetOk("name"); ok { + request.Name = helper.String(v.(string)) + } + + if v, ok := d.GetOk("type"); ok { + request.Type = helper.String(v.(string)) + } + + if v, ok := d.GetOk("content"); ok { + request.Content = helper.String(v.(string)) + } + + if v, ok := d.GetOk("location"); ok { + request.Location = helper.String(v.(string)) + } + + if v, ok := d.GetOkExists("ttl"); ok { + request.TTL = helper.IntInt64(v.(int)) + } + + if v, ok := d.GetOkExists("weight"); ok { + request.Weight = helper.IntInt64(v.(int)) + } + + if v, ok := d.GetOkExists("priority"); ok { + request.Priority = helper.IntInt64(v.(int)) + } + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoV20220901Client().CreateDnsRecordWithContext(ctx, request) + if e != nil { + return tccommon.RetryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + response = result + return nil + }) + if err != nil { + log.Printf("[CRITAL]%s create teo dns record failed, reason:%+v", logId, err) + return err + } + + recordId = *response.Response.RecordId + + d.SetId(strings.Join([]string{zoneId, recordId}, tccommon.FILED_SP)) + + return resourceTencentCloudTeoDnsRecordRead(d, meta) +} + +func resourceTencentCloudTeoDnsRecordRead(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_teo_dns_record.read")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + service := TeoService{client: meta.(tccommon.ProviderMeta).GetAPIV3Conn()} + + idSplit := strings.Split(d.Id(), tccommon.FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + recordId := idSplit[1] + + respData, err := service.DescribeTeoDnsRecordById(ctx, zoneId, recordId) + if err != nil { + return err + } + if respData == nil { + d.SetId("") + log.Printf("[WARN]%s resource `teo_dns_record` [%s] not found, please check if it has been deleted.\n", logId, d.Id()) + return nil + } + if respData.ZoneId != nil { + _ = d.Set("zone_id", respData.ZoneId) + } + + if respData.Name != nil { + _ = d.Set("name", respData.Name) + } + + if respData.Type != nil { + _ = d.Set("type", respData.Type) + } + + if respData.Location != nil { + _ = d.Set("location", respData.Location) + } + + if respData.Content != nil { + _ = d.Set("content", respData.Content) + } + + if respData.TTL != nil { + _ = d.Set("ttl", respData.TTL) + } + + if respData.Weight != nil { + _ = d.Set("weight", respData.Weight) + } + + if respData.Priority != nil { + _ = d.Set("priority", respData.Priority) + } + + if respData.Status != nil { + _ = d.Set("status", respData.Status) + } + + if respData.CreatedOn != nil { + _ = d.Set("created_on", respData.CreatedOn) + } + + if respData.ModifiedOn != nil { + _ = d.Set("modified_on", respData.ModifiedOn) + } + + _ = recordId + return nil +} + +func resourceTencentCloudTeoDnsRecordUpdate(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_teo_dns_record.update")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + idSplit := strings.Split(d.Id(), tccommon.FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + recordId := idSplit[1] + + needChange := false + mutableArgs := []string{"name", "type", "content", "location", "ttl", "weight", "priority"} + for _, v := range mutableArgs { + if d.HasChange(v) { + needChange = true + break + } + } + + if needChange { + request := teov20220901.NewModifyDnsRecordsRequest() + request.ZoneId = helper.String(zoneId) + dnsRecord := &teov20220901.DnsRecord{ + RecordId: helper.String(recordId), + } + if v, ok := d.GetOk("name"); ok { + dnsRecord.Name = helper.String(v.(string)) + } + + if v, ok := d.GetOk("type"); ok { + dnsRecord.Type = helper.String(v.(string)) + } + + if v, ok := d.GetOk("content"); ok { + dnsRecord.Content = helper.String(v.(string)) + } + + if v, ok := d.GetOk("location"); ok { + dnsRecord.Location = helper.String(v.(string)) + } + + if v, ok := d.GetOkExists("ttl"); ok { + dnsRecord.TTL = helper.IntInt64(v.(int)) + } + + if v, ok := d.GetOkExists("weight"); ok { + dnsRecord.Weight = helper.IntInt64(v.(int)) + } + + if v, ok := d.GetOkExists("priority"); ok { + dnsRecord.Priority = helper.IntInt64(v.(int)) + } + request.DnsRecords = []*teov20220901.DnsRecord{dnsRecord} + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoV20220901Client().ModifyDnsRecordsWithContext(ctx, request) + if e != nil { + return tccommon.RetryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + return nil + }) + if err != nil { + log.Printf("[CRITAL]%s update teo dns record failed, reason:%+v", logId, err) + return err + } + } + + needChange1 := false + mutableArgs1 := []string{"status"} + for _, v := range mutableArgs1 { + if d.HasChange(v) { + needChange1 = true + break + } + } + + if needChange1 { + request1 := teov20220901.NewModifyDnsRecordsStatusRequest() + + request1.ZoneId = helper.String(zoneId) + if v, ok := d.GetOk("status"); ok { + status := v.(string) + if status == "enable" { + request1.RecordsToEnable = helper.Strings([]string{recordId}) + } + if status == "disable" { + request1.RecordsToDisable = helper.Strings([]string{recordId}) + } + } + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoV20220901Client().ModifyDnsRecordsStatusWithContext(ctx, request1) + if e != nil { + return tccommon.RetryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request1.GetAction(), request1.ToJsonString(), result.ToJsonString()) + } + return nil + }) + if err != nil { + log.Printf("[CRITAL]%s update teo dns record failed, reason:%+v", logId, err) + return err + } + } + + _ = zoneId + _ = recordId + return resourceTencentCloudTeoDnsRecordRead(d, meta) +} + +func resourceTencentCloudTeoDnsRecordDelete(d *schema.ResourceData, meta interface{}) error { + defer tccommon.LogElapsed("resource.tencentcloud_teo_dns_record.delete")() + defer tccommon.InconsistentCheck(d, meta)() + + logId := tccommon.GetLogId(tccommon.ContextNil) + ctx := tccommon.NewResourceLifeCycleHandleFuncContext(context.Background(), logId, d, meta) + + idSplit := strings.Split(d.Id(), tccommon.FILED_SP) + if len(idSplit) != 2 { + return fmt.Errorf("id is broken,%s", d.Id()) + } + zoneId := idSplit[0] + recordId := idSplit[1] + + var ( + request = teov20220901.NewDeleteDnsRecordsRequest() + response = teov20220901.NewDeleteDnsRecordsResponse() + ) + + request.ZoneId = helper.String(zoneId) + request.RecordIds = helper.Strings([]string{recordId}) + + err := resource.Retry(tccommon.WriteRetryTimeout, func() *resource.RetryError { + result, e := meta.(tccommon.ProviderMeta).GetAPIV3Conn().UseTeoV20220901Client().DeleteDnsRecordsWithContext(ctx, request) + if e != nil { + return tccommon.RetryError(e) + } else { + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), result.ToJsonString()) + } + response = result + return nil + }) + if err != nil { + log.Printf("[CRITAL]%s delete teo dns record failed, reason:%+v", logId, err) + return err + } + + _ = response + _ = recordId + return nil +} diff --git a/tencentcloud/services/teo/resource_tc_teo_dns_record.md b/tencentcloud/services/teo/resource_tc_teo_dns_record.md new file mode 100644 index 0000000000..005e9cd690 --- /dev/null +++ b/tencentcloud/services/teo/resource_tc_teo_dns_record.md @@ -0,0 +1,25 @@ +Provides a resource to create a teo teo_dns_record + +Example Usage + +```hcl +resource "tencentcloud_teo_dns_record" "teo_dns_record" { + zone_id = "zone-39quuimqg8r6" + type = "A" + content = "1.2.3.5" + location = "Default" + name = "a.makn.cn" + priority = 5 + ttl = 300 + weight = -1 + status = "enable" +} +``` + +Import + +teo teo_dns_record can be imported using the id, e.g. + +``` +terraform import tencentcloud_teo_dns_record.teo_dns_record {zoneId}#{recordId} +``` diff --git a/tencentcloud/services/teo/resource_tc_teo_dns_record_test.go b/tencentcloud/services/teo/resource_tc_teo_dns_record_test.go new file mode 100644 index 0000000000..a43df1b25f --- /dev/null +++ b/tencentcloud/services/teo/resource_tc_teo_dns_record_test.go @@ -0,0 +1,83 @@ +package teo_test + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + tcacctest "github.com/tencentcloudstack/terraform-provider-tencentcloud/tencentcloud/acctest" +) + +func TestAccTencentCloudTeoDnsRecordResource_basic(t *testing.T) { + t.Parallel() + resource.Test(t, resource.TestCase{ + PreCheck: func() { + tcacctest.AccPreCheck(t) + }, + Providers: tcacctest.AccProviders, + Steps: []resource.TestStep{ + { + Config: testAccTeoDnsRecord, + Check: resource.ComposeTestCheckFunc(resource.TestCheckResourceAttrSet("tencentcloud_teo_dns_record.teo_dns_record", "id")), + }, + { + Config: testAccTeoDnsRecordUpdate, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("tencentcloud_teo_dns_record.teo_dns_record", "content", "1.2.3.6"), + ), + }, + { + Config: testAccTeoDnsRecordUpdateStatus, + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttr("tencentcloud_teo_dns_record.teo_dns_record", "status", "disable"), + ), + }, + { + ResourceName: "tencentcloud_teo_dns_record.teo_dns_record", + ImportState: true, + ImportStateVerify: true, + }}, + }) +} + +const testAccTeoDnsRecord = ` +resource "tencentcloud_teo_dns_record" "teo_dns_record" { + zone_id = "zone-39quuimqg8r6" + type = "A" + content = "1.2.3.5" + location = "Default" + name = "a.makn.cn" + priority = 5 + ttl = 300 + weight = -1 + status = "enable" +} +` + +const testAccTeoDnsRecordUpdate = ` +resource "tencentcloud_teo_dns_record" "teo_dns_record" { + zone_id = "zone-39quuimqg8r6" + type = "A" + content = "1.2.3.6" + location = "Default" + name = "a.makn.cn" + priority = 5 + ttl = 300 + weight = -1 + status = "enable" +} +` + +const testAccTeoDnsRecordUpdateStatus = ` +resource "tencentcloud_teo_dns_record" "teo_dns_record" { + zone_id = "zone-39quuimqg8r6" + type = "A" + content = "1.2.3.6" + location = "Default" + name = "a.makn.cn" + priority = 5 + ttl = 300 + weight = -1 + status = "disable" +} +` diff --git a/tencentcloud/services/teo/service_tencentcloud_teo.go b/tencentcloud/services/teo/service_tencentcloud_teo.go index 8789f0d4ba..e0b561ec01 100644 --- a/tencentcloud/services/teo/service_tencentcloud_teo.go +++ b/tencentcloud/services/teo/service_tencentcloud_teo.go @@ -1774,3 +1774,40 @@ func (me *TeoService) TeoL7AccRuleStateRefreshFunc(zoneId, taskId string, failSt return object, status, nil } } + +func (me *TeoService) DescribeTeoDnsRecordById(ctx context.Context, zoneId, recordId string) (ret *teov20220901.DnsRecord, errRet error) { + logId := tccommon.GetLogId(ctx) + + request := teov20220901.NewDescribeDnsRecordsRequest() + request.ZoneId = helper.String(zoneId) + request.Filters = []*teov20220901.AdvancedFilter{ + { + Name: helper.String("id"), + Values: helper.Strings([]string{recordId}), + }, + } + + defer func() { + if errRet != nil { + log.Printf("[CRITAL]%s api[%s] fail, request body [%s], reason[%s]\n", logId, request.GetAction(), request.ToJsonString(), errRet.Error()) + } + }() + + err := resource.Retry(tccommon.ReadRetryTimeout, func() *resource.RetryError { + ratelimit.Check(request.GetAction()) + response, e := me.client.UseTeoClient().DescribeDnsRecords(request) + if e != nil { + return tccommon.RetryError(e) + } + log.Printf("[DEBUG]%s api[%s] success, request body [%s], response body [%s]\n", logId, request.GetAction(), request.ToJsonString(), response.ToJsonString()) + if len(response.Response.DnsRecords) > 0 { + ret = response.Response.DnsRecords[0] + } + return nil + }) + if err != nil { + errRet = err + return + } + return +} diff --git a/website/docs/r/teo_dns_record.html.markdown b/website/docs/r/teo_dns_record.html.markdown new file mode 100644 index 0000000000..2c2c1009aa --- /dev/null +++ b/website/docs/r/teo_dns_record.html.markdown @@ -0,0 +1,74 @@ +--- +subcategory: "TencentCloud EdgeOne(TEO)" +layout: "tencentcloud" +page_title: "TencentCloud: tencentcloud_teo_dns_record" +sidebar_current: "docs-tencentcloud-resource-teo_dns_record" +description: |- + Provides a resource to create a teo teo_dns_record +--- + +# tencentcloud_teo_dns_record + +Provides a resource to create a teo teo_dns_record + +## Example Usage + +```hcl +resource "tencentcloud_teo_dns_record" "teo_dns_record" { + zone_id = "zone-39quuimqg8r6" + type = "A" + content = "1.2.3.5" + location = "Default" + name = "a.makn.cn" + priority = 5 + ttl = 300 + weight = -1 + status = "enable" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `content` - (Required, String) DNS record content. fill in the corresponding content according to the type value. if the domain name is in chinese, korean, or japanese, it needs to be converted to punycode before input. +* `name` - (Required, String) DNS record name. if the domain name is in chinese, korean, or japanese, it needs to be converted to punycode before input. +* `type` - (Required, String) DNS record type. valid values are: + - A: points the domain name to an external ipv4 address, such as 8.8.8.8; + - AAAA: points the domain name to an external ipv6 address; + - MX: used for email servers. when there are multiple mx records, the lower the priority value, the higher the priority; + - CNAME: points the domain name to another domain name, which then resolves to the final ip address; + - TXT: identifies and describes the domain name, commonly used for domain verification and spf records (anti-spam); + - NS: if you need to delegate the subdomain to another dns service provider for resolution, you need to add an ns record. the root domain cannot add ns records; + - CAA: specifies the ca that can issue certificates for this site; + - SRV: identifies a server using a service, commonly used in microsoft's directory management. +Different record types, such as SRV and CAA records, have different requirements for host record names and record value formats. for detailed descriptions and format examples of each record type, please refer to: [introduction to dns record types](https://intl.cloud.tencent.com/document/product/1552/90453?from_cn_redirect=1#2f681022-91ab-4a9e-ac3d-0a6c454d954e). +* `zone_id` - (Required, String, ForceNew) Zone id. +* `location` - (Optional, String) DNS record resolution route. if not specified, the default is DEFAULT, which means the default resolution route and is effective in all regions. + +- resolution route configuration is only applicable when type (dns record type) is A, AAAA, or CNAME. +- resolution route configuration is only applicable to standard version and enterprise edition packages. for valid values, please refer to: [resolution routes and corresponding code enumeration](https://intl.cloud.tencent.com/document/product/1552/112542?from_cn_redirect=1). +* `priority` - (Optional, Int) MX record priority, which takes effect only when type (dns record type) is MX. the smaller the value, the higher the priority. users can specify a value range of 0-50. the default value is 0 if not specified. +* `status` - (Optional, String) DNS record resolution status, the following values: + - enable: has taken effect; + - disable: has been disabled. +* `ttl` - (Optional, Int) Cache time. users can specify a value range of 60-86400. the smaller the value, the faster the modification records will take effect in all regions. default value: 300. unit: seconds. +* `weight` - (Optional, Int) DNS record weight. users can specify a value range of -1 to 100. a value of 0 means no resolution. if not specified, the default is -1, which means no weight is set. weight configuration is only applicable when type (dns record type) is A, AAAA, or CNAME. note: for the same subdomain, different dns records with the same resolution route should either all have weights set or none have weights set. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +* `id` - ID of the resource. +* `created_on` - Creation time. +* `modified_on` - Modify time. + + +## Import + +teo teo_dns_record can be imported using the id, e.g. + +``` +terraform import tencentcloud_teo_dns_record.teo_dns_record {zoneId}#{recordId} +``` + diff --git a/website/tencentcloud.erb b/website/tencentcloud.erb index d12e439f9d..c92609db70 100644 --- a/website/tencentcloud.erb +++ b/website/tencentcloud.erb @@ -5294,6 +5294,9 @@