From 02c51cd4df239896ccc35e1152d1c6ed993fb263 Mon Sep 17 00:00:00 2001 From: Peter McAtominey Date: Fri, 18 Nov 2016 00:32:51 +0000 Subject: [PATCH] provider/azurerm: support import of dns record resources TF_ACC=1 go test ./builtin/providers/azurerm -v -run TestAccAzureRMDns[A-z]+Record_importBasic -timeout 120m === RUN TestAccAzureRMDnsARecord_importBasic --- PASS: TestAccAzureRMDnsARecord_importBasic (102.84s) === RUN TestAccAzureRMDnsAAAARecord_importBasic --- PASS: TestAccAzureRMDnsAAAARecord_importBasic (100.59s) === RUN TestAccAzureRMDnsCNameRecord_importBasic --- PASS: TestAccAzureRMDnsCNameRecord_importBasic (98.94s) === RUN TestAccAzureRMDnsMxRecord_importBasic --- PASS: TestAccAzureRMDnsMxRecord_importBasic (107.30s) === RUN TestAccAzureRMDnsNsRecord_importBasic --- PASS: TestAccAzureRMDnsNsRecord_importBasic (98.55s) === RUN TestAccAzureRMDnsSrvRecord_importBasic --- PASS: TestAccAzureRMDnsSrvRecord_importBasic (100.19s) === RUN TestAccAzureRMDnsTxtRecord_importBasic --- PASS: TestAccAzureRMDnsTxtRecord_importBasic (97.49s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 706.000s --- .../azurerm/import_arm_dns_a_record_test.go | 33 +++++++++++++++++++ .../import_arm_dns_aaaa_record_test.go | 33 +++++++++++++++++++ .../import_arm_dns_cname_record_test.go | 33 +++++++++++++++++++ .../azurerm/import_arm_dns_mx_record_test.go | 33 +++++++++++++++++++ .../azurerm/import_arm_dns_ns_record_test.go | 33 +++++++++++++++++++ .../azurerm/import_arm_dns_srv_record_test.go | 33 +++++++++++++++++++ .../azurerm/import_arm_dns_txt_record_test.go | 33 +++++++++++++++++++ .../azurerm/resource_arm_dns_a_record.go | 11 +++++++ .../azurerm/resource_arm_dns_aaaa_record.go | 11 +++++++ .../azurerm/resource_arm_dns_cname_record.go | 11 +++++++ .../azurerm/resource_arm_dns_mx_record.go | 11 +++++++ .../azurerm/resource_arm_dns_ns_record.go | 11 +++++++ .../azurerm/resource_arm_dns_srv_record.go | 11 +++++++ .../azurerm/resource_arm_dns_txt_record.go | 11 +++++++ .../azurerm/r/dns_a_record.html.markdown | 8 +++++ .../azurerm/r/dns_aaaa_record.html.markdown | 8 +++++ .../azurerm/r/dns_cname_record.html.markdown | 8 +++++ .../azurerm/r/dns_mx_record.html.markdown | 8 +++++ .../azurerm/r/dns_ns_record.html.markdown | 8 +++++ .../azurerm/r/dns_srv_record.html.markdown | 8 +++++ .../azurerm/r/dns_txt_record.html.markdown | 8 +++++ 21 files changed, 364 insertions(+) create mode 100644 builtin/providers/azurerm/import_arm_dns_a_record_test.go create mode 100644 builtin/providers/azurerm/import_arm_dns_aaaa_record_test.go create mode 100644 builtin/providers/azurerm/import_arm_dns_cname_record_test.go create mode 100644 builtin/providers/azurerm/import_arm_dns_mx_record_test.go create mode 100644 builtin/providers/azurerm/import_arm_dns_ns_record_test.go create mode 100644 builtin/providers/azurerm/import_arm_dns_srv_record_test.go create mode 100644 builtin/providers/azurerm/import_arm_dns_txt_record_test.go diff --git a/builtin/providers/azurerm/import_arm_dns_a_record_test.go b/builtin/providers/azurerm/import_arm_dns_a_record_test.go new file mode 100644 index 000000000000..373239e56c98 --- /dev/null +++ b/builtin/providers/azurerm/import_arm_dns_a_record_test.go @@ -0,0 +1,33 @@ +package azurerm + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAzureRMDnsARecord_importBasic(t *testing.T) { + resourceName := "azurerm_dns_a_record.test" + + ri := acctest.RandInt() + config := fmt.Sprintf(testAccAzureRMDnsARecord_basic, ri, ri, ri) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDnsARecordDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: config, + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/builtin/providers/azurerm/import_arm_dns_aaaa_record_test.go b/builtin/providers/azurerm/import_arm_dns_aaaa_record_test.go new file mode 100644 index 000000000000..dbf38511015c --- /dev/null +++ b/builtin/providers/azurerm/import_arm_dns_aaaa_record_test.go @@ -0,0 +1,33 @@ +package azurerm + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAzureRMDnsAAAARecord_importBasic(t *testing.T) { + resourceName := "azurerm_dns_aaaa_record.test" + + ri := acctest.RandInt() + config := fmt.Sprintf(testAccAzureRMDnsAAAARecord_basic, ri, ri, ri) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDnsAAAARecordDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: config, + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/builtin/providers/azurerm/import_arm_dns_cname_record_test.go b/builtin/providers/azurerm/import_arm_dns_cname_record_test.go new file mode 100644 index 000000000000..a4e376060b6a --- /dev/null +++ b/builtin/providers/azurerm/import_arm_dns_cname_record_test.go @@ -0,0 +1,33 @@ +package azurerm + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAzureRMDnsCNameRecord_importBasic(t *testing.T) { + resourceName := "azurerm_dns_cname_record.test" + + ri := acctest.RandInt() + config := fmt.Sprintf(testAccAzureRMDnsCNameRecord_basic, ri, ri, ri) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDnsCNameRecordDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: config, + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/builtin/providers/azurerm/import_arm_dns_mx_record_test.go b/builtin/providers/azurerm/import_arm_dns_mx_record_test.go new file mode 100644 index 000000000000..ef87fffd1338 --- /dev/null +++ b/builtin/providers/azurerm/import_arm_dns_mx_record_test.go @@ -0,0 +1,33 @@ +package azurerm + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAzureRMDnsMxRecord_importBasic(t *testing.T) { + resourceName := "azurerm_dns_mx_record.test" + + ri := acctest.RandInt() + config := fmt.Sprintf(testAccAzureRMDnsMxRecord_basic, ri, ri, ri) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDnsMxRecordDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: config, + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/builtin/providers/azurerm/import_arm_dns_ns_record_test.go b/builtin/providers/azurerm/import_arm_dns_ns_record_test.go new file mode 100644 index 000000000000..ea2a1a61122e --- /dev/null +++ b/builtin/providers/azurerm/import_arm_dns_ns_record_test.go @@ -0,0 +1,33 @@ +package azurerm + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAzureRMDnsNsRecord_importBasic(t *testing.T) { + resourceName := "azurerm_dns_ns_record.test" + + ri := acctest.RandInt() + config := fmt.Sprintf(testAccAzureRMDnsNsRecord_basic, ri, ri, ri) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDnsNsRecordDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: config, + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/builtin/providers/azurerm/import_arm_dns_srv_record_test.go b/builtin/providers/azurerm/import_arm_dns_srv_record_test.go new file mode 100644 index 000000000000..0d4de6bae0f5 --- /dev/null +++ b/builtin/providers/azurerm/import_arm_dns_srv_record_test.go @@ -0,0 +1,33 @@ +package azurerm + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAzureRMDnsSrvRecord_importBasic(t *testing.T) { + resourceName := "azurerm_dns_srv_record.test" + + ri := acctest.RandInt() + config := fmt.Sprintf(testAccAzureRMDnsSrvRecord_basic, ri, ri, ri) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDnsSrvRecordDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: config, + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/builtin/providers/azurerm/import_arm_dns_txt_record_test.go b/builtin/providers/azurerm/import_arm_dns_txt_record_test.go new file mode 100644 index 000000000000..30abf25a6ea1 --- /dev/null +++ b/builtin/providers/azurerm/import_arm_dns_txt_record_test.go @@ -0,0 +1,33 @@ +package azurerm + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform/helper/acctest" + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAzureRMDnsTxtRecord_importBasic(t *testing.T) { + resourceName := "azurerm_dns_txt_record.test" + + ri := acctest.RandInt() + config := fmt.Sprintf(testAccAzureRMDnsTxtRecord_basic, ri, ri, ri) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testCheckAzureRMDnsTxtRecordDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: config, + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/builtin/providers/azurerm/resource_arm_dns_a_record.go b/builtin/providers/azurerm/resource_arm_dns_a_record.go index 004308e64b4a..ba56deb637ae 100644 --- a/builtin/providers/azurerm/resource_arm_dns_a_record.go +++ b/builtin/providers/azurerm/resource_arm_dns_a_record.go @@ -14,6 +14,9 @@ func resourceArmDnsARecord() *schema.Resource { Read: resourceArmDnsARecordRead, Update: resourceArmDnsARecordCreate, Delete: resourceArmDnsARecordDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "name": &schema.Schema{ @@ -111,6 +114,11 @@ func resourceArmDnsARecordRead(d *schema.ResourceData, meta interface{}) error { client := meta.(*ArmClient) rivieraClient := client.rivieraClient + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + readRequest := rivieraClient.NewRequestForURI(d.Id()) readRequest.Command = &dns.GetARecordSet{} @@ -126,6 +134,9 @@ func resourceArmDnsARecordRead(d *schema.ResourceData, meta interface{}) error { resp := readResponse.Parsed.(*dns.GetARecordSetResponse) + d.Set("name", resp.Name) + d.Set("resource_group_name", id.ResourceGroup) + d.Set("zone_name", id.Path["dnszones"]) d.Set("ttl", resp.TTL) if resp.ARecords != nil { diff --git a/builtin/providers/azurerm/resource_arm_dns_aaaa_record.go b/builtin/providers/azurerm/resource_arm_dns_aaaa_record.go index 68c465a9884f..5246e9f4cae2 100644 --- a/builtin/providers/azurerm/resource_arm_dns_aaaa_record.go +++ b/builtin/providers/azurerm/resource_arm_dns_aaaa_record.go @@ -14,6 +14,9 @@ func resourceArmDnsAAAARecord() *schema.Resource { Read: resourceArmDnsAAAARecordRead, Update: resourceArmDnsAAAARecordCreate, Delete: resourceArmDnsAAAARecordDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "name": &schema.Schema{ @@ -111,6 +114,11 @@ func resourceArmDnsAAAARecordRead(d *schema.ResourceData, meta interface{}) erro client := meta.(*ArmClient) rivieraClient := client.rivieraClient + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + readRequest := rivieraClient.NewRequestForURI(d.Id()) readRequest.Command = &dns.GetAAAARecordSet{} @@ -126,6 +134,9 @@ func resourceArmDnsAAAARecordRead(d *schema.ResourceData, meta interface{}) erro resp := readResponse.Parsed.(*dns.GetAAAARecordSetResponse) + d.Set("name", resp.Name) + d.Set("resource_group_name", id.ResourceGroup) + d.Set("zone_name", id.Path["dnszones"]) d.Set("ttl", resp.TTL) if resp.AAAARecords != nil { diff --git a/builtin/providers/azurerm/resource_arm_dns_cname_record.go b/builtin/providers/azurerm/resource_arm_dns_cname_record.go index 5d97662b7b55..7541fc46c511 100644 --- a/builtin/providers/azurerm/resource_arm_dns_cname_record.go +++ b/builtin/providers/azurerm/resource_arm_dns_cname_record.go @@ -14,6 +14,9 @@ func resourceArmDnsCNameRecord() *schema.Resource { Read: resourceArmDnsCNameRecordRead, Update: resourceArmDnsCNameRecordCreate, Delete: resourceArmDnsCNameRecordDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "name": &schema.Schema{ @@ -111,6 +114,11 @@ func resourceArmDnsCNameRecordRead(d *schema.ResourceData, meta interface{}) err client := meta.(*ArmClient) rivieraClient := client.rivieraClient + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + readRequest := rivieraClient.NewRequestForURI(d.Id()) readRequest.Command = &dns.GetCNAMERecordSet{} @@ -126,6 +134,9 @@ func resourceArmDnsCNameRecordRead(d *schema.ResourceData, meta interface{}) err resp := readResponse.Parsed.(*dns.GetCNAMERecordSetResponse) + d.Set("name", resp.Name) + d.Set("resource_group_name", id.ResourceGroup) + d.Set("zone_name", id.Path["dnszones"]) d.Set("ttl", resp.TTL) d.Set("record", resp.CNAMERecord.CNAME) diff --git a/builtin/providers/azurerm/resource_arm_dns_mx_record.go b/builtin/providers/azurerm/resource_arm_dns_mx_record.go index ec601f1660c3..d4881c5f5149 100644 --- a/builtin/providers/azurerm/resource_arm_dns_mx_record.go +++ b/builtin/providers/azurerm/resource_arm_dns_mx_record.go @@ -16,6 +16,9 @@ func resourceArmDnsMxRecord() *schema.Resource { Read: resourceArmDnsMxRecordRead, Update: resourceArmDnsMxRecordCreate, Delete: resourceArmDnsMxRecordDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "name": &schema.Schema{ @@ -122,6 +125,11 @@ func resourceArmDnsMxRecordRead(d *schema.ResourceData, meta interface{}) error client := meta.(*ArmClient) rivieraClient := client.rivieraClient + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + readRequest := rivieraClient.NewRequestForURI(d.Id()) readRequest.Command = &dns.GetMXRecordSet{} @@ -137,6 +145,9 @@ func resourceArmDnsMxRecordRead(d *schema.ResourceData, meta interface{}) error resp := readResponse.Parsed.(*dns.GetMXRecordSetResponse) + d.Set("name", resp.Name) + d.Set("resource_group_name", id.ResourceGroup) + d.Set("zone_name", id.Path["dnszones"]) d.Set("ttl", resp.TTL) if err := d.Set("record", flattenAzureRmDnsMxRecord(resp.MXRecords)); err != nil { diff --git a/builtin/providers/azurerm/resource_arm_dns_ns_record.go b/builtin/providers/azurerm/resource_arm_dns_ns_record.go index 09f33d32a7db..17173239b246 100644 --- a/builtin/providers/azurerm/resource_arm_dns_ns_record.go +++ b/builtin/providers/azurerm/resource_arm_dns_ns_record.go @@ -14,6 +14,9 @@ func resourceArmDnsNsRecord() *schema.Resource { Read: resourceArmDnsNsRecordRead, Update: resourceArmDnsNsRecordCreate, Delete: resourceArmDnsNsRecordDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "name": &schema.Schema{ @@ -114,6 +117,11 @@ func resourceArmDnsNsRecordRead(d *schema.ResourceData, meta interface{}) error client := meta.(*ArmClient) rivieraClient := client.rivieraClient + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + readRequest := rivieraClient.NewRequestForURI(d.Id()) readRequest.Command = &dns.GetNSRecordSet{} @@ -129,6 +137,9 @@ func resourceArmDnsNsRecordRead(d *schema.ResourceData, meta interface{}) error resp := readResponse.Parsed.(*dns.GetNSRecordSetResponse) + d.Set("name", resp.Name) + d.Set("resource_group_name", id.ResourceGroup) + d.Set("zone_name", id.Path["dnszones"]) d.Set("ttl", resp.TTL) if resp.NSRecords != nil { diff --git a/builtin/providers/azurerm/resource_arm_dns_srv_record.go b/builtin/providers/azurerm/resource_arm_dns_srv_record.go index 4a2f446a0b55..ca7e2bac5c45 100644 --- a/builtin/providers/azurerm/resource_arm_dns_srv_record.go +++ b/builtin/providers/azurerm/resource_arm_dns_srv_record.go @@ -16,6 +16,9 @@ func resourceArmDnsSrvRecord() *schema.Resource { Read: resourceArmDnsSrvRecordRead, Update: resourceArmDnsSrvRecordCreate, Delete: resourceArmDnsSrvRecordDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "name": &schema.Schema{ @@ -132,6 +135,11 @@ func resourceArmDnsSrvRecordRead(d *schema.ResourceData, meta interface{}) error client := meta.(*ArmClient) rivieraClient := client.rivieraClient + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + readRequest := rivieraClient.NewRequestForURI(d.Id()) readRequest.Command = &dns.GetSRVRecordSet{} @@ -147,6 +155,9 @@ func resourceArmDnsSrvRecordRead(d *schema.ResourceData, meta interface{}) error resp := readResponse.Parsed.(*dns.GetSRVRecordSetResponse) + d.Set("name", resp.Name) + d.Set("resource_group_name", id.ResourceGroup) + d.Set("zone_name", id.Path["dnszones"]) d.Set("ttl", resp.TTL) if err := d.Set("record", flattenAzureRmDnsSrvRecord(resp.SRVRecords)); err != nil { diff --git a/builtin/providers/azurerm/resource_arm_dns_txt_record.go b/builtin/providers/azurerm/resource_arm_dns_txt_record.go index d4f71dba5f66..37f45deee40e 100644 --- a/builtin/providers/azurerm/resource_arm_dns_txt_record.go +++ b/builtin/providers/azurerm/resource_arm_dns_txt_record.go @@ -14,6 +14,9 @@ func resourceArmDnsTxtRecord() *schema.Resource { Read: resourceArmDnsTxtRecordRead, Update: resourceArmDnsTxtRecordCreate, Delete: resourceArmDnsTxtRecordDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "name": &schema.Schema{ @@ -114,6 +117,11 @@ func resourceArmDnsTxtRecordRead(d *schema.ResourceData, meta interface{}) error client := meta.(*ArmClient) rivieraClient := client.rivieraClient + id, err := parseAzureResourceID(d.Id()) + if err != nil { + return err + } + readRequest := rivieraClient.NewRequestForURI(d.Id()) readRequest.Command = &dns.GetTXTRecordSet{} @@ -129,6 +137,9 @@ func resourceArmDnsTxtRecordRead(d *schema.ResourceData, meta interface{}) error resp := readResponse.Parsed.(*dns.GetTXTRecordSetResponse) + d.Set("name", resp.Name) + d.Set("resource_group_name", id.ResourceGroup) + d.Set("zone_name", id.Path["dnszones"]) d.Set("ttl", resp.TTL) if resp.TXTRecords != nil { diff --git a/website/source/docs/providers/azurerm/r/dns_a_record.html.markdown b/website/source/docs/providers/azurerm/r/dns_a_record.html.markdown index 63399e76226e..764f792afe8b 100644 --- a/website/source/docs/providers/azurerm/r/dns_a_record.html.markdown +++ b/website/source/docs/providers/azurerm/r/dns_a_record.html.markdown @@ -51,3 +51,11 @@ The following arguments are supported: The following attributes are exported: * `id` - The DNS A Record ID. + +## Import + +A records can be imported using the `resource id`, e.g. + +``` +terraform import azurerm_dns_a_record.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/dnsZones/zone1/A/myrecord1 +``` diff --git a/website/source/docs/providers/azurerm/r/dns_aaaa_record.html.markdown b/website/source/docs/providers/azurerm/r/dns_aaaa_record.html.markdown index 5088d0fefc66..14f31a13ede8 100644 --- a/website/source/docs/providers/azurerm/r/dns_aaaa_record.html.markdown +++ b/website/source/docs/providers/azurerm/r/dns_aaaa_record.html.markdown @@ -51,3 +51,11 @@ The following arguments are supported: The following attributes are exported: * `id` - The DNS AAAA Record ID. + +## Import + +AAAA records can be imported using the `resource id`, e.g. + +``` +terraform import azurerm_dns_aaaa_record.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/dnsZones/zone1/AAAA/myrecord1 +``` diff --git a/website/source/docs/providers/azurerm/r/dns_cname_record.html.markdown b/website/source/docs/providers/azurerm/r/dns_cname_record.html.markdown index a358a0b39935..cbb206959fcb 100644 --- a/website/source/docs/providers/azurerm/r/dns_cname_record.html.markdown +++ b/website/source/docs/providers/azurerm/r/dns_cname_record.html.markdown @@ -51,3 +51,11 @@ The following arguments are supported: The following attributes are exported: * `id` - The DNS CName Record ID. + +## Import + +CNAME records can be imported using the `resource id`, e.g. + +``` +terraform import azurerm_dns_cname_record.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/dnsZones/zone1/CNAME/myrecord1 +``` diff --git a/website/source/docs/providers/azurerm/r/dns_mx_record.html.markdown b/website/source/docs/providers/azurerm/r/dns_mx_record.html.markdown index 961979162b4a..b3731090d016 100644 --- a/website/source/docs/providers/azurerm/r/dns_mx_record.html.markdown +++ b/website/source/docs/providers/azurerm/r/dns_mx_record.html.markdown @@ -70,3 +70,11 @@ The `record` block supports: The following attributes are exported: * `id` - The DNS MX Record ID. + +## Import + +MX records can be imported using the `resource id`, e.g. + +``` +terraform import azurerm_dns_mx_record.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/dnsZones/zone1/MX/myrecord1 +``` diff --git a/website/source/docs/providers/azurerm/r/dns_ns_record.html.markdown b/website/source/docs/providers/azurerm/r/dns_ns_record.html.markdown index e160a1199bdb..fff7a8d1608e 100644 --- a/website/source/docs/providers/azurerm/r/dns_ns_record.html.markdown +++ b/website/source/docs/providers/azurerm/r/dns_ns_record.html.markdown @@ -65,3 +65,11 @@ The `record` block supports: The following attributes are exported: * `id` - The DNS NS Record ID. + +## Import + +NS records can be imported using the `resource id`, e.g. + +``` +terraform import azurerm_dns_ns_record.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/dnsZones/zone1/NS/myrecord1 +``` diff --git a/website/source/docs/providers/azurerm/r/dns_srv_record.html.markdown b/website/source/docs/providers/azurerm/r/dns_srv_record.html.markdown index 2a783a71455d..8fea38350ea1 100644 --- a/website/source/docs/providers/azurerm/r/dns_srv_record.html.markdown +++ b/website/source/docs/providers/azurerm/r/dns_srv_record.html.markdown @@ -72,3 +72,11 @@ The `record` block supports: The following attributes are exported: * `id` - The DNS SRV Record ID. + +## Import + +SRV records can be imported using the `resource id`, e.g. + +``` +terraform import azurerm_dns_srv_record.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/dnsZones/zone1/SRV/myrecord1 +``` diff --git a/website/source/docs/providers/azurerm/r/dns_txt_record.html.markdown b/website/source/docs/providers/azurerm/r/dns_txt_record.html.markdown index df8e55f7ce37..4fe259dfefdc 100644 --- a/website/source/docs/providers/azurerm/r/dns_txt_record.html.markdown +++ b/website/source/docs/providers/azurerm/r/dns_txt_record.html.markdown @@ -64,3 +64,11 @@ The `record` block supports: The following attributes are exported: * `id` - The DNS TXT Record ID. + +## Import + +TXT records can be imported using the `resource id`, e.g. + +``` +terraform import azurerm_dns_txt_record.test /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/dnsZones/zone1/TXT/myrecord1 +```