From beb2d54a88a888954e434d4bf356df88c39a561e Mon Sep 17 00:00:00 2001 From: simoncolincap Date: Thu, 16 Nov 2023 10:09:01 +0000 Subject: [PATCH] OPS-5460 Add variables to share ionos-datacenter with groups --- modules/ionos-datacenter/main.tf | 8 ++++++++ modules/ionos-datacenter/variables.tf | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/modules/ionos-datacenter/main.tf b/modules/ionos-datacenter/main.tf index 96d1e0a..58b1e0f 100644 --- a/modules/ionos-datacenter/main.tf +++ b/modules/ionos-datacenter/main.tf @@ -4,6 +4,14 @@ resource "ionoscloud_datacenter" "datacenter" { description = "" } +resource "ionoscloud_share" "datacenter_permissions" { + for_each = { for share in var.var.datacenter_shares : share.group => share} + group_id = each.key + resource_id = ionoscloud_datacenter.datacenter.id + edit_privilege = each.value.edit + share_privilege = each.value.share +} + resource "ionoscloud_private_crossconnect" "frontend_cc" { count = local.create_frontend_crossconnect ? 1 : 0 name = "${var.datacenter_name}-frontend-lan-cc" diff --git a/modules/ionos-datacenter/variables.tf b/modules/ionos-datacenter/variables.tf index 5a1ff91..9f66352 100644 --- a/modules/ionos-datacenter/variables.tf +++ b/modules/ionos-datacenter/variables.tf @@ -9,6 +9,16 @@ variable "datacenter_location" { default = "de/txl" } +variable "datacenter_shares" { + type = list(object({ + group = string + edit = optional(bool, false) + share = optional(bool, false) + })) + description = "Which groups have access to the datacenter" + default = [] +} + variable "create_frontend_crossconnect" { type = bool description = "Specifies whether crossconnect shall be created. Default: false."