From 8d75a278a62c88eabc19c1f3cbb4c99b08511bef Mon Sep 17 00:00:00 2001 From: Lorenzo Caggioni Date: Tue, 9 Jun 2020 15:55:22 +0200 Subject: [PATCH] Fixes --- modules/bigtable-instance/main.tf | 8 ++++---- modules/bigtable-instance/variables.tf | 26 ++++++++++---------------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/modules/bigtable-instance/main.tf b/modules/bigtable-instance/main.tf index e8beacf8..0e7129ff 100644 --- a/modules/bigtable-instance/main.tf +++ b/modules/bigtable-instance/main.tf @@ -16,11 +16,11 @@ locals { tables = { - for k in var.tables : k => lookup(var.tables_options, k, var.table_options_default) + for k, v in var.tables : k => v.table_options != null ? v.table_options : var.table_options_defaults } - access_roles_bindings = { - for k in var.access_roles : k => lookup(var.access_roles_binding, k, []) + iam_roles_bindings = { + for k in var.iam_roles : k => lookup(var.iam_members, k, []) } } @@ -39,7 +39,7 @@ resource "google_bigtable_instance" "default" { } resource "google_bigtable_instance_iam_binding" "default" { - for_each = local.access_roles_bindings + for_each = local.iam_roles_bindings project = var.project_id instance = google_bigtable_instance.default.name diff --git a/modules/bigtable-instance/variables.tf b/modules/bigtable-instance/variables.tf index 16066b13..982bfb8a 100644 --- a/modules/bigtable-instance/variables.tf +++ b/modules/bigtable-instance/variables.tf @@ -14,13 +14,13 @@ * limitations under the License. */ -variable "access_roles" { +variable "iam_roles" { description = "Authoritative for a given role. Updates the IAM policy to grant a role to a list of members." type = list(string) default = [] } -variable "access_roles_binding" { +variable "iam_members" { description = "Authoritative for a given role. Updates the IAM policy to grant a role to a list of members. Other roles within the IAM policy for the instance are preserved." type = map(list(string)) default = {} @@ -49,7 +49,7 @@ variable "instance_type" { } variable "name" { - description = "he name of the Cloud Bigtable instance." + description = "The name of the Cloud Bigtable instance." type = string } @@ -71,23 +71,18 @@ variable "storage_type" { } variable "tables" { - description = "Tables to be created in the BigTable instnace." - type = list(string) - default = [] -} - -variable "tables_options" { - description = "Tables to be created in the BigTable instnace." + description = "Tables to be created in the BigTable instance." type = map(object({ - split_keys = list(string) - column_family = string + table_options = object({ + split_keys = list(string) + column_family = string }) - ) + })) default = {} } -variable "table_options_default" { - description = "Default option of tables created in the BigTable instnace." +variable "table_options_defaults" { + description = "Default option of tables created in the BigTable instance." type = object({ split_keys = list(string) column_family = string @@ -101,5 +96,4 @@ variable "table_options_default" { variable "zone" { description = "The zone to create the Cloud Bigtable cluster in." type = string - default = "europe-west1-b" }