Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
njuCZ committed Mar 10, 2021
1 parent 12e1ab6 commit 0308e41
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ func resourceArmRoleAssignment() *schema.Resource {
},

"description": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringIsNotEmpty,
},

"condition": {
Expand Down Expand Up @@ -180,12 +181,14 @@ func resourceArmRoleAssignmentCreate(d *schema.ResourceData, meta interface{}) e
},
}

if v, ok := d.GetOk("condition"); ok {
properties.RoleAssignmentProperties.Condition = utils.String(v.(string))
}
condition := d.Get("condition").(string)
conditionVersion := d.Get("condition_version").(string)

if v, ok := d.GetOk("condition_version"); ok {
properties.RoleAssignmentProperties.ConditionVersion = utils.String(v.(string))
if condition != "" && conditionVersion != "" {
properties.RoleAssignmentProperties.Condition = utils.String(condition)
properties.RoleAssignmentProperties.ConditionVersion = utils.String(conditionVersion)
} else if condition != "" || conditionVersion != "" {
return fmt.Errorf("`condition` and `conditionVersion` should be both set or unset")
}

skipPrincipalCheck := d.Get("skip_service_principal_aad_check").(bool)
Expand Down

0 comments on commit 0308e41

Please sign in to comment.