全てのモジュールにvariables.tfを配置する

ルール

Place variables.tf in every module. Empty file is acceptable

(全てのモジュールにvariables.tfを配置する)

解説

全てのモジュールにvariables.tfを配置します。variableブロックは必ずこのファイルに記載します。

機械的にコードの位置を推測できるようになるためAIとの相性も良いです。

サンプルコード

# ./modules/networking/variables.tf

variable "environment" {
  type        = string
  description = "環境名(development, staging, production)"
}

variable "project" {
  type        = string
  description = "プロジェクト名"
}

variable "vpc_cidr" {
  type        = string
  description = "VPCのCIDRブロック"
}

variable "public_subnet_cidrs" {
  type        = list(string)
  description = "パブリックサブネットのCIDRブロックリスト"
}

variable "availability_zones" {
  type        = list(string)
  description = "使用するアベイラビリティゾーンのリスト"
}

参考リンク

Show Text to Share
全てのモジュールにvariables.tfを配置する
https://www.tricrow.com/infrastructure/development-guidline/repository_structure.standard.variables.html
この記事を書いた人
T.Nakamura
T.Nakamura
AIが大好きなクラウドエンジニア。IT業界歴10年以上。標準化と効率化を追求している。技術ネタを発信中。フォローお気軽にどうぞ!フォローはこちら

カテゴリ

タグ