Skip to content

Upgrade to terraform-plugin-sdk/v2 and add new resources/data sources - #22

Open
aamirk-splunk wants to merge 1 commit into
splunk:masterfrom
aamirk-splunk:aamirk/provider-sdk-v2-upgrade
Open

Upgrade to terraform-plugin-sdk/v2 and add new resources/data sources#22
aamirk-splunk wants to merge 1 commit into
splunk:masterfrom
aamirk-splunk:aamirk/provider-sdk-v2-upgrade

Conversation

@aamirk-splunk

Copy link
Copy Markdown

Summary

This PR modernizes the VictorOps Terraform provider by upgrading to terraform-plugin-sdk/v2 and adding new resources and data sources.

SDK Upgrade

  • Previous: terraform-plugin-sdk v1.8
  • Current: terraform-plugin-sdk/v2

Key Changes

  • All resource functions now use Context variants (CreateContext, ReadContext, UpdateContext, DeleteContext)
  • Return types changed from error to diag.Diagnostics for richer error reporting
  • Import support added via schema.ResourceImporter

New Resources

Resource Description
victorops_scheduled_override Manage scheduled overrides on escalation policies
victorops_maintenance_mode Manage maintenance mode windows
victorops_alert_rule Manage alert rules on routing keys

New Data Sources

Data Source Description
victorops_user Look up a single user by username
victorops_users List all users in the organization
victorops_team Look up a single team by slug
victorops_teams List all teams in the organization
victorops_escalation_policy Look up a single escalation policy by ID
victorops_escalation_policies List all escalation policies (optionally filtered by team)
victorops_routing_keys List all routing keys
victorops_rotations List rotations for a specific team
victorops_on_call Get current on-call schedule

Import Support

Added import support for all applicable resources:

Resource Import ID Format
victorops_team {team_slug}
victorops_user {username}
victorops_contact {username}/{type}/{contact_id}
victorops_escalation_policy {policy_id}
victorops_routing_key {routing_key_name}
victorops_scheduled_override {policy_slug}/{override_id}
victorops_maintenance_mode {instance_id}
victorops_alert_rule {routing_key}/{rule_id}

Breaking Changes

  • Requires Terraform 0.12+
  • Uses terraform-plugin-sdk/v2

Version Compatibility

Component Minimum Version
Go 1.22+
Terraform 0.12+
terraform-plugin-sdk v2.0+

- Upgrade from terraform-plugin-sdk v1.8 to v2
- Migrate all resources to Context-based CRUD functions
- Return diag.Diagnostics instead of error for richer error reporting
- Add import support for team, user, contact, escalation_policy, routing_key, scheduled_override, maintenance_mode, alert_rule resources

New Resources:
- victorops_scheduled_override: Manage scheduled overrides on escalation policies
- victorops_maintenance_mode: Manage maintenance mode windows
- victorops_alert_rule: Manage alert rules on routing keys

New Data Sources:
- victorops_user / victorops_users: Look up users
- victorops_team / victorops_teams: Look up teams
- victorops_escalation_policy / victorops_escalation_policies: Look up policies
- victorops_routing_keys: List all routing keys
- victorops_rotations: List team rotations
- victorops_on_call: Get current on-call schedule

Breaking Changes:
- Requires Terraform 0.12+
- Uses terraform-plugin-sdk/v2
@aamirk-splunk
aamirk-splunk force-pushed the aamirk/provider-sdk-v2-upgrade branch from 3f6a52d to 444636a Compare December 18, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant