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."