Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed legacy check and updated test #5733

Merged
merged 3 commits into from
Feb 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,6 @@ func dataSourceArmRoleDefinitionRead(d *schema.ResourceData, meta interface{}) e
// search by name
var role authorization.RoleDefinition
if name != "" {
// TODO: remove this in 2.0
if name == "VirtualMachineContributor" {
name = "Virtual Machine Contributor"
}

roleDefinitions, err := client.List(ctx, scope, fmt.Sprintf("roleName eq '%s'", name))
if err != nil {
return fmt.Errorf("Error loading Role Definition List: %+v", err)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

func TestAccDataSourceAzureRMClientConfig_basic(t *testing.T) {
data := acceptance.BuildTestData(t, "data.azurerm_client_config", "test")
data := acceptance.BuildTestData(t, "data.azurerm_client_config", "current")
clientId := os.Getenv("ARM_CLIENT_ID")
tenantId := os.Getenv("ARM_TENANT_ID")
subscriptionId := os.Getenv("ARM_SUBSCRIPTION_ID")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,12 @@ func TestAccDataSourceAzureRMRoleDefinition_builtIn_virtualMachineContributor(t
Providers: acceptance.SupportedProviders,
Steps: []resource.TestStep{
{
Config: testAccDataSourceAzureRMRoleDefinition_builtIn("VirtualMachineContributor"),
Config: testAccDataSourceAzureRMRoleDefinition_builtIn("Virtual Machine Contributor"),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(data.ResourceName, "id", "/providers/Microsoft.Authorization/roleDefinitions/9980e02c-c2be-4d73-94e8-173b1dc7cf3c"),
resource.TestCheckResourceAttrSet(data.ResourceName, "description"),
resource.TestCheckResourceAttrSet(data.ResourceName, "type"),
resource.TestCheckResourceAttr(data.ResourceName, "permissions.#", "1"),
resource.TestCheckResourceAttr(data.ResourceName, "permissions.0.actions.#", "38"),
resource.TestCheckResourceAttr(data.ResourceName, "permissions.0.actions.0", "Microsoft.Authorization/*/read"),
resource.TestCheckResourceAttr(data.ResourceName, "permissions.0.actions.15", "Microsoft.Network/networkSecurityGroups/join/action"),
resource.TestCheckResourceAttr(data.ResourceName, "permissions.0.not_actions.#", "0"),
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ func testCheckAzureRMRoleAssignmentDestroy(s *terraform.State) error {
return nil
}

// TODO - "real" management group with appropriate required for testing
func testAccAzureRMRoleAssignment_managementGroup(t *testing.T) {
groupId := uuid.New().String()

Expand Down Expand Up @@ -373,10 +374,10 @@ func testAccAzureRMRoleAssignment_requiresImportConfig(id string) string {
%s

resource "azurerm_role_assignment" "import" {
name = "${azurerm_role_assignment.primary.name}"
scope = "${azurerm_role_assignment.primary.id}"
role_definition_name = "${azurerm_role_assignment.primary.role_definition_name}"
principal_id = "${azurerm_role_assignment.primary.principal_id}"
name = "${azurerm_role_assignment.test.name}"
scope = "${azurerm_role_assignment.test.id}"
role_definition_name = "${azurerm_role_assignment.test.role_definition_name}"
principal_id = "${azurerm_role_assignment.test.principal_id}"
}
`, testAccAzureRMRoleAssignment_roleNameConfig(id))
}
Expand Down