Terraformのversion 1.9が2024年の6月26日にGAになりました。1.9の新機能を見ていきましょう。 変数のvalidationで色々参照できるようになった 変数にはvalidationを実装することができます。例えば以下のようなものです。 variable "aws_account_id" { type = string description = "AWS Account ID" validation { condition = can(regex("^[0-9]{12}$", var.aws_account_id)) error_message = "Invalid AWS accountID." } } これはAWSアカウントIDが格納されるのを想定した変数です。AWSアカウントIDは必ず12桁の数字ですので、そうでない場合はエラーにしています。 上記例では c
![Terraform 1.9 の新機能紹介 | DevelopersIO](https://cdn-ak-scissors.b.st-hatena.com/image/square/8e41bb804e6d5d2acafc9215e4e7456353a9d16f/height=288;version=1;width=512/https%3A%2F%2Fimages.ctfassets.net%2Fct0aopd36mqt%2Fwp-thumbnail-db64f1f2fda342fbdbdb6b2e336560e8%2F99e8f408bed87cdb4aa6bcadcaf57fc9%2Fterraform-eyecatch.png)