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
cloud_id
- Find your site's Cloud ID at:https://my-site-name.atlassian.net/_edge/tenant_info
domain_name
- Your site’s URL, e.g.,my-site-name.atlassian.net
email_address
- Use your email address associated with your Atlassian account.token
- An API token added to your Atlassian account. View and manage API tokens for your Atlassian account.product_type
-compass
org_admin_token
- An admin token added to your organization. Manage an organization with the admin APIs.
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 |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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>"
}
Find Team ID: Team field in Jira REST API
Find Organization ID: Retrieve my Atlassian Cloud Organization's ID | Atlassian Cloud | Atlassian Documentation. Organization ID is also shown during the Organization API Token generation page, for Compass flow.
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.