Terraform variable sensitive

variable "sample" {
  description = "sample"
  type        = string
  sensitive   = true
}

sensitive = trueは、Terraformがその変数の値をログや出力に表示しないようにするための設定。

具体的には以下の効果がある。

  • terraform plan / terraform apply の出力で値が (sensitive value) とマスクされる
  • terraform output でも非表示になる
  • この変数を参照するリソースの属性も、plan 上ではマスクされる