From c0625e04d444d4de079c19cda417bb839c6c82ac Mon Sep 17 00:00:00 2001 From: Logan Cox Date: Thu, 25 Jan 2024 13:41:10 +0000 Subject: [PATCH] feat: move to case as per ci feedback --- .../services/authorization/role_assignment_resource.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/services/authorization/role_assignment_resource.go b/internal/services/authorization/role_assignment_resource.go index e1749097db6e..f62c9f00d4a6 100644 --- a/internal/services/authorization/role_assignment_resource.go +++ b/internal/services/authorization/role_assignment_resource.go @@ -229,13 +229,14 @@ func resourceArmRoleAssignmentCreate(d *pluginsdk.ResourceData, meta interface{} condition := d.Get("condition").(string) conditionVersion := d.Get("condition_version").(string) - if condition != "" && conditionVersion != "" { + switch { + case condition != "" && conditionVersion != "": properties.RoleAssignmentProperties.Condition = utils.String(condition) properties.RoleAssignmentProperties.ConditionVersion = utils.String(conditionVersion) - } else if condition != "" && conditionVersion == "" { + case condition != "" && conditionVersion == "": properties.RoleAssignmentProperties.Condition = utils.String(condition) properties.RoleAssignmentProperties.ConditionVersion = utils.String("2.0") - } else if condition == "" && conditionVersion != "" { + case condition == "" && conditionVersion != "": return fmt.Errorf("`conditionVersion` should not be set without `condition`") }