variableブロックはvariables.tfに定義する

ルール

Define variable blocks in variables.tf.

(variableブロックはvariables.tfに定義する)

解説

variableブロックの置き場所を定めておくことで可読性を向上させます。

サンプルコード

# variables.tf
variable "environment" {
  type        = string
  description = "Environment name (e.g., production, staging)"
}

variable "vpc_cidr" {
  type        = string
  description = "CIDR block for VPC"
}

variable "enable_nat_gateway" {
  type        = bool
  description = "Whether to create NAT Gateway for private subnets"
}

参考リンク

Show Text to Share
variableブロックはvariables.tfに定義する
https://www.tricrow.com/infrastructure/development-guidline/coding_standards.style.variables.html
この記事を書いた人
T.Nakamura
T.Nakamura
SRE | セキュリティ前提の設計・運用・監査対応(PCI DSS) | ドキュメント整備と仕組み化で開発・運用を整えます | AWS SAP / 日商簿記一級フォローはこちら

カテゴリ

タグ