Skip to content

Commit

Permalink
string?
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcalalang committed Jan 18, 2024
1 parent 8e05cdc commit f6c9394
Showing 1 changed file with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
## Active Directory Instances Terraform

# Random id generator
resource "random_id" "active-directory-random-id" {
byte_length = 16
resource "random_string" "active-directory-random-string" {
length = 4
min_lower = 2
min_numeric = 2
special = false
upper = false
count = sum([var.active-directory-instance-count])
}

Expand Down Expand Up @@ -37,7 +41,7 @@ resource "azurerm_network_interface_security_group_association" "active-director

# Active Directory Instances NICs
resource "azurerm_network_interface" "nic-instances" {
name = "nic-${random_id.active-directory-random-id[0].result}-${count.index}"
name = "nic-${random_string.active-directory-random-string[0].result}-${count.index}"
location = azurerm_resource_group.active-directory-resource-group.location
resource_group_name = azurerm_resource_group.active-directory-resource-group.name
count = sum([var.active-directory-instance-count])
Expand All @@ -57,7 +61,7 @@ resource "azurerm_network_interface" "nic-instances" {

# Active Directory Instances
resource "azurerm_windows_virtual_machine" "active-directory-instance" {
name = "win-${random_id.active-directory-random-id[0].result}-${count.index}"
name = "win-${random_string.active-directory-random-string[0].result}-${count.index}"
admin_username = var.active-directory-username
admin_password = var.active-directory-password
location = azurerm_resource_group.active-directory-resource-group.location
Expand All @@ -75,7 +79,7 @@ resource "azurerm_windows_virtual_machine" "active-directory-instance" {
}

os_disk {
name = "os-disk-${random_id.active-directory-random-id[0].result}-${count.index}"
name = "os-disk-${random_string.active-directory-random-string[0].result}-${count.index}"
caching = "ReadWrite"
storage_account_type = "Premium_LRS"
}
Expand All @@ -87,14 +91,9 @@ resource "azurerm_windows_virtual_machine" "active-directory-instance" {
}
}

# Active Directory Instances bootstrapping file
# data "template_file" "bootstrap-instance-group-azure-instances" {
# template = templatefile("${path.module}/files/bootstrap-instance-group-azure-instances.sh", { nms-hostname = var.nms-hostname })
# }

## Availability Set
resource "azurerm_availability_set" "active-directory-instance" {
name = "a-set-${random_id.active-directory-random-id[0].result}-${count.index}"
name = "a-set-${random_string.active-directory-random-string[0].result}-${count.index}"
location = var.location
resource_group_name = azurerm_resource_group.active-directory-resource-group.name

Expand Down

0 comments on commit f6c9394

Please sign in to comment.