mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
provider/azurerm: Support Import of azurerm_resource_group
``` % make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMResourceGroup_' ==> Checking that code complies with gofmt requirements... go generate $(go list ./... | grep -v /terraform/vendor/) TF_ACC=1 go test ./builtin/providers/azurerm -v -run=TestAccAzureRMResourceGroup_ -timeout 120m === RUN TestAccAzureRMResourceGroup_importBasic --- PASS: TestAccAzureRMResourceGroup_importBasic (92.84s) === RUN TestAccAzureRMResourceGroup_basic --- PASS: TestAccAzureRMResourceGroup_basic (91.56s) === RUN TestAccAzureRMResourceGroup_withTags --- PASS: TestAccAzureRMResourceGroup_withTags (110.42s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 294.832s ```
This commit is contained in:
parent
e4ff7649d8
commit
ef707a89a8
35
builtin/providers/azurerm/import_arm_resource_group_test.go
Normal file
35
builtin/providers/azurerm/import_arm_resource_group_test.go
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
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,
|
||||||
|
//ImportStateVerifyIgnore: []string{"resource_group_name"},
|
||||||
|
//this isn't returned from the API!
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
@ -17,6 +17,9 @@ func resourceArmResourceGroup() *schema.Resource {
|
|||||||
Update: resourceArmResourceGroupUpdate,
|
Update: resourceArmResourceGroupUpdate,
|
||||||
Exists: resourceArmResourceGroupExists,
|
Exists: resourceArmResourceGroupExists,
|
||||||
Delete: resourceArmResourceGroupDelete,
|
Delete: resourceArmResourceGroupDelete,
|
||||||
|
Importer: &schema.ResourceImporter{
|
||||||
|
State: schema.ImportStatePassthrough,
|
||||||
|
},
|
||||||
|
|
||||||
Schema: map[string]*schema.Schema{
|
Schema: map[string]*schema.Schema{
|
||||||
"name": &schema.Schema{
|
"name": &schema.Schema{
|
||||||
|
Loading…
Reference in New Issue
Block a user