Skip to content

Commit

Permalink
OPS-5460 Add variables to share ionos-datacenter with groups
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncolincap committed Nov 16, 2023
1 parent 505e4fe commit beb2d54
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/ionos-datacenter/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 10 additions & 0 deletions modules/ionos-datacenter/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit beb2d54

Please sign in to comment.