Terraform
The Meta-Arguments section documents special arguments that can be used with every resource type, including depends_on, count, for_each, provider, and lifecycle. Terraformのリソースタイプで使えるメタ引数で、リソースの状態そのものに影響しな…
SGはVPCに紐づいているので、VPCピアリングで繋いでやってからSGを指定する VPCピアリング SGのインバウンドルール設定 dev.classmethod.jp で、VPCピアリングはともかく、SGのインバウンドルール設定をTerraformで実現しようとすると、他アカウントのSGを参…
一般的なconcatと動きは一緒、list型をくっつける。 > concat(["a", ""], ["b", "c"]) [ "a", "", "b", "c", ] developer.hashicorp.com
terraform cloud tutorial developer.hashicorp.com
When a user needs to type a domain name, the length of each label is omitted and the labels are separated by dots ("."). Since a complete domain name ends with the root label, this leads to a printed form which ends in a dot. We use this p…
terraform-docs.io
jsonencodeでもfileでもいい なおTerraform自体がGoベースで、jsonencodeのところでterraform planに失敗したらGoなエラーログが出てくるので、Goの知識が多少必要 registry.terraform.io
まずCreateLoadBalancerしてから、削除保護やアクセスログの設定などについてModifyLoadBalancerAttributes感じの流れ registry.terraform.io なおS3アクセスログの設定をしたいのであれば、以下に沿ってバケットポリシーの設定をしてやらないと、対象S3バケ…
S3でバックエンド管理しててDynamoDBでロック管理している時にapplyがタイムアウトした時なんかにロックが発生する ので、terraform force-unlock (lock id)してやる developer.hashicorp.com
SecureStringなパラメータストア、Terraformでは作れるがCFnでは作れない。でもTerraformで作れても値は平文でstateに保存されるので、ちょっと工夫が必要 https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssm_parameter docs…
特に書くことはなく、以下4つをtrue falseするだけ resource "aws_s3_bucket" "example" { bucket = "example" } resource "aws_s3_bucket_public_access_block" "example" { bucket = aws_s3_bucket.example.id block_public_acls = true block_public_poli…
index_documentはsuffixを使う。aws_s3_bucketの中のindex_document(depcreated)だとsuffixが必要なかった。 resource "aws_s3_bucket_website_configuration" "example" { bucket = aws_s3_bucket.example.id index_document { suffix = "index.html" } } h…
The server_side_encryption_configuration attribute is deprecated. See aws_s3_bucket_server_side_encryption_configuration for examples with server side encryption configured. なので、SSEは別ブロックで対応する。 デフォルトだとこういう感じな…
v1.5.0以上の機能。idが事前にわかってないとimportブロックは使えないそうだがどういうidはproviderのドキュメントを読め、とのこと。 import { to = aws_instance.example id = "i-abcd1234" } resource "aws_instance" "example" { name = "hashi" # (oth…
データソース aws_subnets はサブネットIDのセットを取得する We removed the aws_subnet_ids data source. Use the aws_subnets data source instead. 似た名前のaws_subnet_idsは5でなくなりました Terraformのmap(string)は { name: value } ではなく { n…
If you are creating Instances in a VPC, use vpc_security_group_ids instead. VPC内でEC2インスタンスを作成するときにvpc_security_group_idsではなくsecurity_groupsを指定すると、後でapplyする時にインスタンス強制再作成となってしまうので、ドキュ…
Stores the state as a given key in a given bucket on Amazon S3. This backend also supports state locking and consistency checking via Dynamo DB, which can be enabled by setting the dynamodb_table field to an existing DynamoDB table name. A…
map (or object): a group of values identified by named labels, like {name = "Mabel", age = 52}. map(any)だと↑のような書き方になる developer.hashicorp.com
scope - (Required) Specifies whether this is for an AWS CloudFront distribution or for a regional application. Valid values are CLOUDFRONT or REGIONAL. To work with CloudFront, you must also specify the Region US East (N. Virginia). ってい…
We STRONGLY recommend you read the GCP guides as the Environment resource requires a long deployment process and involves several layers of GCP infrastructure, including a Kubernetes Engine cluster, Cloud Storage, and Compute networking re…
そのうちterraform-google-modulesに移行しそうな気はしている github.com registry.terraform.io registry.terraform.io
2023年2月などに出たプルリクでmax_time_travel_hoursなるパラメータ対応が出てきた。 マージ自体はされているが、リリースには出ていないので、5.4.3をダウンロードしてもmax_time_travel_hoursには対応していない。 詳しく調べきれていないけれど、タイム…
You can use Terraform's -target option to target specific resources, modules, or collections of resources. In this tutorial, you will provision an S3 bucket with some objects in it, then apply changes incrementally with -target. terrafrom …
ざっくり リポジトリにCloud Build GitHub appをインストール Cloud Build用のサービスアカウントを作成して、editor権限を付与 Cloud Buildからリポジトリに接続 Cloud Buildのトリガー作成 cloudbuild.yamlを書く cloud.google.com github.com
KMSのencryptor decryptorをいい感じに設定するためのIAMポリシーのところ registry.terraform.io $ terraform import google_kms_crypto_key_iam_binding.crypto_key "your-project-id/location-name/key-ring-name/key-name roles/editor"
v6.0.0 module "redis_test_00001" { source = "terraform-google-modules/memorystore/google" version = "6.0.0" enable_apis = false name = "redis_test_00001" project = data.google_project.current.project_id connect_mode = "PRIVATE_SERVICE_ACCE…
ピアリング接続を作成しようとしたらエラーが出た。 「注: ピアリングした VPC ネットワーク内のサブネットの IP 範囲は重複してはなりません。」 って注意されているんだから、ピアリングしたVPCネットワークでサブネットのIPが重複していたらダメだよね。 …
サブネットワークのセカンダリ ipv4 レンジをTerraformで更新しようとしたら失敗するやつ github.com 更新ができないなら削除して追加をTerraformの内々で実行すればいいんだろうけど、このIssueが起票されてから数年間ずっと緑が続いているのを考えると、諦…
resourcesは省略できない resourcesでワイルドカードは使えない resourcesで対応していないリソースタイプがある(Secret Managerとか) 実行した後にterraform.tfstateにステートファイルとして残るので、これをバックエンドの適当なところにアップロードすれ…
Terraformのモジュール、いろんな概念があってわかりづらい Root Modules Every Terraform configuration has at least one module, known as its root module, which consists of the resources defined in the .tf files in the main working directory. T…