Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
matttrach authored Sep 5, 2024
2 parents eb0c7c4 + 4d338b6 commit 40ff457
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions rancher2/resource_rancher2_role_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package rancher2

import (
"fmt"
"github.com/hashicorp/terraform-plugin-sdk/helper/resource"
"log"
"time"

"github.com/hashicorp/terraform-plugin-sdk/helper/resource"

"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)

Expand Down Expand Up @@ -110,7 +111,14 @@ func resourceRancher2RoleTemplateUpdate(d *schema.ResourceData, meta interface{}
"rules": expandPolicyRules(d.Get("rules").([]interface{})),
"annotations": toMapString(d.Get("annotations").(map[string]interface{})),
"labels": toMapString(d.Get("labels").(map[string]interface{})),
"externalRules": expandPolicyRules(d.Get("external_rules").([]interface{})),
}

if update["external"].(bool) {
if v, ok := d.Get("external_rules").([]interface{}); ok && len(v) > 0 {
update["externalRules"] = expandPolicyRules(v)
}
} else {
update["externalRules"] = nil
}

switch update["context"] {
Expand Down

0 comments on commit 40ff457

Please sign in to comment.