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
AIが大好きなクラウドエンジニア。IT業界歴10年以上。標準化と効率化を追求している。技術ネタを発信中。フォローお気軽にどうぞ!フォローはこちら

カテゴリ

タグ