Jira Service Management is getting a new navigation

We’re in the process of rolling out these changes and the documentation may not match your experience. Bear with us while we update it to reflect the new changes. More about navigating the new Jira

Migrating from Terraform's Opsgenie Provider to Atlassian Operations Provider

The Atlassian Operations Terraform Provider enables you to manage Jira Service Management resources, including users, teams, escalations, and more, directly through Terraform. If you're transitioning from Opsgenie to Jira Service Management 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 in Jira Service Management.

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 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.

  • API Token - An API token added to your Atlassian account. View and manage API tokens for your Atlassian account.

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 Jira Service Management, entity identifiers remain unchanged with the supported types 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 Types

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

opsgenie_user_contact

atlassian-operations_user_contact

opsgenie_notification_policy

atlassian-operations_notification_policy

opsgenie_integration_action

atlassian-operations_integration_action

opsgenie_heartbeat

atlassian-operations_heartbeat

opsgenie_maintenance

atlassian-operations_maintenance

opsgenie_service

atlassian-operations_service

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
import { to = atlassian-operations_notification_rule.<NOTIFICATION_RULE_NAME_HERE> id = "<NOTIFICATION_RULE_ID_HERE>" }
Routing rules
import { to = atlassian-operations_routing_rule.<ROUTING_RULE_NAME_HERE> id = "<ROUTING_RULE_ID_HERE>,<TEAM_ID_HERE>" }
Alert policies
// Team Policy import { to = atlassian-operations_alert_policy.<ALERT_POLICY_NAME_HERE> id = "<ALERT_POLICY_ID_HERE>,<TEAM_ID_HERE>" } // Global Policy import { to = atlassian-operations_alert_policy.<ALERT_POLICY_NAME_HERE> id = "<ALERT_POLICY_ID_HERE>" }
Custom roles
import { to = atlassian-operations_custom_role.<CUSTOM_ROLE_NAME_HERE> id = "<CUSTOM_ROLE_ID_HERE>" }
User contact
import { to = atlassian-operations_user_contact.<USER_CONTACT_NAME_HERE> id = "<USER_CONTACT_ID_HERE>" }
Notification policies
import { to = atlassian-operations_notification_policy.<NOTIFICATION_POLICY_NAME_HERE> id = "<NOTIFICATION_POLICY_ID_HERE>,<TEAM_ID_HERE>" }
Integration actions
import { to = atlassian-operations_integration_action.<INTEGRATION_ACTION_NAME_HERE> id = "<INTEGRATION_ACTION_ID_HERE>,<INTEGRATION_ID_HERE>" }
Heartbeats
// TERRAFORM_HEARTBEAT_NAME_HERE -> The resource name kept in Terraform // HEARTBEAT_NAME_HERE -> The name of the heartbeat in Jira Service Management or Compass import { to = atlassian-operations_heartbeat.<TERRAFORM_HEARTBEAT_NAME_HERE> id = "<HEARTBEAT_NAME_HERE>,<TEAM_ID_HERE>" }
Maintenance
// Team Maintenance import { to = atlassian-operations_maintenance.<MAINTENANCE_NAME_HERE> id = "<MAINTENANCE_ID_HERE>,<TEAM_ID_HERE>" } // Global Maintenance import { to = atlassian-operations_maintenance.<MAINTENANCE_NAME_HERE> id = "<MAINTENANCE_ID_HERE>" }
Services
import { to = atlassian-operations_service.<SERVICE_NAME_HERE> id = "<SERVICE_ID_HERE>" }

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.

Still need help?

The Atlassian Community is here for you.