Skip to content

Commit 39dfaed

Browse files
External module bug fixes (#186)
* run command type fixes * app gw waf fix * vmss example waf fix * vmss exception
1 parent 244c42e commit 39dfaed

40 files changed

Lines changed: 1245 additions & 1744 deletions

File tree

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1388,8 +1388,9 @@ The following arguments are supported:
13881388
- `object_id` (Optional): The object ID of the managed identity.
13891389

13901390
A parameter block supports the following arguments:
1391-
- `name` (Required): The run parameter name.
1392-
- `value` (Required): The run parameter value.
1391+
- `map_key` (Required): A unique key for the parameter within the `run_commands` map.
1392+
- `name` (Required): The run parameter name. This should be unique for each parameter.
1393+
- `value` (Required): The run parameter value.
13931394

13941395
A script\_uri\_managed\_identity block supports the following arguments:
13951396
- `client_id` (Optional): The client ID of the managed identity.
@@ -1427,10 +1428,10 @@ map(object({
14271428
object_id = optional(string)
14281429
}))
14291430
output_blob_uri = optional(string)
1430-
parameters = optional(list(object({
1431+
parameters = optional(map(object({
14311432
name = string
14321433
value = string
1433-
})), [])
1434+
})), {})
14341435
14351436
timeouts = optional(object({
14361437
create = optional(string)
@@ -1451,22 +1452,22 @@ Default: `{}`
14511452
Description: The `run_commands_secrets` variable defines the configuration for Virtual Machine Run Command Sensitive values. This requires that the `run_commands_secrets` map key match the `run_commands` map key.
14521453
The following arguments are supported:
14531454

1454-
- `protected_parameters` (Optional): A list of protected\_parameter blocks as defined below. The protected parameters used by the script.
1455-
- `run_as_password` (Optional): Specifies the user account password on the VM when executing the Virtual Machine Run Command.
1456-
- `run_as_user` (Optional): Specifies the user account on the VM when executing the Virtual Machine Run Command.
1455+
- `protected_parameters` (Optional): A map of protected\_parameter blocks as defined below. The protected parameters used by the script.
1456+
- `map_key` (Required): A unique key for the parameter within the `run_commands` map.
1457+
- `name` (Required): The run parameter name. This should be unique for each protected parameter.
1458+
- `value` (Required): The run parameter value.
14571459

1458-
A protected\_parameter block supports the following arguments:
1459-
- `name` (Required): The run parameter name.
1460-
- `value` (Required): The run parameter value.
1460+
- `run_as_password` (Optional): Specifies the user account password on the VM when executing the Virtual Machine Run Command.
1461+
- `run_as_user` (Optional): Specifies the user account on the VM when executing the Virtual Machine Run Command.
14611462

14621463
Type:
14631464

14641465
```hcl
14651466
map(object({
1466-
protected_parameters = optional(list(object({
1467+
protected_parameters = optional(map(object({
14671468
name = string
14681469
value = string
1469-
})), [])
1470+
})), {})
14701471
run_as_password = optional(string)
14711472
run_as_user = optional(string)
14721473
}))

examples/linux_default/README.md

Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ module "vm_sku" {
8484
8585
location = azurerm_resource_group.this_rg.location
8686
cache_results = true
87-
8887
vm_filters = {
8988
min_vcpus = 2
9089
max_vcpus = 2
@@ -101,11 +100,10 @@ module "natgateway" {
101100
source = "Azure/avm-res-network-natgateway/azurerm"
102101
version = "0.2.1"
103102
104-
name = module.naming.nat_gateway.name_unique
105-
enable_telemetry = true
106103
location = azurerm_resource_group.this_rg.location
104+
name = module.naming.nat_gateway.name_unique
107105
resource_group_name = azurerm_resource_group.this_rg.name
108-
106+
enable_telemetry = true
109107
public_ips = {
110108
public_ip_1 = {
111109
name = "nat_gw_pip1"
@@ -117,11 +115,10 @@ module "vnet" {
117115
source = "Azure/avm-res-network-virtualnetwork/azurerm"
118116
version = "=0.8.1"
119117
120-
resource_group_name = azurerm_resource_group.this_rg.name
121118
address_space = ["10.0.0.0/16"]
122-
name = module.naming.virtual_network.name_unique
123119
location = azurerm_resource_group.this_rg.location
124-
120+
resource_group_name = azurerm_resource_group.this_rg.name
121+
name = module.naming.virtual_network.name_unique
125122
subnets = {
126123
vm_subnet_1 = {
127124
name = "${module.naming.subnet.name_unique}-1"
@@ -169,68 +166,60 @@ resource "azurerm_bastion_host" "bastion" {
169166
data "azurerm_client_config" "current" {}
170167
171168
module "avm_res_keyvault_vault" {
172-
source = "Azure/avm-res-keyvault-vault/azurerm"
173-
version = "=0.10.0"
174-
tenant_id = data.azurerm_client_config.current.tenant_id
169+
source = "Azure/avm-res-keyvault-vault/azurerm"
170+
version = "=0.10.0"
171+
172+
location = azurerm_resource_group.this_rg.location
175173
name = "${module.naming.key_vault.name_unique}-linux-default"
176174
resource_group_name = azurerm_resource_group.this_rg.name
177-
location = azurerm_resource_group.this_rg.location
175+
tenant_id = data.azurerm_client_config.current.tenant_id
178176
network_acls = {
179177
default_action = "Allow"
180178
}
181-
182179
role_assignments = {
183180
deployment_user_secrets = {
184181
role_definition_id_or_name = "Key Vault Secrets Officer"
185182
principal_id = data.azurerm_client_config.current.object_id
186183
}
187184
}
188-
185+
tags = local.tags
189186
wait_for_rbac_before_secret_operations = {
190187
create = "60s"
191188
}
192-
193-
tags = local.tags
194189
}
195190
196191
module "testvm" {
197192
source = "../../"
198-
#source = "Azure/avm-res-compute-virtualmachine/azurerm"
199-
#version = "0.19.0"
200193
201-
enable_telemetry = var.enable_telemetry
202-
location = azurerm_resource_group.this_rg.location
194+
location = azurerm_resource_group.this_rg.location
195+
name = module.naming.virtual_machine.name_unique
196+
network_interfaces = {
197+
network_interface_1 = {
198+
name = module.naming.network_interface.name_unique
199+
ip_configurations = {
200+
ip_configuration_1 = {
201+
name = "${module.naming.network_interface.name_unique}-ipconfig1"
202+
private_ip_subnet_resource_id = module.vnet.subnets["vm_subnet_1"].resource_id
203+
}
204+
}
205+
}
206+
}
203207
resource_group_name = azurerm_resource_group.this_rg.name
204-
os_type = "Linux"
205-
name = module.naming.virtual_machine.name_unique
206-
sku_size = module.vm_sku.sku
207208
zone = random_integer.zone_index.result
208-
209209
account_credentials = {
210210
key_vault_configuration = {
211211
resource_id = module.avm_res_keyvault_vault.resource_id
212212
}
213213
}
214-
214+
enable_telemetry = var.enable_telemetry
215+
os_type = "Linux"
216+
sku_size = module.vm_sku.sku
215217
source_image_reference = {
216218
publisher = "Canonical"
217219
offer = "0001-com-ubuntu-server-focal"
218220
sku = "20_04-lts-gen2"
219221
version = "latest"
220222
}
221-
222-
network_interfaces = {
223-
network_interface_1 = {
224-
name = module.naming.network_interface.name_unique
225-
ip_configurations = {
226-
ip_configuration_1 = {
227-
name = "${module.naming.network_interface.name_unique}-ipconfig1"
228-
private_ip_subnet_resource_id = module.vnet.subnets["vm_subnet_1"].resource_id
229-
}
230-
}
231-
}
232-
}
233-
234223
tags = local.tags
235224
236225
depends_on = [

examples/linux_default/main.tf

Lines changed: 26 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ module "vm_sku" {
6666

6767
location = azurerm_resource_group.this_rg.location
6868
cache_results = true
69-
7069
vm_filters = {
7170
min_vcpus = 2
7271
max_vcpus = 2
@@ -83,11 +82,10 @@ module "natgateway" {
8382
source = "Azure/avm-res-network-natgateway/azurerm"
8483
version = "0.2.1"
8584

86-
name = module.naming.nat_gateway.name_unique
87-
enable_telemetry = true
8885
location = azurerm_resource_group.this_rg.location
86+
name = module.naming.nat_gateway.name_unique
8987
resource_group_name = azurerm_resource_group.this_rg.name
90-
88+
enable_telemetry = true
9189
public_ips = {
9290
public_ip_1 = {
9391
name = "nat_gw_pip1"
@@ -99,11 +97,10 @@ module "vnet" {
9997
source = "Azure/avm-res-network-virtualnetwork/azurerm"
10098
version = "=0.8.1"
10199

102-
resource_group_name = azurerm_resource_group.this_rg.name
103100
address_space = ["10.0.0.0/16"]
104-
name = module.naming.virtual_network.name_unique
105101
location = azurerm_resource_group.this_rg.location
106-
102+
resource_group_name = azurerm_resource_group.this_rg.name
103+
name = module.naming.virtual_network.name_unique
107104
subnets = {
108105
vm_subnet_1 = {
109106
name = "${module.naming.subnet.name_unique}-1"
@@ -151,68 +148,60 @@ resource "azurerm_bastion_host" "bastion" {
151148
data "azurerm_client_config" "current" {}
152149

153150
module "avm_res_keyvault_vault" {
154-
source = "Azure/avm-res-keyvault-vault/azurerm"
155-
version = "=0.10.0"
156-
tenant_id = data.azurerm_client_config.current.tenant_id
151+
source = "Azure/avm-res-keyvault-vault/azurerm"
152+
version = "=0.10.0"
153+
154+
location = azurerm_resource_group.this_rg.location
157155
name = "${module.naming.key_vault.name_unique}-linux-default"
158156
resource_group_name = azurerm_resource_group.this_rg.name
159-
location = azurerm_resource_group.this_rg.location
157+
tenant_id = data.azurerm_client_config.current.tenant_id
160158
network_acls = {
161159
default_action = "Allow"
162160
}
163-
164161
role_assignments = {
165162
deployment_user_secrets = {
166163
role_definition_id_or_name = "Key Vault Secrets Officer"
167164
principal_id = data.azurerm_client_config.current.object_id
168165
}
169166
}
170-
167+
tags = local.tags
171168
wait_for_rbac_before_secret_operations = {
172169
create = "60s"
173170
}
174-
175-
tags = local.tags
176171
}
177172

178173
module "testvm" {
179174
source = "../../"
180-
#source = "Azure/avm-res-compute-virtualmachine/azurerm"
181-
#version = "0.19.0"
182175

183-
enable_telemetry = var.enable_telemetry
184-
location = azurerm_resource_group.this_rg.location
176+
location = azurerm_resource_group.this_rg.location
177+
name = module.naming.virtual_machine.name_unique
178+
network_interfaces = {
179+
network_interface_1 = {
180+
name = module.naming.network_interface.name_unique
181+
ip_configurations = {
182+
ip_configuration_1 = {
183+
name = "${module.naming.network_interface.name_unique}-ipconfig1"
184+
private_ip_subnet_resource_id = module.vnet.subnets["vm_subnet_1"].resource_id
185+
}
186+
}
187+
}
188+
}
185189
resource_group_name = azurerm_resource_group.this_rg.name
186-
os_type = "Linux"
187-
name = module.naming.virtual_machine.name_unique
188-
sku_size = module.vm_sku.sku
189190
zone = random_integer.zone_index.result
190-
191191
account_credentials = {
192192
key_vault_configuration = {
193193
resource_id = module.avm_res_keyvault_vault.resource_id
194194
}
195195
}
196-
196+
enable_telemetry = var.enable_telemetry
197+
os_type = "Linux"
198+
sku_size = module.vm_sku.sku
197199
source_image_reference = {
198200
publisher = "Canonical"
199201
offer = "0001-com-ubuntu-server-focal"
200202
sku = "20_04-lts-gen2"
201203
version = "latest"
202204
}
203-
204-
network_interfaces = {
205-
network_interface_1 = {
206-
name = module.naming.network_interface.name_unique
207-
ip_configurations = {
208-
ip_configuration_1 = {
209-
name = "${module.naming.network_interface.name_unique}-ipconfig1"
210-
private_ip_subnet_resource_id = module.vnet.subnets["vm_subnet_1"].resource_id
211-
}
212-
}
213-
}
214-
}
215-
216205
tags = local.tags
217206

218207
depends_on = [

0 commit comments

Comments
 (0)