From c557f9e50442b06a8639390db83ef64b454110ce Mon Sep 17 00:00:00 2001 From: Danny Seymour Date: Fri, 22 Feb 2019 15:19:02 -0800 Subject: [PATCH] Fix regression pulling gsuite provider into core project factory in module version v1.1.0 --- modules/gsuite_enabled/main.tf | 14 ++++++++++++-- modules/gsuite_group/main.tf | 11 ----------- modules/gsuite_group/outputs.tf | 2 +- modules/gsuite_group/variables.tf | 5 ----- test/ci_integration.sh | 2 +- 5 files changed, 14 insertions(+), 20 deletions(-) diff --git a/modules/gsuite_enabled/main.tf b/modules/gsuite_enabled/main.tf index 0a480183..772ca0e7 100644 --- a/modules/gsuite_enabled/main.tf +++ b/modules/gsuite_enabled/main.tf @@ -38,7 +38,17 @@ module "gsuite_group" { domain = "${var.domain}" name = "${local.group_name}" org_id = "${var.org_id}" - create_group = "${var.create_group}" +} + +/****************************************** + Gsuite Group Configuration + *****************************************/ +resource "gsuite_group" "group" { + count = "${var.create_group ? 1 : 0}" + + description = "${var.name} project group" + email = "${module.gsuite_group.email}" + name = "${local.group_name}" } /*********************************************** @@ -55,7 +65,7 @@ resource "gsuite_group_member" "api_s_account_api_sa_group_member" { module "project-factory" { source = "../core_project_factory/" - group_email = "${module.gsuite_group.email}" + group_email = "${element(compact(concat(gsuite_group.group.*.email, list(module.gsuite_group.email))), 0)}" group_role = "${var.group_role}" lien = "${var.lien}" manage_group = "${var.group_name != "" || var.create_group}" diff --git a/modules/gsuite_group/main.tf b/modules/gsuite_group/main.tf index c219ee93..e0eacde1 100644 --- a/modules/gsuite_group/main.tf +++ b/modules/gsuite_group/main.tf @@ -25,14 +25,3 @@ locals { data "google_organization" "org" { organization = "${var.org_id}" } - -/****************************************** - Gsuite Group Configuration - *****************************************/ -resource "gsuite_group" "group" { - count = "${var.create_group ? 1 : 0}" - - description = "${var.name} project group" - email = "${local.email}" - name = "${var.name}" -} diff --git a/modules/gsuite_group/outputs.tf b/modules/gsuite_group/outputs.tf index 39d211fa..fefc873a 100644 --- a/modules/gsuite_group/outputs.tf +++ b/modules/gsuite_group/outputs.tf @@ -21,5 +21,5 @@ output "domain" { output "email" { description = "The email address of the group." - value = "${element(compact(concat(gsuite_group.group.*.email, list(local.email))), 0)}" + value = "${local.email}" } diff --git a/modules/gsuite_group/variables.tf b/modules/gsuite_group/variables.tf index 48627671..a3d74b4b 100644 --- a/modules/gsuite_group/variables.tf +++ b/modules/gsuite_group/variables.tf @@ -26,8 +26,3 @@ variable "name" { variable "org_id" { description = "The organization ID." } - -variable "create_group" { - description = "Whether to create the group or not" - default = "false" -} diff --git a/test/ci_integration.sh b/test/ci_integration.sh index 9a5592f8..894b3190 100755 --- a/test/ci_integration.sh +++ b/test/ci_integration.sh @@ -29,7 +29,7 @@ finish() { setup_environment() { local tmpfile tmpfile="$(mktemp)" - echo "${SERVICE_ACCOUNT_JSON}" > "${tmpfile}" + echo "${SERVICE_ACCOUNT_JSON}" >"${tmpfile}" # gcloud variables export CLOUDSDK_AUTH_CREDENTIAL_FILE_OVERRIDE="${tmpfile}"