Merge pull request #7620 from hashicorp/import-arm-dnszone
provider/azurerm: Support Import for `azurerm_dns_zone`
This commit is contained in:
commit
ecdc5065bf
|
@ -0,0 +1,34 @@
|
|||
package azurerm
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/hashicorp/terraform/helper/acctest"
|
||||
"github.com/hashicorp/terraform/helper/resource"
|
||||
)
|
||||
|
||||
func TestAccAzureRMDnsZone_importBasic(t *testing.T) {
|
||||
resourceName := "azurerm_dns_zone.test"
|
||||
|
||||
ri := acctest.RandInt()
|
||||
config := fmt.Sprintf(testAccAzureRMDnsZone_basic, ri, ri)
|
||||
|
||||
resource.Test(t, resource.TestCase{
|
||||
PreCheck: func() { testAccPreCheck(t) },
|
||||
Providers: testAccProviders,
|
||||
CheckDestroy: testCheckAzureRMDnsZoneDestroy,
|
||||
Steps: []resource.TestStep{
|
||||
resource.TestStep{
|
||||
Config: config,
|
||||
},
|
||||
|
||||
resource.TestStep{
|
||||
ResourceName: resourceName,
|
||||
ImportState: true,
|
||||
ImportStateVerify: true,
|
||||
ImportStateVerifyIgnore: []string{"resource_group_name"},
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
|
@ -14,6 +14,9 @@ func resourceArmDnsZone() *schema.Resource {
|
|||
Read: resourceArmDnsZoneRead,
|
||||
Update: resourceArmDnsZoneCreate,
|
||||
Delete: resourceArmDnsZoneDelete,
|
||||
Importer: &schema.ResourceImporter{
|
||||
State: schema.ImportStatePassthrough,
|
||||
},
|
||||
|
||||
Schema: map[string]*schema.Schema{
|
||||
"name": &schema.Schema{
|
||||
|
@ -110,6 +113,7 @@ func resourceArmDnsZoneRead(d *schema.ResourceData, meta interface{}) error {
|
|||
|
||||
d.Set("number_of_record_sets", resp.NumberOfRecordSets)
|
||||
d.Set("max_number_of_record_sets", resp.MaxNumberOfRecordSets)
|
||||
d.Set("name", resp.Name)
|
||||
|
||||
nameServers := make([]string, 0, len(resp.NameServers))
|
||||
for _, ns := range resp.NameServers {
|
||||
|
|
Loading…
Reference in New Issue