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

Set up Atlassian Operations Terraform Provider

The Atlassian Operations Terraform Provider allows you to interact with Jira Service Management resources such as users, teams, escalations, and more. By defining your resources in declarative configuration files, you can easily code, edit, review, and version-control your IT operations configurations.

View the Atlassian Operations Terraform Provider repository on GitHub.

Supported resources and data sources

This provider supports the creation and management of the following resources and data sources via Terraform:

Data Sources (Read Only)

  • Users (excludes User Contact API)

  • チーム

  • スケジュール

Resources (Read / Write - CRUD)

  • Teams (with or without members)

  • API and email-based integrations

  • エスカレーション

  • スケジュール

  • Schedule rotations

Terraform cannot update team admins

Since the user who creates a team automatically becomes its admin, and the provider can only support actions currently available via the Jira Service Management Operations REST API, you cannot update team admins with Terraform.

Configure the Terraform Provider

To set up the Atlassian Operations Terraform Provider, include atlassian-operations in the required_providersblock of your Terraform configuration. Ensure that you configure the provider with valid credentials before using it.

Required configuration parameters

The provider requires the following parameters:

  1. cloud_id: The simplest way to find your site's Cloud ID is throughhttps://<your-site-name>.atlassian.net/_edge/tenant_info

  2. domain_name - Your site's URL, e.g., my-site-name.atlassian.net

  3. email_address

  4. token - You can list your existing Atlassian API tokens or create new ones by managing API token for your Atlassian account.

Sample configuration

Below is an example Terraform configuration:

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>" }

For more details, visit Atlassian Operations provider page and view the documentation to explore available resources. You can find them listed on the left menu of the documentation page. Currently, the provider supports six resources and three data sources.

To get started with Terraform using this provider, refer to the Terraform tutorials.

Using Data Sources

User Data Source

To fetch a user, you need to provide an email address.

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

Team Data Source

To fetch a team, both the team id and the organization id are required.

To find the Organization ID view what is Organization ID an where to find it

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" }

Schedule Data Source

To fetch a schedule, you need to specify its name

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

Using Resources

Team Resource

Required resources:

  • description (String) The description of the team

  • display_name (String) The display name of the team

  • member (Attributes Set) The members of the team

    • account_id (String) The account ID of the user

  • organization_id (String) The organization ID of the team

  • team_type (String) The type of the team

Optional resources:

  • site_id (String) The site ID of the team

Read-only resources:

  • id (String) The ID of the team

  • user_permissions (Attributes) The user permissions of the team

    • add_members (Boolean) The permission to add members to the team

    • delete_team (Boolean) The permission to delete the team

    • remove_members (Boolean) The permission to remove members from the team

    • update_team (Boolean) The permission to update the team

To find the Organization ID view what is Organization ID an where to find it

Example Configuration

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" } ] }

Schedule Resource

Required resources:

  • name (String) The name of the schedule

  • team_id (String) The ID of the team that owns the schedule

Optional resources:

  • description (String) The description of the schedule

  • enabled (Boolean) Whether the schedule is enabled

  • timezone (String) The timezone of the schedule

Read-only resources:

  • id (String) The ID of the schedule

Example Configuration

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 Rotation Resource

Required resources:

  • schedule_id (String) The ID of the schedule

  • start_date (String) The start date of the rotation

  • type (String) The type of the rotation

Optional resources:

  • end_date (String) The end date of the rotation

  • length (Number) The length of the rotation

  • name (String) The name of the rotation

  • participants (Attributes List) The participants of the rotation

    • type (String) The type of the participant

    • id (String) (Optional, if type = “noone”) The ID of the participant

  • time_restriction (Attributes)

    • type (String) The type of the time restriction

    • restriction (Required if type = “time-of-day”) (Attributes)

      • end_hour (Number) The end hour of the restriction

      • end_min (Number) The end minute of the restriction

      • start_hour (Number) The start hour of the restriction

      • start_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 restriction

      • end_hour (Number) The end hour of the restriction

      • end_min (Number) The end minute of the restriction

      • start_day (String) The start day of the restriction

      • start_hour (Number) The start hour of the restriction

      • start_min (Number) The start minute of the restriction

Read-only resources:

  • id (String) The ID of the rotation

Example Configuration

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

Escalation Resource

Required resources:

  • name (String) The name of the escalation

  • rules (Attributes Set) List of the escalation rules.

    • condition (String) The condition for notifying the recipient of escalation rule that is based on the alert state.

    • delay (Number) Time delay of the escalation rule in minutes.

    • notify_type (String) Recipient calculation logic for escalations.

    • recipient (Attributes) Object of schedule, team, or users which will be notified in escalation.

      • type (String) The type of the recipient

      • id (String) The ID of the recipient

  • team_id (String) The ID of the team that owns the escalation

Optional resources:

  • description (String) The description of the escalation

  • enabled (Boolean) Whether the escalation is enabled

  • repeat (Attributes) Repeat preferences of the escalation including repeat interval, count, reverting acknowledge and seen states back and closing an alert automatically as soon as repeats are completed.

    • close_alert_after_all (Boolean) It is to close the alert automatically if escalation repeats are completed.

    • count (Number) Repeat time indicating how many times the repeat action will be performed.

    • reset_recipient_states (Boolean) It is for reverting acknowledge and seen states back on each repeat turn if an alert is not closed.

    • wait_interval (Number) The duration in minutes to repeat the escalation rules after processing the last escalation rule. It is mandatory if you would like to add or remove repeat option. 0 should be given as a value to disable repeat option.

Read-only resources:

  • id (String) The ID of the escalation

Example Configuration

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 Integration Resource

Required resources:

  • name (String)

  • type (String)

Optional resources:

  • enabled (Boolean)

  • team_id (String)

  • type_specific_properties (JSON String) Integration specific properties may be provided to this object. Use jsonencode to convert the object into a string.

Read-only resources:

  • advanced (Boolean)

  • directions (List of String)

  • domains (List of String)

  • id (String) The ID of the escalation

  • maintenance_sources (Attributes List)

    • enabled (Boolean) Whether the maintenance is enabled

    • interval (Attributes)

      • end_time_millis (Number) The end time of the maintenance

      • start_time_millis (Number) The start time of the maintenance

    • maintenance_id (String) The ID of the maintenance

Example Configuration

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 }) }

Email Integration Resource

Required resources:

  • name (String)

  • type_specific_properties (Attributes) Integration specific properties may be provided to this object.

    • email_username (String)

    • suppress_notifications (Optional, defaults to false) (Boolean)

Optional resources:

  • enabled (Boolean)

  • team_id (String)

Read-only resources:

  • advanced (Boolean)

  • directions (List of String) Direction of the action. It can be incoming or outgoing

  • domains (List of String) Domain of the action. It can be alert

  • id (String) The ID of the escalation

  • maintenance_sources (Attributes List)

    • enabled (Boolean)

    • interval (Attributes)

      • end_time_millis (Number)

      • start_time_millis (Number)

    • maintenance_id (String)

Example Configuration

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




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

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