Skip to content

Commit 09a06c5

Browse files
authored
fix: add non-standard default roles to filtering (#492)
Co-authored-by: Christian Lechner <22294087+lechnerc77@users.noreply.github.com>
1 parent adf5455 commit 09a06c5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

internal/btpcli/wrapper.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"net/http"
77
"net/url"
88
"os"
9+
"slices"
910
"testing"
1011

1112
"github.com/SAP/terraform-exporter-btp/pkg/tfcleanup/testutils"
@@ -128,6 +129,11 @@ func GetDefaultRoleCollectionsByDirectory(directoryId string, client *ClientFaca
128129
}
129130

130131
func GetDefaultRolesBySubaccount(subaccountId string, client *ClientFacade) (defaults []string, err error) {
132+
// Role names that are provisioned by default but cannot be identified via standard configuration
133+
var defaultRoleNameSubaccount = []string{
134+
"Application_Frontend_Developer",
135+
}
136+
131137
var roles []string
132138

133139
cliRes, _, err := client.Security.Role.ListBySubaccount(context.Background(), subaccountId)
@@ -138,7 +144,7 @@ func GetDefaultRolesBySubaccount(subaccountId string, client *ClientFacade) (def
138144

139145
for _, role := range cliRes {
140146
// The roles that are marked as IsReadOnly and contain an empty attribute list are predefined and need not be exported
141-
if role.IsReadOnly && len(role.AttributeList) == 0 {
147+
if role.IsReadOnly && len(role.AttributeList) == 0 || role.IsReadOnly && slices.Contains(defaultRoleNameSubaccount, role.Name) {
142148
roles = append(roles, role.Name)
143149
}
144150
}

0 commit comments

Comments
 (0)