Skip to content

Commit

Permalink
azurerm_role_definition - terraform import now sets scope to preven…
Browse files Browse the repository at this point in the history
…t a force recreate #7424
  • Loading branch information
logachev committed Jun 22, 2020
1 parent b87b17b commit d45dc27
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -189,6 +189,7 @@ func resourceArmRoleDefinitionRead(d *schema.ResourceData, meta interface{}) err
return fmt.Errorf("Error parsing Role Definition ID: %+v", err)
}
if roleDefinitionId != nil {
d.Set("scope", roleDefinitionId.scope)
d.Set("role_definition_id", roleDefinitionId.roleDefinitionId)
}
}
Expand Down Expand Up @@ -351,9 +352,9 @@ func parseRoleDefinitionId(input string) (*roleDefinitionId, error) {
return nil, fmt.Errorf("Expected Role Definition ID to be in the format `{scope}/providers/Microsoft.Authorization/roleDefinitions/{name}` but got %q", input)
}

// /{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}
// {scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}
id := roleDefinitionId{
scope: strings.TrimPrefix(segments[0], "/"),
scope: segments[0],
roleDefinitionId: segments[1],
}
return &id, nil
Expand Down

0 comments on commit d45dc27

Please sign in to comment.