Atlassian Operations Terraform プロバイダーを設定する
Atlassian Operations Terraform プロバイダーを使用すると、ユーザー、チーム、エスカレーションなどを含む Jira Service Management のリソースを操作できます。宣言型構成ファイルでリソースを定義することで、IT 運用の構成を簡単にコーディング、編集、レビュー、バージョン管理できます。
GitHub の Atlassian Operations Terraform プロバイダーのリポジトリをご覧ください。
サポートされているリソースとデータソース
このプロバイダーは、Terraform を介して次のリソースとデータソースの作成および管理をサポートします。
データソース (読み取り専用)
ユーザー (ユーザー連絡先 API を除く)
チーム
スケジュール
リソース (読み取り/書き込み - CRUD)
チーム (メンバーの有無にかかわらず)
API とメールベースの統合
エスカレーション
スケジュール
スケジュール ローテーション
通知ルール
ルーティングルール
アラート ポリシー
カスタム ロール
User contact
Terraform はチーム管理者を更新できない
チームを作成するユーザーは自動的にその管理者になり、このプロバイダーでサポートできるのは、現時点で Jira Service Management Operations の REST API を介して利用可能なアクションのみとなるため、Terraform でチーム管理者を更新することはできません。
Terraform プロバイダーを設定する
Atlassian Operations Terraform プロバイダーを設定するには、Terraform 設定の required_providers
ブロックに atlassian-operations
を含めます。プロバイダーを使用する前に、有効な認証情報を使用してプロバイダーを設定してください。
必須の設定パラメーター
プロバイダーには次のパラメーターが必要です。
cloud_id
: サイトのクラウド ID を確認する最も簡単な方法はhttps://<your-site-name>.atlassian.net/_edge/tenant_info
を使うことです。domain_name
- サイトの URL (例:my-site-name.atlassian.net
)email_address
token
- 既存の Atlassian API トークンを一覧表示したり、Atlassian アカウントの API トークンを管理して新しいトークンを作成したりできます。
設定例
以下は Terraform の設定例です。
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 のチュートリアルを参照してください。
Using data sources
ユーザー データソース
ユーザーを取得するには、email address
を指定する必要があります。
# Get Atlassian User by email address
data "atlassian-operations_user" "example" {
email_address = "email@example.com"
}
チーム データソース
チームを取得するには、team id
と organization id
の両方が必要です。
組織 ID を確認するには、組織 ID の概要と確認方法を参照してください。
# 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
を指定する必要があります。
# Get Atlassian Operations Schedule by name
data "atlassian-operations_schedule" "example" {
name = "Test schedule"
}
Using resources
Team resource
必須のリソース:
description
(文字列) チームの説明display_name
(文字列) チームの表示名member
(属性セット) チームのメンバーaccount_id
(文字列) ユーザーのアカウント ID
organization_id
(文字列) チームの組織 IDteam_type
(文字列) チームのタイプ
オプションのリソース:
site_id
(文字列) チームのサイト ID
読み取り専用のリソース:
id (String)
チームの IDuser_permissions
(属性) チームのユーザー権限add_members
(ブール値) チームにメンバーを追加する権限delete_team
(ブール値) チームを削除する権限remove_members
(ブール値) チームからメンバーを削除する権限update_team
(ブール値) チームを更新する権限
組織 ID を確認するには、組織 ID の概要と確認方法を参照してください。
設定例
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"
}
]
}
Schedule resource
必須のリソース:
name
(文字列) スケジュールの名前team_id
(文字列) スケジュールを所有するチームの ID
オプションのリソース:
description
(文字列) スケジュールの説明enabled
(ブール値) スケジュールが有効かどうかtimezone
(文字列) スケジュールのタイム ゾーン
読み取り専用のリソース:
id
(文字列) スケジュールの ID
設定例
resource "atlassian-operations_schedule" "example" {
name = "scheduleName"
team_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
description = "schedule description"
timezone = "Europe/Istanbul"
enabled = true
}
Schedule rotation resource
必須のリソース:
schedule_id
(文字列) スケジュールの IDstart_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
設定例
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
設定例
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 integration resource
必須のリソース:
name
(文字列)type
(文字列)
オプションのリソース:
enabled
(ブール値)team_id
(文字列)type_specific_properties
(JSON 文字列) このオブジェクトには、統合固有のプロパティを指定可能jsonencode
を使ってオブジェクトを文字列に変換します。
読み取り専用のリソース:
advanced
(ブール値)directions
(文字列のリスト)domains
(文字列のリスト)id
(文字列) エスカレーションの IDmaintenance_sources
(属性リスト)enabled
(ブール値) メンテナンスが有効かどうかinterval
(属性)end_time_millis
(数値) メンテナンスの終了時間start_time_millis
(数値) メンテナンスの開始時間
maintenance_id
(文字列) メンテナンスの ID
設定例
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
})
}
Email integration resource
必須のリソース:
name
(文字列)type_specific_properties
(属性) このオブジェクトには、統合固有のプロパティを指定可能email_username
(文字列)suppress_notifications
(任意、デフォルトはfalse
) (ブール値)
オプションのリソース:
enabled
(ブール値)team_id
(文字列)
読み取り専用のリソース:
advanced
(ブール値)directions
(文字列のリスト) アクションの方向 (着信または発信)domains
(文字列のリスト) アクションのドメイン (アラート)id
(文字列) エスカレーションの IDmaintenance_sources
(属性リスト)enabled
(ブール値)interval
(属性)end_time_millis
(数値)start_time_millis
(数値)
maintenance_id
(文字列)
設定例
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
}
}
通知ルール
必須のリソース:
name
(String) –The name of the notification rule. Must be unique within the team.action_type
(String) – The type of action that triggers the rule. Valid values:create-alert
acknowledged-alert
closed-alert
assigned-alert
add-note
schedule-start
schedule-end
incoming-call-routing
オプションのリソース:
criteria
(Object) – Defines when the notification rule should be triggered. Includes:type
(String) – Required. Defines the match logic for conditions. Valid values:match-all
: Matches all incidents. Noconditions
needed.match-all-conditions
: All conditions must match.match-any-condition
: Any condition can match.
conditions
(List of Objects) – Required iftype
ismatch-all-conditions
ormatch-any-condition
. Each object may include:field
(String) – Required. The incident field to evaluate (e.g.,message
,priority
,tags
).operation
(String) – Required. The comparison operator (e.g.,equals
,contains
).expected_value
(String) – Optional. The value to compare against.key
(String) – Optional. Used withextra-properties
fields.not
(Boolean) – Optional. Negates the condition.order
(Integer) – Optional. Determines the order of evaluation.
notification_time
(List of String) – Specifies when to send notifications relative to the event. Valid values:just-before
,15-minutes-ago
,1-hour-ago
,1-day-ago
.time_restriction
(Attributes)type
(String) The type of the time restrictionrestriction
(Required if type = “time-of-day”) (Attributes)end_hour
(Number) - The end hour of the restrictionend_min
(Number) - The end minute of the restrictionstart_hour
(Number) - The start hour of the restrictionstart_min
(Number) - The start minute of the restriction
restrictions
(Required if type = “weekday-and-time-of-day”) (Attributes List)end_day
(String) - The end day of the restrictionend_hour
(Number) - The end hour of the restrictionend_min
(Number) - The end minute of the restrictionstart_day
(String) - The start day of the restrictionstart_hour
(Number) - The start hour of the restrictionstart_min
(Number) - The start minute of the restriction
schedules
(List of String) – Schedule IDs the rule applies to.order
(Integer) – The rule's processing order (lower numbers run first)
steps
(List of Objects) – Defines notification steps. Each step may include:
send_after
(Integer) – Optional. Delay (in minutes) after rule triggercontact
(Object) – Required. Defines who to notify:method
(String) – Required. Notification method (email
,sms
,voice
,mobile
)to
(String) – Required. Recipient (email address or phone number)
repeat
(Object) – Configuration for repeating notifications:loop_after
(Integer) – Required. Delay (in minutes) before repeatingenabled
(Boolean) – Optional. Whether repetition is active (defaults to true)
enabled
(Boolean) – Whether the rule is active. Defaults totrue
.
読み取り専用のリソース:
id
(String) – The unique identifier of the notification rule.
設定例
This example:
Triggers on
create-alert
events.Uses
match-all-conditions
to match on both priority and tags.Notifies via SMS immediately and email after 5 minutes.
Repeats every 10 minutes if the alert is not acknowledged or closed.
Applies only during working hours (9am–6pm).
resource "atlassian-operations_notification_rule" "example" {
name = "High Priority Alert Notification"
action_type = "create-alert"
enabled = true
order = 1
criteria = {
type = "match-all-conditions"
conditions = [
{
field = "priority"
operation = "equals"
expected_value = "P1"
},
{
field = "tags"
operation = "contains"
expected_value = "infrastructure"
}
]
}
notification_time = [
"just-before",
"15-minutes-ago"
]
time_restriction = {
type = "time-of-day"
restriction = {
start_hour = 9
start_min = 0
end_hour = 18
end_min = 0
}
}
schedules = [
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
]
steps = [
{
send_after = 0
contact = {
method = "sms"
to = "+15551234567"
}
},
{
send_after = 5
contact = {
method = "email"
to = "oncall@example.com"
}
}
]
repeat = {
loop_after = 10
enabled = true
}
}
ルーティングルール
必須のリソース:
team_id
(String) – The ID of the team that owns this routing rule. This value can’t be changed after creation.notify
(Object) – Defines how incidents matching this rule should be routed. Includes:type
(String) – Required. Notification method:none
– No routingescalation
– Use an escalation policyschedule
– Use a schedule
id
(String) – Required if type is escalation or schedule. The ID of the target escalation or schedule.
オプションのリソース:
name
(String) – A descriptive name for the routing rule. Defaults to an empty string.order
(Integer) – Index of this rule among all team routing rules. Must be between 0 and 100.is_default
(Boolean) – Whether this is the default routing rule. If enabled, this rule is used when no other rules match.timezone
(String) – The timezone for time-based decisions (e.g. Europe/London). Must be a valid IANA timezone.criteria
(Object) – Defines when the rule should be triggered.
If provided, includes:type
(String) – Required inside criteria. Valid values:match-all
: No conditions requiredmatch-all-conditions
: All conditions must matchmatch-any-condition
: At least one condition must match
conditions
(List of Objects) – Required only if type is match-all-conditions or match-any-condition.
Each object may include:field
(String) – Required. The incident field to evaluate (e.g. message, priority)operation
(String) – Required. The comparison operation (e.g. equals, contains)expected_value
(String) – Optional. Value to compare againstkey
(String) – Optional. Used for key-value matching when field is extra-propertiesnot
(Boolean) – Optional. Negates the conditionorder
(Integer) – Optional. Order of the conditions in the list
time_restriction
(Attributes)type
(String) The type of the time restrictionrestriction
(Required if type = “time-of-day”) (Attributes)end_hour
(Number) The end hour of the restrictionend_min
(Number) The end minute of the restrictionstart_hour
(Number) The start hour of the restrictionstart_min
(Number) The start minute of the restriction
restrictions
(Required if type = “weekday-and-time-of-day”) (Attributes List)end_day
(String) The end day of the restrictionend_hour
(Number) The end hour of the restrictionend_min
(Number) The end minute of the restrictionstart_day
(String) The start day of the restrictionstart_hour
(Number) The start hour of the restrictionstart_min
(Number) The start minute of the restriction
読み取り専用のリソース:
id
(String) – The unique identifier of the routing rule, generated automatically.
設定例
This example:
Routes high-priority incidents tagged with
customer-impact
Only applies between 8:30 and 17:45 (London time)
Notifies through an escalation policy
Is not the default routing rule and is set to process first (
order = 0
)
resource "atlassian-operations_routing_rule" "high_priority_routing" {
team_id = "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"
name = "High Priority Incidents"
order = 0
timezone = "Europe/London"
is_default = false
criteria = {
type = "match-all-conditions"
conditions = [
{
field = "priority"
operation = "equals"
expected_value = "P1"
},
{
field = "tags"
operation = "contains"
expected_value = "customer-impact"
}
]
}
time_restriction = {
type = "time-of-day"
restriction = {
start_hour = 8
start_min = 30
end_hour = 17
end_min = 45
}
}
notify = {
type = "escalation"
id = "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb"
}
}
Alert policies resource
Required resources
enabled
(Boolean) – Whether the alert policy is active.message
(String) – Template for the alert message.name
(String) – The name of the alert policy.type
(String) – Must be set toalert
.
Optional resources
actions
(List of String) – List of actions to associate with the alert.alert_description
(String) – Template for the alert description.alias
(String) – Template for the alert alias.continue
(Boolean) – Whether to continue processing other policies after this one.description
(String) – Description of the alert policy.details
(Map of String) – Additional detail key-value pairs to include in the alert.entity
(String) – Template for the alert entity.filter
(Object) – Criteria that control when this policy is applied. Includes:type
(String) – Required. Type of the filter.conditions
(List of Objects) – Required. Each condition includes:expected_value
(String) – Required. Value to compare against.field
(String) – Required. Alert field to evaluate.operation
(String) – Required. Comparison operation.key
(String) – Optional. Key to filter when using key-value fields.not
(Boolean) – Optional. Whether to negate the condition.order
(Number) – Optional. Processing order of the condition.
keep_original_actions
(Boolean) – Whether to retain existing alert actions.keep_original_details
(Boolean) – Whether to retain existing alert details.keep_original_responders
(Boolean) – Whether to retain existing alert responders.keep_original_tags
(Boolean) – Whether to retain existing alert tags.order
(Number) – The order in which the policy is evaluated.priority_value
(String) – The priority value to assign ifupdate_priority
is enabled.responders
(List of Objects) – Specifies who will be notified. Each responder includes:type
(String) – Required. Type of the responder.id
(String) – Optional. ID of the responder (user, team, or schedule).
source
(String) – Template for the alert source.tags
(List of String) – Tags to associate with the alert.team_id
(String) – ID of the team that owns the alert policy.time_restriction
(Object) – Defines when this policy is active. Includes:enabled
(Boolean) – Required. Whether time-based restrictions are enabled.time_restrictions
(List of Objects) – Required. Each period includes:start_hour
(Number) – Required. Start hour.start_minute
(Number) – Required. Start minute.end_hour
(Number) – Required. End hour.end_minute
(Number) – Required. End minute.
update_priority
(Boolean) – Whether to change the alert priority when this policy applies.
Read-only resources
id
(String) – Unique identifier for the alert policy, assigned automatically.
設定例
resource "atlassian-operations_alert_policy" "example" {
name = "High CPU Alert Policy"
type = "alert"
enabled = true
message = "High CPU usage detected on ${host}"
alert_description = "CPU usage exceeded 90% on ${host}"
source = "monitoring-system"
priority_value = "P1"
update_priority = true
continue = true
team_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
order = 1
actions = ["Restart Service", "Notify Ops Team"]
tags = ["infrastructure", "cpu"]
alias = "cpu-alert-${host}"
responders = [
{
type = "team"
id = "yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy"
}
]
details = {
metric = "cpu.utilization"
threshold = "90"
}
filter = {
type = "match-all-conditions"
conditions = [
{
field = "message"
operation = "contains"
expected_value = "CPU usage"
},
{
field = "priority"
operation = "equals"
expected_value = "P1"
}
]
}
time_restriction = {
enabled = true
time_restrictions = [
{
start_hour = 9
start_minute = 0
end_hour = 18
end_minute = 0
}
]
}
}
Custom roles resource
Required resources
name
(String) – The name of the custom role.
Optional resources
disallowed_rights
(Set of String) – Permissions explicitly denied to the custom role. List must be alphabetically sorted.granted_rights
(Set of String) – Permissions explicitly granted to the custom role. List must be alphabetically sorted.
Read-only resources
id
(String) – Unique identifier for the custom role, assigned automatically.
設定例
resource "atlassian-operations_custom_role" "incident_responder" {
name = "Incident Responder"
granted_rights = [
"acknowledge-alert",
"close-alert",
"view-alert"
]
disallowed_rights = [
"delete-team",
"manage-schedule"
]
}
User contact resource
Required resources
method
(String) – The delivery method for the contact. Valid values typically includeemail
,sms
,voice
, ormobile
.to
(String) – The destination for the contact (e.g. email address or phone number).
Optional resources
enabled
(Boolean) – Whether this contact method is active. Defaults totrue
.
Read-only resources
id
(String) – Unique identifier for the user contact resource, assigned automatically.
設定例
resource "atlassian-operations_user_contact" "sms_contact" {
method = "sms"
to = "+15551234567"
enabled = true
}
この内容はお役に立ちましたか?