---
sourceDocument: ブラジル IT Operations Management (ITOM)
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/it-operations-management

 Release :

    - brazil

ft:locale :

    - ja-JP

ft:publication_title :

    - ブラジル IT Operations Management (ITOM)

ft:clusterId :

    - itom

bundleId :

    - itom

workflow :

    - Technology


---

# Terraform テンプレートの公開

# Terraform テンプレートの公開 {#ariaid-title1}

リリースバージョン: Brazil  
更新日 2026年09月10日  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：4分  
アプリケーションによって定義された Terraform テンプレートを GitHub で公開して、バージョン管理、コラボレーション、および一元化されたストレージを有効にします。

## 始める前に

必要なロール：Terraform admin

## 手順

1. Terraform テンプレート専用の GitHub リポジトリを作成します。
2. 次のコードを別のファイルに保存します。  
   * ファイル名：awsaccount.tf

         terraform {
           required_providers {
             aws = {
               source  = "hashicorp/aws"
               version = "~>5.0"
             }
           }
         }

         provider "aws" {
           region = var.region
         }

         resource "aws_organizations_account" "account" {
           email = var.root_email
           name = var.account_name
           tags = var.tags
           parent_id = var.parent_id
           close_on_deletion=var.close_delete
           create_govcloud=var.gov_cloud
         }

         resource "aws_budgets_budget" "cost" {
           name  = join("-", ["SN-CAM-Monthly-Budget", aws_organizations_account.account.id])
           count = var.monthly_budget > 0 ? 1 : 0
           budget_type  = "COST"
           limit_amount = var.monthly_budget
           limit_unit   = "USD"
           time_unit    = "MONTHLY"

           cost_filter {
             name = "LinkedAccount"
             values = [
               aws_organizations_account.account.id
             ]
           }

           notification {
             comparison_operator        = "GREATER_THAN"
             threshold                  = 100
             threshold_type             = "PERCENTAGE"
             notification_type          = "FORECASTED"
             subscriber_email_addresses = [var.root_email, var.notification_email]
           }

           notification {
             comparison_operator        = "GREATER_THAN"
             threshold                  = 85
             threshold_type             = "PERCENTAGE"
             notification_type          = "ACTUAL"
             subscriber_email_addresses = [var.root_email, var.notification_email]
           }

           notification {
             comparison_operator        = "GREATER_THAN"
             threshold                  = 100
             threshold_type             = "PERCENTAGE"
             notification_type          = "ACTUAL"
             subscriber_email_addresses = [var.root_email, var.notification_email]
           }
         }

   * ファイル名：variables.tf

         variable "region" {
           type = string
           default = "us-east-1"
         }

         variable "account_name" {
           type = string
           description = "(Required) Account Name"
         }

         variable "root_email" {
           type = string
           description = "(Required) Account Email"
         }

         variable tags{
           type = map(string)
           description = "(Required) Tags for the resource"
         }

         variable "close_delete" {
           type = bool
           description = "Close Account on deletion"
           default = true
         }

         variable "gov_cloud" {
           type = bool
           description = "Gov Cloud Account"
           default = false
         }

         variable "parent_id" {
           type = string
           description = "(Required) Account Parent Organizational Unit"
         }

         variable monthly_budget {
           type = number
           default = 0
         }

         variable notification_email {
           type = string
           description = "Additional email where Budget Notifications are to be sent"
         }

   {#publish-terraform-templates__ul_uqh_hcm_lcc}
3. リモートリポジトリに Terraform ファイルをプッシュします。
4. テンプレートが GitHub に格納されたら、その場所または URL をメモします。  
   このテンプレートは、Terraform Cloud および ServiceNow インスタンスでサブスクリプションアカウントの作成を自動化する際に参照されます。  
   重要:  
   変数はアプリケーションに密接に関連付けられているため、テンプレートを変更しないでください。
**関連タスク**   

* [クラウドワークスペース でクラウドアカウント管理Terraform組織を作成する](https://servicenow-prod.fluidtopics.net/wJQhL56vLYr2yshHbg7UXg "Terraform Cloud/Terraform Enterprise と統合して、アカウントの整理、ワークフローの定義、セキュリティの適用、コラボレーションの改善、スケーラビリティの強化を行います。")
* [Terraform CloudとGitHubの統合](https://servicenow-prod.fluidtopics.net/P~bbPcTIjhDdD92S4ydf1Q "GitHubをTerraformと統合してワークスペースをリポジトリにリンクし、バージョン管理、変更追跡、およびロールバックを有効にします。")
* [Terraform API トークンの作成](https://servicenow-prod.fluidtopics.net/qYWtzlgCJaEpKFkSgBTsZg "権限が制限された API トークンを生成すると、セキュリティが強化され、きめ細かな制御が可能になり、自動化が容易になり、 Terraform 組織内での一時的なアクセスが可能になります。")

