feat: Upgrade to SDK v2 and add new resources/data sources - #21
Open
aamirk-splunk wants to merge 5 commits into
Open
feat: Upgrade to SDK v2 and add new resources/data sources#21aamirk-splunk wants to merge 5 commits into
aamirk-splunk wants to merge 5 commits into
Conversation
BREAKING CHANGES: - Upgraded from terraform-plugin-sdk v1.8.0 to v2.31.0 - Upgraded Go version from 1.14 to 1.22 NEW RESOURCES: - victorops_user_contact_email: Manage user email contact methods - victorops_user_contact_phone: Manage user phone contact methods - victorops_scheduled_override: Manage scheduled overrides with assignments - victorops_maintenance_mode: Manage maintenance windows (start/end lifecycle) - victorops_alert_rule: Manage alert routing rules - victorops_user_paging_policy: Manage user paging policies (steps and rules) NEW DATA SOURCES: - victorops_users: List users with optional email filter - victorops_routing_keys: List all routing keys - victorops_team_admins: List team administrators - victorops_rotations: List team rotations - victorops_team_oncall_schedule: Get team on-call schedule - victorops_user_devices: List user contact devices (read-only) IMPROVEMENTS: - Added rate limiting (2 req/sec) to prevent API throttling - Added retry logic with exponential backoff for transient errors - Added ImportState support to existing resources - Added deprecation warning for is_admin field on user resource - Migrated all resources to use context.Context and diag.Diagnostics - Added comprehensive acceptance tests for all new features - Updated CI workflow for Go 1.22 KNOWN LIMITATIONS: - Alert rule routing_key not returned by API on GET (preserved from config) - Maintenance mode is ForceNew (API only supports start/end, no update) - User devices are read-only (API limitation)
- Fix JSON tag: totalMembers -> totalMembersInRotation - Add complete ShiftDetails with all fields (shiftMembers, shifttype, mask, etc.) - Add ShiftMember, OnCallPeriod, RotationMask, MaskDays, MaskTimeRange, MaskTime models - Update Terraform schema to expose all rotation fields - Update read function to map all nested fields
- Fix MaintenanceModeTarget: use type+names instead of routingKey - Fix OnCall Schedule: use User objects, ISO8601 strings, PolicySchedule - Fix Paging Policy: use index field and Contact object - Update team_oncall_schedule data source schema with nested policy/overrides - Rotations already correct (no changes needed) All 14 acceptance tests pass.
The go-victorops library has a bug where UpdateTeam uses team.Name for
the URL path instead of the team slug. This caused team name updates to
fail with 'No team found' errors.
Fix: Added api_team.go with a custom UpdateTeam function that correctly
uses the team slug in the URL path (/api-public/v1/team/{slug}).
smootherbug
reviewed
Dec 10, 2025
| LastUpdatedBy string `json:"lastUpdatedBy,omitempty"` | ||
| Notes string `json:"notes,omitempty"` | ||
| RouteKey string `json:"routeKey,omitempty"` | ||
| RoutingKey string `json:"routingKey,omitempty"` |
Collaborator
There was a problem hiding this comment.
there is only route key, not routing key field
| } | ||
|
|
||
| // GetAlertRule gets an alert rule by ID | ||
| func (c *APIClient) GetAlertRule(ruleID int) (*AlertRule, error) { |
Collaborator
There was a problem hiding this comment.
have only list alert rule, not get alert rule
| // TeamOncallSchedule represents a team's on-call schedule | ||
| type TeamOncallSchedule struct { | ||
| Team TeamInfo `json:"team,omitempty"` | ||
| Schedules []OncallSchedule `json:"schedules,omitempty"` |
Collaborator
There was a problem hiding this comment.
The object type for Schedules is wrong, it should be
type: object
properties:
team:
$ref: '#/definitions/Team'
schedules:
type: array
items:
$ref: '#/definitions/PolicySchedule'API spec clarification: - Request (POST/PUT) uses 'routingKey' field - Response (GET) uses 'routeKey' field Removed RoutingKey from AlertRule struct since it's only for parsing API responses which use routeKey.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BREAKING CHANGES:
NEW RESOURCES:
NEW DATA SOURCES:
IMPROVEMENTS:
KNOWN LIMITATIONS: