フラミナル

考え方や調べたことを書き殴ります。IT技術系記事多め

terraform

【備忘】Terraform: Cloud certificate reference is not supported for TargetHttpsProxy creation., invalid の解決

こう書いてたら失敗した。(なぜ) resource "google_compute_target_https_proxy" "default" { name = "pr-cloudrun-https-proxy" url_map = google_compute_url_map.default.id certificate_manager_certificates = ["//certificatemanager.googleapis.com…

terraform google provider を 5.0.0 台にあげようとしたら Could not retrieve the list of available versions for provider hashicorp/google がでた

結論 利用していた別の module が constraint でしぼってた。 ❯ terraform providers Providers required by configuration: . ├── module.project_services │ ├── provider[registry.terraform.io/hashicorp/google] >= 3.43.0, < 5.0.0 │ └── provider[reg…

【Terraform】null_resourceでシーケンシャルなterraform リソース作成を実現する

Terraform 内のリソースにおいて depends_on という順序制御の仕組みがあります。しかし同じ module を複数呼び出す際に、シーケンシャルに実行したいケースがあるともいます。(私はありました) もちろん呼び出す module ごとに depends_on を書けば解決す…

memory store for redis の maintenance window を Terraform で設定する

Terraform の google provider 4.9.0 から memory store for redis の maintenance window が設定できるようになりました。 複数の redis を構築する場合は、メンテナンスウインドウをすこしづつずらしたいと思うので工夫した Terraform コードを紹介します…

Terraform 本体&provider&module の最新バージョンを取得するコマンド

Provider Registry Protocol | Terraform by HashiCorp terraform curl -sH "Accept: application/vnd.github.v3+json" \\n https://api.github.com/repos/hashicorp/terraform/releases/latest | jq -r ".name" v1.1.3 provider curl -sL 'https://registry…

provider alias を削除したときの挙動を確認する

確認したいこと module に対して alias 名を指定した provider を付与している場合に、これを削除するとどうなるのかを検証したい。 モチベーションとしては公式サイトを見ると provider を明示的に渡す必要が無いので、それにならいたい感じ。 Providers Wi…

【備忘】TerraformでGCP monotiringのfilterをうまく設定する方法

cpu_stateでどうにかフィルタするのをTerraformに設定したくて、どうにか辿り着いたTips。 下記のサイトにまとまっている情報をみる。 Legacy Monitoring and Logging agent metrics | Google Cloud 太文字のものはmetric.label.\"cpu_state\"= \"idle\""の…

google_project_iam_xxxの違いとまとめ

GCPにおけるIAMの構造 メンバー ユーザ / グループ / サービスアカウント / ドメイン ロール(役割) GCPのリソースに対する権限(例:GCSの管理者権限 / Projectの閲覧権限 など) IAMポリシー ロールバインディングという名前で 「どのメンバーにどのロール…

【Terraform】IAMで配列変数を扱うときの方法

IPアドレスのリストを変数で用意して、それをIAMで呼び出す時にこんなエラーが出ます。これを解消するTipsです。 # 変数ファイル IPaddress_list= [A,B,C,D] --- # Terraformコード access_policies = <

[解決方法]TerraformでtfstateをS3で管理しようとすると「S3 bucket does not exist.」がでる

Error: Error inspecting states in the "s3" backend: S3 bucket does not exist. The referenced S3 bucket must have been previously created. If the S3 bucket was created within the last minute, please wait for a minute or two and try again. E…