Skip to content

Commit

Permalink
Update azurerm_policy_assignment - location should be required wh…
Browse files Browse the repository at this point in the history
…en `identity` is assigned (#7075)

Fixes #4950

This PR enforce this logic in the code. Previously, this is only documented, but not enforced in the code.
  • Loading branch information
ArcturusZhang committed May 28, 2020
1 parent cf404ca commit 08642e2
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ func resourceArmPolicyAssignmentCreateUpdate(d *schema.ResourceData, meta interf
}

if _, ok := d.GetOk("identity"); ok {
if v := d.Get("location").(string); v == "" {
return fmt.Errorf("`location` must be set when `identity` is assigned")
}
policyIdentity := expandAzureRmPolicyIdentity(d)
assignment.Identity = policyIdentity
}
Expand Down

0 comments on commit 08642e2

Please sign in to comment.