Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add groups creation #757

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
creating a local to define the optional groups to be created
  • Loading branch information
mauro-cit committed Jul 14, 2022
commit 3bfa16079425f8f81510bc8c0804c45c28765b2f
12 changes: 8 additions & 4 deletions 0-bootstrap/modules/groups/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@
* limitations under the License.
*/

locals {
optional_groups_to_create = {
for key, value in var.create_groups_holder.optional_groups : key => value
if value != ""
}
}

module "required_group" {
for_each = tomap(var.create_groups_holder.required_groups)
source = "terraform-google-modules/group/google"
Expand All @@ -27,10 +34,7 @@ module "required_group" {
}

module "optional_group" {
for_each = {
for key, value in var.create_groups_holder.optional_groups : key => value
if value != ""
}
for_each = local.optional_groups_to_create
source = "terraform-google-modules/group/google"
version = "~> 0.1"

Expand Down
2 changes: 1 addition & 1 deletion 0-bootstrap/modules/groups/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ output "created_required_groups" {

output "created_optinal_groups" {
description = "List of the Optional Groups created by the module."
value = var.create_groups_holder.optional_groups
value = local.optional_groups_to_create

//This depends_on is necessary otherwhise the entered Optional groups would be returned before they were properly created
depends_on = [module.optional_group]
Expand Down