• 使用を開始する
  • 関連ドキュメント

Atlassian Operations Terraform プロバイダーを設定する

Atlassian Operations Terraform プロバイダーを使用すると、ユーザー、チーム、エスカレーションなどを含む Jira Service Management のリソースを操作できます。宣言型構成ファイルでリソースを定義することで、IT 運用の構成を簡単にコーディング、編集、レビュー、バージョン管理できます。

GitHub の Atlassian Operations Terraform プロバイダーのリポジトリをご覧ください。

サポートされているリソースとデータソース

このプロバイダーは、Terraform を介して次のリソースとデータソースの作成および管理をサポートします。

データソース (読み取り専用)

  • ユーザー (ユーザー連絡先 API を除く)

  • チーム

  • スケジュール

リソース (読み取り/書き込み - CRUD)

  • チーム (メンバーの有無にかかわらず)

  • API とメールベースの統合

  • エスカレーション

  • スケジュール

  • スケジュール ローテーション

Terraform はチーム管理者を更新できない

チームを作成するユーザーは自動的にその管理者になり、このプロバイダーでサポートできるのは、現時点で Jira Service Management Operations の REST API を介して利用可能なアクションのみとなるため、Terraform でチーム管理者を更新することはできません。

Terraform プロバイダーを設定する

Atlassian Operations Terraform プロバイダーを設定するには、Terraform 設定の required_providers ブロックに atlassian-operations を含めます。プロバイダーを使用する前に、有効な認証情報を使用してプロバイダーを設定してください。

必須の設定パラメーター

プロバイダーには次のパラメーターが必要です。

  1. cloud_id: サイトのクラウド ID を確認する最も簡単な方法は https://<your-site-name>.atlassian.net/_edge/tenant_info を使うことです。

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

  3. email_address

  4. token - 既存の Atlassian API トークンを一覧表示したり、Atlassian アカウントの API トークンを管理して新しいトークンを作成したりできます。

設定例

以下は Terraform の設定例です。

1 2 3 4 5 6 7 8 9 10 11 12 13 14 terraform { required_providers { atlassian-operations = { source = "registry.terraform.io/atlassian/atlassian-operations" } } } provider "atlassian-operations" { cloud_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" domain_name = "xxxx.atlassian.net" email_address = "email@example.com" token = "<YOUR_TOKEN_HERE>" }

詳細については、Atlassian Operations プロバイダーのページにアクセスし、ドキュメントを参照して利用可能なリソースをご確認ください。リソースは、ドキュメント ページの左側のメニューにまとめられています。現在、プロバイダーは 6 つのリソースと 3 つのデータソースをサポートしています。

このプロバイダーを使用して Terraform を使い始めるには、Terraform のチュートリアルを参照してください。

データソースの使用

ユーザー データソース

ユーザーを取得するには、email address を指定する必要があります。

1 2 3 4 # Get Atlassian User by email address data "atlassian-operations_user" "example" { email_address = "email@example.com" }

チーム データソース

チームを取得するには、team idorganization id の両方が必要です。

組織 ID を確認するには、組織 ID の概要と確認方法を参照してください。 

1 2 3 4 5 # Get Atlassian Operations Teams by organization ID and team ID data "atlassian-operations_team" "example" { organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" }

スケジュール データソース

スケジュールを取得するには、その name を指定する必要があります。 

1 2 3 4 # Get Atlassian Operations Schedule by name data "atlassian-operations_schedule" "example" { name = "Test schedule" }

リソースの使用

チーム リソース

必須のリソース:

  • description (文字列) チームの説明

  • display_name (文字列) チームの表示名

  • member (属性セット) チームのメンバー

    • account_id (文字列) ユーザーのアカウント ID

  • organization_id (文字列) チームの組織 ID

  • team_type (文字列) チームのタイプ

オプションのリソース:

  • site_id (文字列) チームのサイト ID

読み取り専用のリソース:

  • id (String) チームの ID

  • user_permissions (属性) チームのユーザー権限

    • add_members (ブール値) チームにメンバーを追加する権限

    • delete_team (ブール値) チームを削除する権限

    • remove_members (ブール値) チームからメンバーを削除する権限

    • update_team (ブール値) チームを更新する権限

組織 ID を確認するには、組織 ID の概要と確認方法を参照してください。 

設定例

1 2 3 4 5 6 7 8 9 10 11 resource "atlassian-operations_team" "example" { organization_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" description = "This is a team created by Terraform" display_name = "Terraform Team" team_type = "MEMBER_INVITE" member = [ { account_id = "XXXXXX:xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" } ] }

スケジュール リソース

必須のリソース:

  • name (文字列) スケジュールの名前

  • team_id (文字列) スケジュールを所有するチームの ID

オプションのリソース:

  • description (文字列) スケジュールの説明

  • enabled (ブール値) スケジュールが有効かどうか

  • timezone (文字列) スケジュールのタイム ゾーン

読み取り専用のリソース:

  • id (文字列) スケジュールの ID

設定例

1 2 3 4 5 6 7 resource "atlassian-operations_schedule" "example" { name = "scheduleName" team_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" description = "schedule description" timezone = "Europe/Istanbul" enabled = true }

スケジュール ローテーション リソース

必須のリソース:

  • schedule_id (文字列) スケジュールの ID

  • start_date (文字列) ローテーションの開始日

  • type (文字列) ローテーションのタイプ

オプションのリソース:

  • end_date (文字列) ローテーションの終了日

  • length (数値) ローテーションの長さ

  • name (文字列) ローテーションの名前

  • participants (属性リスト) ローテーションの参加者

    • type (文字列) 参加者のタイプ

    • id (文字列) (タイプが「noone」の場合はオプション) 参加者の ID

  • time_restriction (属性)

    • type (文字列) 時間制限のタイプ

    • restriction (タイプが「time-of-day」の場合は必須) (属性)

      • end_hour (数値) 制限の終了時間 (時)

      • end_min (数値) 制限の終了時間 (分)

      • start_hour (数値) 制限の開始時間 (時)

      • start_min (数値) 制限の開始時間 (分)

    • restrictions (タイプが「weekday-and-time-of-day」の場合は必須) (属性リスト)

      • end_day (文字列) 制限の終了日

      • end_hour (数値) 制限の終了時間 (時)

      • end_min (数値) 制限の終了時間 (分)

      • start_day (文字列) 制限の開始日

      • start_hour (数値) 制限の開始時間 (時)

      • start_min (数値) 制限の開始時間 (分)

読み取り専用のリソース:

  • id (文字列) ローテーションの ID

設定例

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 resource "atlassian-operations_schedule_rotation" "example" { schedule_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" name = "rotationName" start_date = "2023-11-10T05:00:00Z" end_date = "2023-11-11T05:00:00Z" type = "weekly" length = 2 participants = [ { id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" type = "user" } ] time_restriction = { type = "time-of-day" restriction = { start_hour = 9 end_hour = 17 start_min = 0 end_min = 0 } } }

エスカレーション リソース

必須のリソース:

  • name (文字列) エスカレーションの名前

  • rules (属性セット) エスカレーション ルールのリスト

    • condition (文字列) アラートの状態に基づきエスカレーション ルールについて受信者に通知するための条件

    • delay (数値) エスカレーション・ルールの遅延時間 (分)

    • notify_type (文字列) エスカレーションの受信者計算ロジック

    • recipient (属性) エスカレーション時に通知されるスケジュール、チーム、ユーザーのオブジェクト

      • type (文字列) 受信者のタイプ

      • id (文字列) 受信者の ID

  • team_id (文字列) エスカレーションを所有するチームの ID

オプションのリソース:

  • description (文字列) エスカレーションの説明

  • enabled (ブール値) エスカレーションが有効かどうか

  • repeat (属性) エスカレーションの繰り返しに関する設定 (繰り返し間隔、回数、確認済みおよび表示済み状態を元に戻す、繰り返しが完了した時点でアラートを自動的に閉じる、など)

    • close_alert_after_all (ブール値) エスカレーションの繰り返しが完了したら自動的にアラートを閉じる

    • count (数値) 繰り返しのアクションを実行する回数を示す繰り返し時間

    • reset_recipient_states (ブール値) アラートが閉じられていない場合、繰り返しのたびに確認済みおよび表示済みの状態を元に戻す

    • wait_interval (数値) 最後のエスカレーション ルールの処理後にエスカレーション ルールを繰り返す時間 (分)。繰り返しオプションを追加または削除する場合は必須。繰り返しオプションを無効にするには、値として 0 を指定する。

読み取り専用のリソース:

  • id (文字列) エスカレーションの ID

設定例

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 resource "atlassian-operations_escalation" "example" { name = "escalationName" team_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" description = "escalation description" rules = [{ condition = "if-not-acked" notify_type = "default" delay = 5 recipient = { id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" type = "user" } }, { condition = "if-not-closed" notify_type = "all" delay = 1 recipient = { id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" type = "team" } }] enabled = true repeat = { wait_interval = 5 count = 10 reset_recipient_states = true close_alert_after_all = true } }

API 統合リソース

必須のリソース:

  • name (文字列)

  • type (文字列)

オプションのリソース:

  • enabled (ブール値)

  • team_id (文字列)

  • type_specific_properties (JSON 文字列) このオブジェクトには、統合固有のプロパティを指定可能jsonencode を使ってオブジェクトを文字列に変換します。

読み取り専用のリソース:

  • advanced (ブール値)

  • directions (文字列のリスト)

  • domains (文字列のリスト)

  • id (文字列) エスカレーションの ID

  • maintenance_sources (属性リスト)

    • enabled (ブール値) メンテナンスが有効かどうか

    • interval (属性)

      • end_time_millis (数値) メンテナンスの終了時間

      • start_time_millis (数値) メンテナンスの開始時間

    • maintenance_id (文字列) メンテナンスの ID

設定例

1 2 3 4 5 6 7 8 9 resource "atlassian-operations_api_integration" "example" { name = "apiIntegrationName" team_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" type = "API" enabled = true type_specific_properties = jsonencode({ suppressNotifications: false }) }

メール統合リソース

必須のリソース:

  • name (文字列)

  • type_specific_properties (属性) このオブジェクトには、統合固有のプロパティを指定可能

    • email_username (文字列)

    • suppress_notifications (任意、デフォルトは false) (ブール値)

オプションのリソース:

  • enabled (ブール値)

  • team_id (文字列)

読み取り専用のリソース:

  • advanced (ブール値)

  • directions (文字列のリスト) アクションの方向 (着信または発信)

  • domains (文字列のリスト) アクションのドメイン (アラート)

  • id (文字列) エスカレーションの ID

  • maintenance_sources (属性リスト)

    • enabled (ブール値)

    • interval (属性)

      • end_time_millis (数値)

      • start_time_millis (数値)

    • maintenance_id (文字列)

設定例

1 2 3 4 5 6 7 8 9 resource "atlassian-operations_email_integration" "example" { name = "emailIntegrationUpdateName" team_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" enabled = true type_specific_properties = { email_username = "randomEmailUsername" suppress_notifications = false } }




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

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