Terraform の Opsgenie プロバイダーから Atlassian Operations プロバイダーに移行する

この記事では、バンドルの一部として Opsgenie をご利用中であり、現在 Jira Service Management にトランジションしている Jira Service Management カスタマー向けに、Opsgenie Terraform の設定を Atlassian Operations Terraform プロバイダーに移行する方法をご説明します。

Atlassian Operations Terraform プロバイダーを使用すると、ユーザー、チーム、エスカレーションなどを含む Jira Service Management のリソースを Terraform から直接管理できます。Opsgenie から Jira Service Management に移行する場合、または移行を最近完了した場合は、Opsgenie Terraform プロバイダーの設定を Atlassian Operations Terraform プロバイダーに移行できます。これにより、引き続き Terraform を活用して、Jira Service Management でデータをシームレスに操作および管理できます。

プロバイダーを設定する

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.

利用可能なリソースとデータソースの詳細については、左側のナビゲーション メニューを使用します。現在、プロバイダーは 6 つのリソースと 3 つのデータソースをサポートしています。

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

Terraform 設定をセットアップする

必須パラメーター

  • Cloud id - https://my-site-name.atlassian.net/_edge/tenant_info でサイトの Cloud ID を確認します。

  • Domain name- サイトの URL (例: my-site-name.atlassian.net)

  • email_address - Atlassian アカウントに関連付けられたメール アドレスを使用します。

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

オプション パラメーター

  • api_retry_count- 失敗したリクエストの再試行回数。

  • api_retry_wait- 失敗したリクエストを再試行するまでの待機秒数。

  • api_retry_wait_max- 再試行の最大時間 (秒)。

Opsgenie Terraform プロバイダーからの既存のリソースのエクスポート

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.

必要なリソース識別子を確認するには、状態ファイルを参照します。以下の手順に従って、リソースをマッピングしてインポートしてください。

サポートされているリソース タイプ マッピング

Opsgenie のリソース タイプ

Atlassian Operations のリソース タイプ

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

Atlassian Operations Terraform プロバイダーへのリソースのインポート

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.

リソースをインポートする手順

インポート ブロックを追加する

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

サポートされているリソースと  imports.tf  ファイルへの追加 

チーム 

以下の設定を使ってチームをインポートします

import { to = atlassian-operations_team.<TEAM_VARIABLE_NAME_HERE> id = "<TEAM_ID_HERE>,<ORGANIZATION_ID_HERE>" }
スケジュール
import { to = atlassian-operations_schedule.<SCHEDULE_VARIABLE_NAME_HERE> id = "<SCHEDULE_ID_HERE>" }
スケジュール ローテーション 
import { to = atlassian-operations_schedule_rotation.<SCHEDULE_ROTATION_VARIABLE_NAME_HERE> id = "<ROTATION_ID_HERE>,<SCHEDULE_ID_HERE>" }
エスカレーション
import { to = atlassian-operations_escalation.<ESCALATION_VARIABLE_NAME_HERE> id = "<ESCALATION_ID_HERE>,<TEAM_ID_HERE>" }
API ベースの統合
import { to = atlassian-operations_api_integration.<API_INTEGRATION_VARIABLE_NAME_HERE> id = "<INTEGRATION_ID_HERE>" }
メール統合
import { to = atlassian-operations_email_integration.<EMAIL_INTEGRATION_VARIABLE_NAME_HERE> id = "<INTEGRATION_ID_HERE>" }
通知ルール
import { to = atlassian-operations_notification_rule.<NOTIFICATION_RULE_NAME_HERE> id = "<NOTIFICATION_RULE_ID_HERE>" }
ルーティングルール
import { to = atlassian-operations_routing_rule.<ROUTING_RULE_NAME_HERE> id = "<ROUTING_RULE_ID_HERE>,<TEAM_ID_HERE>" }
アラート ポリシー
// 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>" }
カスタム ロール
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>" }
統合アクション
import { to = atlassian-operations_integration_action.<INTEGRATION_ACTION_NAME_HERE> id = "<INTEGRATION_ACTION_ID_HERE>,<INTEGRATION_ID_HERE>" }
Heartbeat
// 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>" }
サービス
import { to = atlassian-operations_service.<SERVICE_NAME_HERE> id = "<SERVICE_ID_HERE>" }

Terraform コマンドを実行する

imports.tf ファイルを準備したら、Terraform が提供している plan コマンドを使ってリソース構成を生成します。

例:  

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

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

確認

  • 設定ファイルを生成したら、設定を確認し、必要に応じて更新します。

  • terraform apply コマンドを実行して、リソースを Terraform の状態ファイルにインポートします。

さらにヘルプが必要ですか?

アトラシアン コミュニティをご利用ください。