-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Import tests for Role Definitions
``` $ acctests azurerm TestAccAzureRMRoleDefinition_import === RUN TestAccAzureRMRoleDefinition_importBasic --- PASS: TestAccAzureRMRoleDefinition_importBasic (16.32s) === RUN TestAccAzureRMRoleDefinition_importComplete --- PASS: TestAccAzureRMRoleDefinition_importComplete (14.12s) PASS ok github.com/terraform-providers/terraform-provider-azurerm/azurerm 30.462s ```
- Loading branch information
1 parent
6d8ebaa
commit 3311808
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package azurerm | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/google/uuid" | ||
"github.com/hashicorp/terraform/helper/acctest" | ||
"github.com/hashicorp/terraform/helper/resource" | ||
) | ||
|
||
func TestAccAzureRMRoleDefinition_importBasic(t *testing.T) { | ||
resourceName := "azurerm_role_definition.test" | ||
|
||
id := uuid.New().String() | ||
ri := acctest.RandInt() | ||
config := testAccAzureRMRoleDefinition_basic(id, ri) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testCheckAzureRMRoleDefinitionDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: config, | ||
}, | ||
{ | ||
ResourceName: resourceName, | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"role_definition_id", "scope"}, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func TestAccAzureRMRoleDefinition_importComplete(t *testing.T) { | ||
resourceName := "azurerm_role_definition.test" | ||
|
||
id := uuid.New().String() | ||
ri := acctest.RandInt() | ||
config := testAccAzureRMRoleDefinition_complete(id, ri) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, | ||
Providers: testAccProviders, | ||
CheckDestroy: testCheckAzureRMRoleDefinitionDestroy, | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: config, | ||
}, | ||
{ | ||
ResourceName: resourceName, | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"role_definition_id", "scope"}, | ||
}, | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters