Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gillianstravers committed Nov 21, 2024
1 parent 6117971 commit a65e6e1
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 9 deletions.
22 changes: 22 additions & 0 deletions .terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
resource "azurerm_resource_group" "this" {
count = var.create_resource_group ? 1 : 0
name = var.resource_group.name
location = var.resource_group.location
tags = merge(
Expand All @@ -10,12 +11,12 @@ resource "azurerm_resource_group" "this" {
}

resource "azurerm_ip_group" "this" {
for_each = var.ipgroups
name = var.ipgroups.name
location = var.resource_group.location
resource_group_name = azurerm_resource_group.this.name
for_each = var.ipgroups

cidrs = var.ipgroups.cidrs
name = each.value.name
location = var.resource_group.location
resource_group_name = var.resource_group.name
cidrs = each.value.cidrs

tags = merge(
try(var.tags),
Expand Down
20 changes: 16 additions & 4 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -1,16 +1,28 @@
variable "create_resource_group" {
description = "A flag to create the Resource Group"
type = bool
default = true
}

variable "resource_group" {
description = "The Resource Group to create"
type = object({
type = object({
name = string
location = string
})
}

variable "tags" {
description = "A map of tags to assign to the resource."
type = map(string)
default = {}
}

variable "ipgroups" {
description = "A map of IP Groups to create"
type = map(object({
type = map(object({
name = string
cidrs = list(string)
})
})
)
}
}

0 comments on commit a65e6e1

Please sign in to comment.