terraform-google-vault icon indicating copy to clipboard operation
terraform-google-vault copied to clipboard

Add support for version >4.0.0 of the Google Provider

Open akerone opened this issue 3 years ago • 0 comments

Description of the problem

Version 4.0.0 introduced breaking changes that need to be addressed.

How to reproduce

  1. 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>
}
  1. 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

  1. Add the location argument to the google_storage_bucket, and the value should be a variable that defaults to 'US' to maintain the current behavior.
  2. Change line 66 from
  key_ring        = google_kms_key_ring.vault.self_link

to

  key_ring        = google_kms_key_ring.vault.id

akerone avatar Nov 26 '21 07:11 akerone