Skip to content

Commit 74b2d12

Browse files
committed
updating outputs
1 parent 273fabb commit 74b2d12

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ resource "azurerm_public_ip" "pip" {
7272
lifecycle {
7373
ignore_changes = [
7474
tags,
75+
ip_tags,
7576
]
7677
}
7778
}
@@ -374,7 +375,7 @@ resource "azurerm_windows_virtual_machine_scale_set" "winsrv_vmss" {
374375
sku = var.virtual_machine_size
375376
instances = var.instances_count
376377
admin_username = var.admin_username
377-
admin_password = var.admin_password == null ? random_password.passwd[count.index].result : var.admin_password
378+
admin_password = var.admin_password == null ? element(concat(random_password.passwd.*.result, [""]), 0) : var.admin_password
378379
custom_data = var.custom_data
379380
overprovision = var.overprovision
380381
do_not_run_extensions_on_overprovisioned_machines = var.do_not_run_extensions_on_overprovisioned_machines

output.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
output "admin_ssh_key_public" {
22
description = "The generated public key data in PEM format"
3-
value = var.generate_admin_ssh_key == true && var.os_flavor == "linux" ? tls_private_key.rsa[0].public_key_openssh : null
3+
value = var.disable_password_authentication == true && var.generate_admin_ssh_key == true && var.os_flavor == "linux" ? tls_private_key.rsa[0].public_key_openssh : null
44
}
55

66
output "admin_ssh_key_private" {
77
description = "The generated private key data in PEM format"
88
sensitive = true
9-
value = var.generate_admin_ssh_key == true && var.os_flavor == "linux" ? tls_private_key.rsa[0].private_key_pem : null
9+
value = var.disable_password_authentication == true && var.generate_admin_ssh_key == true && var.os_flavor == "linux" ? tls_private_key.rsa[0].private_key_pem : null
1010
}
1111

1212
output "windows_vm_password" {
1313
description = "Password for the windows VM"
1414
sensitive = true
15-
value = var.os_flavor == "windows" ? element(concat(random_password.passwd.*.result, [""]), 0) : null
15+
value = var.admin_password == null ? element(concat(random_password.passwd.*.result, [""]), 0) : var.admin_password
1616
}
1717

1818
output "linux_vm_password" {
1919
description = "Password for the Linux VM"
2020
sensitive = true
21-
value = var.os_flavor == "linux" && var.disable_password_authentication != true ? element(concat(random_password.passwd.*.result, [""]), 0) : null
21+
value = var.disable_password_authentication == false && var.admin_password == null ? element(concat(random_password.passwd.*.result, [""]), 0) : var.admin_password
2222
}
2323

2424
output "load_balancer_public_ip" {

0 commit comments

Comments
 (0)