Skip to content

Commit

Permalink
2.11.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kwent committed Dec 2, 2024
1 parent 445d147 commit dca1a58
Show file tree
Hide file tree
Showing 17 changed files with 1,280 additions and 142 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## [2.11.0] -- 2024-12-02

- Add `alert_sources` resources

## [2.10.0] -- 2024-11-08

- Add `rootly_on_call_role` resource
Expand Down
2 changes: 1 addition & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type Client struct {
func (c *Client) Do(req *http.Request) (*http.Response, error) {
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", c.Token))
req.Header.Set("Content-Type", c.ContentType)
req.Header.Set("User-Agent", "terraform-provider-rootly/v2.10.0")
req.Header.Set("User-Agent", "terraform-provider-rootly/v2.11.0")

res, err := c.Rootly.Client.Do(req)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions client/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type Service struct {
ServiceIds []interface{} `jsonapi:"attr,service_ids,omitempty"`
OwnersGroupIds []interface{} `jsonapi:"attr,owners_group_ids,omitempty"`
OwnersUserIds []interface{} `jsonapi:"attr,owners_user_ids,omitempty"`
AlertUrgencyId string `jsonapi:"attr,alert_urgency_id,omitempty"`
SlackChannels []interface{} `jsonapi:"attr,slack_channels,omitempty"`
SlackAliases []interface{} `jsonapi:"attr,slack_aliases,omitempty"`
}
Expand Down
1 change: 1 addition & 0 deletions client/teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type Team struct {
CortexId string `jsonapi:"attr,cortex_id,omitempty"`
ServiceNowCiSysId string `jsonapi:"attr,service_now_ci_sys_id,omitempty"`
UserIds []interface{} `jsonapi:"attr,user_ids,omitempty"`
AlertUrgencyId string `jsonapi:"attr,alert_urgency_id,omitempty"`
SlackChannels []interface{} `jsonapi:"attr,slack_channels,omitempty"`
SlackAliases []interface{} `jsonapi:"attr,slack_aliases,omitempty"`
}
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/escalation_path.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ description: |-
### Required

- `name` (String) The name of the escalation path
- `rules` (Block List, Min: 1) Escalation path rules (see [below for nested schema](#nestedblock--rules))

### Optional

Expand All @@ -25,7 +26,6 @@ description: |-
- `notification_type` (String) Notification rule type
- `repeat` (Boolean) Whether this path should be repeated until someone acknowledges the alert. Value must be one of true or false
- `repeat_count` (Number) The number of times this path will be executed until someone acknowledges the alert
- `rules` (Block List) Escalation path rules (see [below for nested schema](#nestedblock--rules))

### Read-Only

Expand Down
1 change: 1 addition & 0 deletions docs/resources/service.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ resource "rootly_service" "customer_postgresql_prod" {

### Optional

- `alert_urgency_id` (String) The alert urgency id of the service
- `backstage_id` (String) The Backstage entity id associated to this service. eg: :namespace/:kind/:entity_name
- `color` (String) The hex color of the service
- `cortex_id` (String) The Cortex group id associated to this service
Expand Down
5 changes: 3 additions & 2 deletions docs/resources/team.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ description: |-

### Optional

- `alert_urgency_id` (String) The alert urgency id of the team
- `color` (String) The hex color of the team
- `cortex_id` (String) The Cortex group id associated to this team
- `description` (String) The description of the team
Expand All @@ -30,8 +31,8 @@ description: |-
- `pagertree_id` (String) The PagerTree group id associated to this team
- `position` (Number) Position of the team
- `service_now_ci_sys_id` (String) The Service Now CI sys id associated to this team
- `slack_aliases` (Block List) Slack Aliases associated with this service (see [below for nested schema](#nestedblock--slack_aliases))
- `slack_channels` (Block List) Slack Channels associated with this service (see [below for nested schema](#nestedblock--slack_channels))
- `slack_aliases` (Block List) Slack Aliases associated with this team (see [below for nested schema](#nestedblock--slack_aliases))
- `slack_channels` (Block List) Slack Channels associated with this team (see [below for nested schema](#nestedblock--slack_channels))
- `slug` (String)
- `user_ids` (List of Number) The User ID's members of this team
- `victor_ops_id` (String) The VictorOps group id associated to this team
Expand Down
1 change: 1 addition & 0 deletions docs/resources/workflow_task_create_opsgenie_alert.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Required:
Optional:

- `description` (String) Description field of the alert that is generally used to provide a detailed information about the alert
- `details` (String) Details payload. Can contain liquid markup and need to be valid JSON
- `escalations` (Block List) (see [below for nested schema](#nestedblock--task_params--escalations))
- `priority` (String) Value must be one of `P1`, `P2`, `P3`, `P4`, `P5`, `auto`.
- `schedules` (Block List) (see [below for nested schema](#nestedblock--task_params--schedules))
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/workflow_task_send_slack_message.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Required:

Optional:

- `actionables` (List of String) Value must be one of `update_summary`, `update_status`, `archive_channel`, `manage_incident_roles`, `update_incident`, `all_commands`, `leave_feedback`, `manage_form_fields`, `manage_action_items`, `view_tasks`, `add_pagerduty_responders`, `add_opsgenie_responders`, `add_victor_ops_responders`, `snooze_reminder`, `pause_reminder`, `restart_reminder`, `update_status_page`, `cancel_incident`, `delete_message`.
- `actionables` (List of String) Value must be one of `update_summary`, `update_status`, `archive_channel`, `manage_incident_roles`, `update_incident`, `all_commands`, `leave_feedback`, `manage_form_fields`, `manage_action_items`, `view_tasks`, `add_pagerduty_responders`, `add_opsgenie_responders`, `add_victor_ops_responders`, `update_status_page`, `pause_reminder`, `snooze_reminder`, `restart_reminder`, `cancel_incident`, `delete_message`.
- `broadcast_thread_reply_to_channel` (Boolean) Value must be one of true or false
- `channels` (Block List) (see [below for nested schema](#nestedblock--task_params--channels))
- `color` (String) A hex color
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ require (
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/sync v0.9.0 // indirect
golang.org/x/text v0.20.0 // indirect
golang.org/x/tools v0.24.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240826202546-f6391c0de4c7 // indirect
google.golang.org/grpc v1.65.0 // indirect
Expand All @@ -82,7 +82,7 @@ require (
github.com/google/jsonapi v1.0.0
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-retryablehttp v0.7.7
github.com/hashicorp/terraform-plugin-docs v0.20.0
github.com/hashicorp/terraform-plugin-docs v0.20.1
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0
github.com/pkg/errors v0.9.1
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ github.com/hashicorp/terraform-plugin-docs v0.19.4 h1:G3Bgo7J22OMtegIgn8Cd/CaSey
github.com/hashicorp/terraform-plugin-docs v0.19.4/go.mod h1:4pLASsatTmRynVzsjEhbXZ6s7xBlUw/2Kt0zfrq8HxA=
github.com/hashicorp/terraform-plugin-docs v0.20.0 h1:ox7rm1FN0dVZaJBUzkVVh10R1r3+FeMQWL0QopQ9d7o=
github.com/hashicorp/terraform-plugin-docs v0.20.0/go.mod h1:A/+4SVMdAkQYtIBtaxV0H7AU862TxVZk/hhKaMDQB6Y=
github.com/hashicorp/terraform-plugin-docs v0.20.1 h1:Fq7E/HrU8kuZu3hNliZGwloFWSYfWEOWnylFhYQIoys=
github.com/hashicorp/terraform-plugin-docs v0.20.1/go.mod h1:Yz6HoK7/EgzSrHPB9J/lWFzwl9/xep2OPnc5jaJDV90=
github.com/hashicorp/terraform-plugin-go v0.23.0 h1:AALVuU1gD1kPb48aPQUjug9Ir/125t+AAurhqphJ2Co=
github.com/hashicorp/terraform-plugin-go v0.23.0/go.mod h1:1E3Cr9h2vMlahWMbsSEcNrOCxovCZhOOIXjFHbjc/lQ=
github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0=
Expand Down Expand Up @@ -256,6 +258,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ=
golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand Down Expand Up @@ -284,6 +288,8 @@ golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
Expand Down
6 changes: 3 additions & 3 deletions provider/resource_escalation_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ func resourceEscalationPath() *schema.Resource {

"rules": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Required: false,
Optional: true,
Computed: false,
Required: true,
Optional: false,
Description: "Escalation path rules",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Expand Down
16 changes: 16 additions & 0 deletions provider/resource_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,15 @@ func resourceService() *schema.Resource {
Description: "Owner Users associated with this service",
},

"alert_urgency_id": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Required: false,
Optional: true,
ForceNew: false,
Description: "The alert urgency id of the service",
},

"slack_channels": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Expand Down Expand Up @@ -349,6 +358,9 @@ func resourceServiceCreate(ctx context.Context, d *schema.ResourceData, meta int
if value, ok := d.GetOkExists("owners_user_ids"); ok {
s.OwnersUserIds = value.([]interface{})
}
if value, ok := d.GetOkExists("alert_urgency_id"); ok {
s.AlertUrgencyId = value.(string)
}
if value, ok := d.GetOkExists("slack_channels"); ok {
s.SlackChannels = value.([]interface{})
}
Expand Down Expand Up @@ -404,6 +416,7 @@ func resourceServiceRead(ctx context.Context, d *schema.ResourceData, meta inter
d.Set("service_ids", item.ServiceIds)
d.Set("owners_group_ids", item.OwnersGroupIds)
d.Set("owners_user_ids", item.OwnersUserIds)
d.Set("alert_urgency_id", item.AlertUrgencyId)
d.Set("slack_channels", item.SlackChannels)
d.Set("slack_aliases", item.SlackAliases)

Expand Down Expand Up @@ -476,6 +489,9 @@ func resourceServiceUpdate(ctx context.Context, d *schema.ResourceData, meta int
if d.HasChange("owners_user_ids") {
s.OwnersUserIds = d.Get("owners_user_ids").([]interface{})
}
if d.HasChange("alert_urgency_id") {
s.AlertUrgencyId = d.Get("alert_urgency_id").(string)
}
if d.HasChange("slack_channels") {
s.SlackChannels = d.Get("slack_channels").([]interface{})
}
Expand Down
20 changes: 18 additions & 2 deletions provider/resource_team.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,21 @@ func resourceTeam() *schema.Resource {
Description: "The User ID's members of this team",
},

"alert_urgency_id": &schema.Schema{
Type: schema.TypeString,
Computed: true,
Required: false,
Optional: true,
ForceNew: false,
Description: "The alert urgency id of the team",
},

"slack_channels": &schema.Schema{
Type: schema.TypeList,
Computed: true,
Required: false,
Optional: true,
Description: "Slack Channels associated with this service",
Description: "Slack Channels associated with this team",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{

Expand Down Expand Up @@ -191,7 +200,7 @@ func resourceTeam() *schema.Resource {
Computed: true,
Required: false,
Optional: true,
Description: "Slack Aliases associated with this service",
Description: "Slack Aliases associated with this team",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{

Expand Down Expand Up @@ -268,6 +277,9 @@ func resourceTeamCreate(ctx context.Context, d *schema.ResourceData, meta interf
if value, ok := d.GetOkExists("user_ids"); ok {
s.UserIds = value.([]interface{})
}
if value, ok := d.GetOkExists("alert_urgency_id"); ok {
s.AlertUrgencyId = value.(string)
}
if value, ok := d.GetOkExists("slack_channels"); ok {
s.SlackChannels = value.([]interface{})
}
Expand Down Expand Up @@ -317,6 +329,7 @@ func resourceTeamRead(ctx context.Context, d *schema.ResourceData, meta interfac
d.Set("cortex_id", item.CortexId)
d.Set("service_now_ci_sys_id", item.ServiceNowCiSysId)
d.Set("user_ids", item.UserIds)
d.Set("alert_urgency_id", item.AlertUrgencyId)
d.Set("slack_channels", item.SlackChannels)
d.Set("slack_aliases", item.SlackAliases)

Expand Down Expand Up @@ -371,6 +384,9 @@ func resourceTeamUpdate(ctx context.Context, d *schema.ResourceData, meta interf
if d.HasChange("user_ids") {
s.UserIds = d.Get("user_ids").([]interface{})
}
if d.HasChange("alert_urgency_id") {
s.AlertUrgencyId = d.Get("alert_urgency_id").(string)
}
if d.HasChange("slack_channels") {
s.SlackChannels = d.Get("slack_channels").([]interface{})
}
Expand Down
22 changes: 22 additions & 0 deletions provider/resource_workflow_task_create_opsgenie_alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import (
"context"
"fmt"

"encoding/json"
"reflect"

"github.com/hashicorp/terraform-plugin-log/tflog"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
Expand Down Expand Up @@ -165,6 +168,25 @@ func resourceWorkflowTaskCreateOpsgenieAlert() *schema.Resource {
"auto",
}, false),
},
"details": &schema.Schema{
Description: "Details payload. Can contain liquid markup and need to be valid JSON",
Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: func(k, old string, new string, d *schema.ResourceData) bool {
var oldJSONAsInterface, newJSONAsInterface interface{}

if err := json.Unmarshal([]byte(old), &oldJSONAsInterface); err != nil {
return false
}

if err := json.Unmarshal([]byte(new), &newJSONAsInterface); err != nil {
return false
}

return reflect.DeepEqual(oldJSONAsInterface, newJSONAsInterface)
},
Default: "{}",
},
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion provider/resource_workflow_task_send_slack_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func resourceWorkflowTaskSendSlackMessage() *schema.Resource {
},
},
"actionables": &schema.Schema{
Description: "Value must be one of `update_summary`, `update_status`, `archive_channel`, `manage_incident_roles`, `update_incident`, `all_commands`, `leave_feedback`, `manage_form_fields`, `manage_action_items`, `view_tasks`, `add_pagerduty_responders`, `add_opsgenie_responders`, `add_victor_ops_responders`, `snooze_reminder`, `pause_reminder`, `restart_reminder`, `update_status_page`, `cancel_incident`, `delete_message`.",
Description: "Value must be one of `update_summary`, `update_status`, `archive_channel`, `manage_incident_roles`, `update_incident`, `all_commands`, `leave_feedback`, `manage_form_fields`, `manage_action_items`, `view_tasks`, `add_pagerduty_responders`, `add_opsgenie_responders`, `add_victor_ops_responders`, `update_status_page`, `pause_reminder`, `snooze_reminder`, `restart_reminder`, `cancel_incident`, `delete_message`.",
Type: schema.TypeList,
Optional: true,
Elem: &schema.Schema{
Expand Down
Loading

0 comments on commit dca1a58

Please sign in to comment.