Merge pull request #7574 from hashicorp/import-arm-rg

provider/azurerm: Support Import of `azurerm_resource_group`
This commit is contained in:
James Nugent 2016-07-11 10:35:41 -06:00 committed by GitHub
commit 4798b13937
2 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,33 @@
package azurerm
import (
"fmt"
"testing"
"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)
func TestAccAzureRMResourceGroup_importBasic(t *testing.T) {
resourceName := "azurerm_resource_group.test"
ri := acctest.RandInt()
config := fmt.Sprintf(testAccAzureRMResourceGroup_basic, ri)
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMResourceGroupDestroy,
Steps: []resource.TestStep{
resource.TestStep{
Config: config,
},
resource.TestStep{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

View File

@ -17,6 +17,9 @@ func resourceArmResourceGroup() *schema.Resource {
Update: resourceArmResourceGroupUpdate,
Exists: resourceArmResourceGroupExists,
Delete: resourceArmResourceGroupDelete,
Importer: &schema.ResourceImporter{
State: schema.ImportStatePassthrough,
},
Schema: map[string]*schema.Schema{
"name": &schema.Schema{