@@ -86,34 +86,34 @@ resource "azurerm_subnet" "this_subnet_2" {
8686 virtual_network_name = azurerm_virtual_network.this_vnet.name
8787}
8888
89- /* Uncomment this section if you would like to include a bastion resource with this example.
89+ # Uncomment this section if you would like to include a bastion resource with this example.
9090resource "azurerm_subnet" "bastion_subnet" {
91+ address_prefixes = ["10.0.3.0/24"]
9192 name = "AzureBastionSubnet"
9293 resource_group_name = azurerm_resource_group.this_rg.name
9394 virtual_network_name = azurerm_virtual_network.this_vnet.name
94- address_prefixes = ["10.0.3.0/24"]
9595}
9696
9797resource "azurerm_public_ip" "bastionpip" {
98- name = module.naming.public_ip.name_unique
98+ allocation_method = "Static"
9999 location = azurerm_resource_group.this_rg.location
100+ name = module.naming.public_ip.name_unique
100101 resource_group_name = azurerm_resource_group.this_rg.name
101- allocation_method = "Static"
102102 sku = "Standard"
103103}
104104
105105resource "azurerm_bastion_host" "bastion" {
106- name = module.naming.bastion_host.name_unique
107106 location = azurerm_resource_group.this_rg.location
107+ name = module.naming.bastion_host.name_unique
108108 resource_group_name = azurerm_resource_group.this_rg.name
109109
110110 ip_configuration {
111111 name = "${module.naming.bastion_host.name_unique}-ipconf"
112- subnet_id = azurerm_subnet.bastion_subnet.id
113112 public_ip_address_id = azurerm_public_ip.bastionpip.id
113+ subnet_id = azurerm_subnet.bastion_subnet.id
114114 }
115115}
116- */
116+
117117
118118
119119data "azurerm_client_config" "current" {}
@@ -197,11 +197,26 @@ resource "azurerm_key_vault_secret" "admin_ssh_key" {
197197 ]
198198}
199199
200+ resource "tls_private_key" "this_2" {
201+ algorithm = "RSA"
202+ rsa_bits = 4096
203+ }
204+
205+ resource "azurerm_key_vault_secret" "admin_ssh_key_2" {
206+ key_vault_id = module.avm_res_keyvault_vault.resource_id
207+ name = "azureuser-ssh-private-key-2"
208+ value = tls_private_key.this_2.private_key_pem
209+
210+ depends_on = [
211+ module.avm_res_keyvault_vault
212+ ]
213+ }
214+
200215resource "azurerm_disk_encryption_set" "this" {
201- key_vault_key_id = module.avm_res_keyvault_vault.keys_resource_ids.des_key.id
202216 location = azurerm_resource_group.this_rg.location
203217 name = module.naming.disk_encryption_set.name_unique
204218 resource_group_name = azurerm_resource_group.this_rg.name
219+ key_vault_key_id = module.avm_res_keyvault_vault.keys_resource_ids.des_key.id
205220 tags = local.tags
206221
207222 identity {
@@ -230,6 +245,10 @@ module "testvm" {
230245 {
231246 public_key = tls_private_key.this.public_key_openssh
232247 username = "azureuser" #the username must match the admin_username currently.
248+ },
249+ {
250+ public_key = tls_private_key.this_2.public_key_openssh
251+ username = "azureuser" #the username must match the admin_username currently.
233252 }
234253 ]
235254
@@ -339,17 +358,22 @@ The following requirements are needed by this module:
339358
340359The following resources are used by this module:
341360
361+ - [ azurerm_bastion_host.bastion] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/bastion_host ) (resource)
342362- [ azurerm_disk_encryption_set.this] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/disk_encryption_set ) (resource)
343363- [ azurerm_key_vault_secret.admin_ssh_key] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret ) (resource)
364+ - [ azurerm_key_vault_secret.admin_ssh_key_2] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret ) (resource)
365+ - [ azurerm_public_ip.bastionpip] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/public_ip ) (resource)
344366- [ azurerm_resource_group.this_rg] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group ) (resource)
345367- [ azurerm_resource_group.this_rg_secondary] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/resource_group ) (resource)
368+ - [ azurerm_subnet.bastion_subnet] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/subnet ) (resource)
346369- [ azurerm_subnet.this_subnet_1] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/subnet ) (resource)
347370- [ azurerm_subnet.this_subnet_2] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/subnet ) (resource)
348371- [ azurerm_user_assigned_identity.example_identity] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/user_assigned_identity ) (resource)
349372- [ azurerm_virtual_network.this_vnet] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_network ) (resource)
350373- [ random_integer.region_index] ( https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/integer ) (resource)
351374- [ random_integer.zone_index] ( https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/integer ) (resource)
352375- [ tls_private_key.this] ( https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key ) (resource)
376+ - [ tls_private_key.this_2] ( https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key ) (resource)
353377- [ azurerm_client_config.current] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/client_config ) (data source)
354378
355379<!-- markdownlint-disable MD013 -->
0 commit comments