Azure / Azure/Azure-Landing-Zones

shared_key usage throws errors

Open
#337 4 comments 1 reaction 1 assignee Assigned to @Copilot View on GitHub
Transfer From: TF avm-ptn-con-hs :arrow_right:
Dominant language
PowerShell
Stars
96
Forks
70
Avg merge
3d 1h
Merged PRs (30d)
7

Description

### Check for previous/existing GitHub issues

- [x] I have checked for previous/existing GitHub issues

### Issue Type?

Bug

### (Optional) Module Version

v0.16.2

### (Optional) Correlation Id

_No response_

### Description

I have adapted the full-multi-region example to my environment.

When setting the shared_key for express route connections, as in the following:

```hcl
virtual_network_gateways = {
express_route = {
name = module.primary.names.virtual_network_gateway
express_route_circuits = {
primary = {
id = data.azurerm_express_route_circuit.primary_express_route_circuit.id
connection = {
name = module.primary.names.virtual_network_express_route_circuit_connection
resource_group_name = module.primary.names.resource_groups.express_route_circuit
tags = local.tags
shared_key = random_password.vng_connection_secret_primary.result
}
peering = {
peering_type = "AzurePrivatePeering"
vlan_id = 1002
ipv4_enabled = true
peer_asn = 65010
primary_peer_address_prefix = "169.254.21.0/30"
secondary_peer_address_prefix = "169.254.22.0/30"
resource_group_name = module.primary.names.resource_groups.express_route_circuit
shared_key = random_password.vng_connection_secret_primary.result
}
}
}
}
```

I get the following errors when running `terraform plan`:

```powershell

│ Error: Invalid for_each argument

│ on .terraform\modules\full_multi_region.hub_and_spoke\main.ip_ranges.tf line 26, in module "virtual_network_ip_prefixes":
│ 26: for_each = local.virtual_network_default_ip_prefix_input
│ ├────────────────
│ │ local.virtual_network_default_ip_prefix_input has a sensitive value

│ Sensitive values, or values derived from sensitive values, cannot be used as for_each arguments. If used, the sensitive value could be exposed as a resource instance key.


│ Error: Invalid for_each argument

│ on .terraform\modules\full_multi_region.hub_and_spoke\main.tf line 56, in module "gateway_route_table":
│ 56: for_each = local.gateway_route_table
│ ├────────────────
│ │ local.gateway_route_table has a sensitive value

│ Sensitive values, or values derived from sensitive values, cannot be used as for_each arguments. If used, the sensitive value could be exposed as a resource instance key.


│ Error: Invalid for_each argument

│ on .terraform\modules\full_multi_region.hub_and_spoke\main.tf line 131, in module "bastion_public_ip":
│ 131: for_each = local.bastion_host_public_ips
│ ├────────────────
│ │ local.bastion_host_public_ips has a sensitive value

│ Sensitive values, or values derived from sensitive values, cannot be used as for_each arguments. If used, the sensitive value could be exposed as a resource instance key.

```

When I comment out the shared_key values, or set them to null, the errors disappear.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.