Skip to content

Commit

Permalink
Merge pull request #253 from aquasecurity/SLK-73211-terraform-provide…
Browse files Browse the repository at this point in the history
…r-bug-terraform-for-role-mapping-doesnt-accept-commas

SLK-73211 - Change split separator for role mapping
  • Loading branch information
semyonmor authored Dec 26, 2023
2 parents 51dc661 + 06c718a commit e35bcdb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
8 changes: 4 additions & 4 deletions aquasec/resource_role_mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func resourceRoleMapping() *schema.Resource {
Schema: map[string]*schema.Schema{
"role_mapping": {
Type: schema.TypeMap,
Description: "Role Mapping is used to define the IdP role that the user will assume in Aqua",
Description: "Role Mapping is used to define the IdP role that the user will assume in Aqua. Use '|' as a separator for multiple roles.",
Elem: &schema.Schema{
Type: schema.TypeString,
},
Expand All @@ -43,7 +43,7 @@ func resourceRoleMapping() *schema.Resource {
Schema: map[string]*schema.Schema{
"role_mapping": {
Type: schema.TypeMap,
Description: "Role Mapping is used to define the IdP role that the user will assume in Aqua",
Description: "Role Mapping is used to define the IdP role that the user will assume in Aqua. Use '|' as a separator for multiple roles.",
Elem: &schema.Schema{
Type: schema.TypeString,
},
Expand All @@ -62,7 +62,7 @@ func resourceRoleMapping() *schema.Resource {
Schema: map[string]*schema.Schema{
"role_mapping": {
Type: schema.TypeMap,
Description: "Role Mapping is used to define the IdP role that the user will assume in Aqua",
Description: "Role Mapping is used to define the IdP role that the user will assume in Aqua. Use '|' as a separator for multiple roles.",
Elem: &schema.Schema{
Type: schema.TypeString,
},
Expand All @@ -81,7 +81,7 @@ func resourceRoleMapping() *schema.Resource {
Schema: map[string]*schema.Schema{
"role_mapping": {
Type: schema.TypeMap,
Description: "Role Mapping is used to define the IdP role that the user will assume in Aqua",
Description: "Role Mapping is used to define the IdP role that the user will assume in Aqua. Use '|' as a separator for multiple roles.",
Elem: &schema.Schema{
Type: schema.TypeString,
},
Expand Down
2 changes: 1 addition & 1 deletion aquasec/resource_sso.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ func convertRoleMapping(m map[string]interface{}) map[string][]string {

if len(m["role_mapping"].(map[string]interface{})) > 0 {
for key, element := range m["role_mapping"].(map[string]interface{}) {
elementArry := strings.Split(element.(string), ",")
elementArry := strings.Split(element.(string), "|")
roleMapping[key] = elementArry
}
}
Expand Down
9 changes: 5 additions & 4 deletions docs/resources/role_mapping.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ resource "aquasec_role_mapping" "role_mapping" {
saml {
role_mapping = {
Administrator = "group1"
Scanner = "group2|group3"
}
}
}
Expand Down Expand Up @@ -45,28 +46,28 @@ output "role_mapping" {

Required:

- `role_mapping` (Map of String) Role Mapping is used to define the IdP role that the user will assume in Aqua
- `role_mapping` (Map of String) Role Mapping is used to define the IdP role that the user will assume in Aqua. Use '|' as a separator for multiple roles.


<a id="nestedblock--oauth2"></a>
### Nested Schema for `oauth2`

Required:

- `role_mapping` (Map of String) Role Mapping is used to define the IdP role that the user will assume in Aqua
- `role_mapping` (Map of String) Role Mapping is used to define the IdP role that the user will assume in Aqua. Use '|' as a separator for multiple roles.


<a id="nestedblock--openid"></a>
### Nested Schema for `openid`

Required:

- `role_mapping` (Map of String) Role Mapping is used to define the IdP role that the user will assume in Aqua
- `role_mapping` (Map of String) Role Mapping is used to define the IdP role that the user will assume in Aqua. Use '|' as a separator for multiple roles.


<a id="nestedblock--saml"></a>
### Nested Schema for `saml`

Required:

- `role_mapping` (Map of String) Role Mapping is used to define the IdP role that the user will assume in Aqua
- `role_mapping` (Map of String) Role Mapping is used to define the IdP role that the user will assume in Aqua. Use '|' as a separator for multiple roles.
1 change: 1 addition & 0 deletions examples/resources/aquasec_role_mapping/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ resource "aquasec_role_mapping" "role_mapping" {
saml {
role_mapping = {
Administrator = "group1"
Scanner = "group2|group3"
}
}
}
Expand Down

0 comments on commit e35bcdb

Please sign in to comment.