variableブロックに型定義を含める

ルール

Include type definitions in variable blocks.

(variableブロックに型定義を含める)

解説

AWSの推奨に従っています。

変数に型を明示することで誤った値の代入を防ぐ他、変数の性格を推測しやすくなります。

サンプルコード

# variables.tf
variable "environment" {
  type        = string
  description = "Environment name"
}

variable "instance_count" {
  type        = number
  description = "Number of instances to create"
}

参考リンク

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

カテゴリ

タグ