terraform-google-vault
terraform-google-vault copied to clipboard
Add support for version >4.0.0 of the Google Provider
Description of the problem
Version 4.0.0 introduced breaking changes that need to be addressed.
How to reproduce
- Create a main.tf file on an empty folder with the following contents:
provider "google" {}
data "google_client_config" "current" {}
module "vault" {
providers = {
google = google
}
source = "git::https://github.com/mbrancato/terraform-google-vault.git"
name = "vault"
project = data.google_client_config.current.project
location = data.google_client_config.current.region
vault_image = <image pushed to gcr, see README.md>
}
- Run
$ terraform init
$ terraform plan
Expected result
The command $ terraform plan
succeeds
Current behavior
╷
│ Error: Missing required argument
│
│ on .terraform\modules\vault\main.tf line 44, in resource "google_storage_bucket" "vault":
│ 44: resource "google_storage_bucket" "vault" {
│
│ The argument "location" is required, but no definition was found.
╵
╷
│ Error: Unsupported attribute
│
│ on .terraform\modules\vault\main.tf line 66, in resource "google_kms_crypto_key" "vault":
│ 66: key_ring = google_kms_key_ring.vault.self_link
│ This object has no argument, nested block, or exported attribute named "self_link".
╵
Proposed solution
- Add the
location
argument to thegoogle_storage_bucket
, and the value should be a variable that defaults to 'US' to maintain the current behavior. - Change line 66 from
key_ring = google_kms_key_ring.vault.self_link
to
key_ring = google_kms_key_ring.vault.id