Azure / Azure/Azure-Landing-Zones

azurerm_vpn_gateway_connection error with `invalid for_each argument - local.vpn_site_connections has a sensitive value` with Terraform version 1.10.1

Open
#360 11 comments 3 reactions 1 assignee Claimed by @jaredfholgate View on GitHub
Transfer From: TF avm-ptn-con-vwan :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.5.1

### (Optional) Correlation Id

_No response_

### Description

When running `terraform plan` with Terraform `v1.10.1`, following error is produced which I suspect may be due to `var.vpn_site_connections` containing a sensitive value of `shared_key`, but this value is not being used for resource instance key, so there's no risk of exposure.

When I downgrade to `terraform v1.9.8`, this issue does not persist. As of now, it doesn't appear that this AVM VirtualWAN module is compatible with `terraform v1.10.x`

```hcl

│ Error: Invalid for_each argument

│ on modules/avm-ptn-virtualwan/s2s-vpn-gateway.tf line 85, in resource "azurerm_vpn_gateway_connection" "vpn_site_connection":
│ 85: for_each = local.vpn_site_connections != null && length(local.vpn_site_connections) > 0 ? local.vpn_site_connections : {}
│ ├────────────────
│ │ local.vpn_site_connections 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.

Operation failed: failed running terraform plan (exit 1)

Post-plan Tasks:
```

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.