Skip to content

Commit

Permalink
send ChangeRoutingRuleOrder request in update state to update the ord…
Browse files Browse the repository at this point in the history
…er of rule (#291)
  • Loading branch information
fnuva authored Feb 18, 2022
1 parent dc7d8bb commit 853ccbe
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion opsgenie/resource_opsgenie_team_routing_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ func resourceOpsGenieTeamRoutingRuleUpdate(d *schema.ResourceData, meta interfac
return err
}
name := d.Get("name").(string)
order := d.Get("order").(int)
teamId := d.Get("team_id").(string)
timezone := d.Get("timezone").(string)
timeRestriction := d.Get("time_restriction").([]interface{})
Expand Down Expand Up @@ -300,12 +301,21 @@ func resourceOpsGenieTeamRoutingRuleUpdate(d *schema.ResourceData, meta interfac
}

log.Printf("[INFO] Updating OpsGenie team routing rule '%s'", name)

_, err = client.UpdateRoutingRule(context.Background(), updateRequest)
if err != nil {
return err
}

_, err = client.ChangeRoutingRuleOrder(context.Background(), &team.ChangeRoutingRuleOrderRequest{
RoutingRuleId: d.Id(),
TeamIdentifierType: team.Id,
TeamIdentifierValue: teamId,
Order: &order,
})
if err != nil {
return err
}

return nil
}

Expand Down

0 comments on commit 853ccbe

Please sign in to comment.