Migrating from Terraform's Opsgenie Provider to Atlassian Operations Provider

Migrating from Terraform's Opsgenie Provider to Atlassian Operations Provider

This document lists down the steps to integrate Terraform with Compass. If you are looking to integrate with Jira Service Management, please follow the steps mentioned in this document Migrating from Terraform's Opsgenie Provider to Atlassian Operations Provider | Jira Service Management Cloud | Atlassian Support

The Atlassian Operations Terraform Provider enables you to manage Compass Operations resources, including users, teams, escalations, and more, directly through Terraform. If you're transitioning from Opsgenie to Compass or have recently completed the move, you can migrate your Opsgenie Terraform Provider configurations to the Atlassian Operations Terraform Provider. This ensures you can continue leveraging Terraform to interact with and manage your data seamlessly.

Configure the provider

To set up the Atlassian Operations Terraform Provider, add the atlassian-operations provider configuration to your required_providers block. Ensure that you configure the provider with valid credentials before using it. Read how to set up Atlassian Operations Terraform Provider for Compass.

For more information about the available resources and data sources, use the navigation menu on the left. Currently, the provider supports six resources and three data sources.

To get started with Terraform, refer to the get started tutorials

Set up your Terraform configuration

Required parameters

The org_admin_token parameter is to be generated one time by the org admin and to be used in all Terraform configurations.

Optional parameters

  • api_retry_count- Number of retries for failed requests.

  • api_retry_wait- Seconds to wait before retrying a failed request.

  • api_retry_wait_max- Maximum time for retries in seconds.

Exporting existing resources from Opsgenie Terraform Provider

For Opsgenie users transitioning to Compass, entity identifiers remain unchanged with the supported types (listed in the table below) to the Atlassian Operations Terraform Provider, ensuring a seamless migration. However, exporting existing resource IDs into an imports.tf file must currently be performed manually.

Refer to your state files to find the required resource identifiers. Follow the steps below for mapping and importing your resources.

Supported resource type mappings

Opsgenie Resource Type

Atlassian Operations Resource Type

Opsgenie Resource Type

Atlassian Operations Resource Type

opsgenie_team

atlassian-operations_team

opsgenie_schedule

atlassian-operations_schedule

opsgenie_schedule_rotation

atlassian-operations_schedule_rotation

opsgenie_escalation

atlassian-operations_escalation

opsgenie_api_integration

atlassian-operations_api_integration

opsgenie_email_integration

atlassian-operations_email_integration

opsgenie_notification_rule

atlassian-operations_notification_rule

opsgenie_team_routing_rule

atlassian-operations_routing_rule

opsgenie_alert_policy

atlassian-operations_alert_policy

opsgenie_custom_role

atlassian-operations_custom_role

View the full list of resources and data sources here

Importing resources into Atlassian Operations Terraform Provider

The Atlassian Operations Terraform Provider supports importing the following resources:
Teams, Schedules, Schedule Rotations, Escalations, API Integrations, and Email Integrations. By using the Terraform provider CLI, you can easily import your existing resources into the Atlassian Operations Terraform Provider. Read more about importing in Terraform CLI.

Steps for importing resources

Add import blocks

Use Terraform’s import functionality to add existing resources to your state files. For details on preparing your imports.tf file, refer to importing in Terraform CLI.

Supported resources and adding them to the imports.tf file

Team

Use this configuration to import your teams

import { to = atlassian-operations_team.<TEAM_VARIABLE_NAME_HERE> id = "<TEAM_ID_HERE>,<ORGANIZATION_ID_HERE>" }
Schedule
import { to = atlassian-operations_schedule.<SCHEDULE_VARIABLE_NAME_HERE> id = "<SCHEDULE_ID_HERE>" }
Schedule rotations
import { to = atlassian-operations_schedule_rotation.<SCHEDULE_ROTATION_VARIABLE_NAME_HERE> id = "<ROTATION_ID_HERE>,<SCHEDULE_ID_HERE>" }
Escalations
import { to = atlassian-operations_escalation.<ESCALATION_VARIABLE_NAME_HERE> id = "<ESCALATION_ID_HERE>,<TEAM_ID_HERE>" }
API based integrations
import { to = atlassian-operations_api_integration.<API_INTEGRATION_VARIABLE_NAME_HERE> id = "<INTEGRATION_ID_HERE>" }
Email integrations
import { to = atlassian-operations_email_integration.<EMAIL_INTEGRATION_VARIABLE_NAME_HERE> id = "<INTEGRATION_ID_HERE>" }
Notification Rules
# Notification rule can be imported by providing the notification rule id terraform import atlassian-operations_notification_rule.example "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
Routing Rules
# Routing rule can be imported by providing the routing rule id and the team id, separated by a comma terraform import atlassian-operations_routing_rule.example "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx,xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

Execute Terraform commands

After preparing your imports.tf file, use the terraform provided plan command to generate the resource configurations.

Example:

terraform plan -generate-config-out="generated_resources.tf

Refer to Terraform’s import - Generating configuration documentation for more details.

Review

  • After generating your configuration file, review your configurations and update them as needed.

  • Execute terraform apply command to import the resources into your Terraform state files.