-
Notifications
You must be signed in to change notification settings - Fork 50
Expand file tree
/
Copy pathmain.runcommand.tf
More file actions
101 lines (93 loc) · 5.18 KB
/
main.runcommand.tf
File metadata and controls
101 lines (93 loc) · 5.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
module "run_command" {
source = "./modules/run-command"
for_each = { for k, v in var.run_commands : k => v if v.deploy_sequence >= 3 }
location = each.value.location
name = each.value.name
script_source = each.value.script_source
virtualmachine_resource_id = local.virtualmachine_resource_id
error_blob_managed_identity = each.value.error_blob_managed_identity
error_blob_uri = each.value.error_blob_uri
output_blob_managed_identity = each.value.output_blob_managed_identity
output_blob_uri = each.value.output_blob_uri
parameters = each.value.parameters
protected_parameters = try(var.run_commands_secrets[each.key].protected_parameters, null)
run_as_password = try(var.run_commands_secrets[each.key].run_as_password, null)
run_as_user = try(var.run_commands_secrets[each.key].run_as_user, null)
tags = each.value.tags
timeouts = {
create = coalesce(try(each.value.timeouts.create, null), var.timeouts.azurerm_virtual_machine_run_command.create)
delete = coalesce(try(each.value.timeouts.delete, null), var.timeouts.azurerm_virtual_machine_run_command.delete)
read = coalesce(try(each.value.timeouts.read, null), var.timeouts.azurerm_virtual_machine_run_command.read)
update = coalesce(try(each.value.timeouts.update, null), var.timeouts.azurerm_virtual_machine_run_command.update)
}
depends_on = [
azurerm_windows_virtual_machine.this,
azurerm_linux_virtual_machine.this,
azurerm_role_assignment.this_virtual_machine,
azurerm_role_assignment.system_managed_identity,
module.run_command_1,
module.run_command_2,
module.extension
]
}
module "run_command_1" {
source = "./modules/run-command"
for_each = { for k, v in var.run_commands : k => v if v.deploy_sequence == 1 }
location = each.value.location
name = each.value.name
script_source = each.value.script_source
virtualmachine_resource_id = local.virtualmachine_resource_id
error_blob_managed_identity = each.value.error_blob_managed_identity
error_blob_uri = each.value.error_blob_uri
output_blob_managed_identity = each.value.output_blob_managed_identity
output_blob_uri = each.value.output_blob_uri
parameters = each.value.parameters
protected_parameters = try(var.run_commands_secrets[each.key].protected_parameters, null)
run_as_password = try(var.run_commands_secrets[each.key].run_as_password, null)
run_as_user = try(var.run_commands_secrets[each.key].run_as_user, null)
tags = each.value.tags
timeouts = {
create = coalesce(try(each.value.timeouts.create, null), var.timeouts.azurerm_virtual_machine_run_command.create)
delete = coalesce(try(each.value.timeouts.delete, null), var.timeouts.azurerm_virtual_machine_run_command.delete)
read = coalesce(try(each.value.timeouts.read, null), var.timeouts.azurerm_virtual_machine_run_command.read)
update = coalesce(try(each.value.timeouts.update, null), var.timeouts.azurerm_virtual_machine_run_command.update)
}
depends_on = [
azurerm_windows_virtual_machine.this,
azurerm_linux_virtual_machine.this,
azurerm_role_assignment.this_virtual_machine,
azurerm_role_assignment.system_managed_identity,
module.extension
]
}
module "run_command_2" {
source = "./modules/run-command"
for_each = { for k, v in var.run_commands : k => v if v.deploy_sequence == 2 }
location = each.value.location
name = each.value.name
script_source = each.value.script_source
virtualmachine_resource_id = local.virtualmachine_resource_id
error_blob_managed_identity = each.value.error_blob_managed_identity
error_blob_uri = each.value.error_blob_uri
output_blob_managed_identity = each.value.output_blob_managed_identity
output_blob_uri = each.value.output_blob_uri
parameters = each.value.parameters
protected_parameters = try(var.run_commands_secrets[each.key].protected_parameters, null)
run_as_password = try(var.run_commands_secrets[each.key].run_as_password, null)
run_as_user = try(var.run_commands_secrets[each.key].run_as_user, null)
tags = each.value.tags
timeouts = {
create = coalesce(try(each.value.timeouts.create, null), var.timeouts.azurerm_virtual_machine_run_command.create)
delete = coalesce(try(each.value.timeouts.delete, null), var.timeouts.azurerm_virtual_machine_run_command.delete)
read = coalesce(try(each.value.timeouts.read, null), var.timeouts.azurerm_virtual_machine_run_command.read)
update = coalesce(try(each.value.timeouts.update, null), var.timeouts.azurerm_virtual_machine_run_command.update)
}
depends_on = [
azurerm_windows_virtual_machine.this,
azurerm_linux_virtual_machine.this,
azurerm_role_assignment.this_virtual_machine,
azurerm_role_assignment.system_managed_identity,
module.run_command_1,
module.extension
]
}