│ Error: Attempt to get attribute from null value
│
│ on .terraform/modules/volume.netapp_volumes/main.tf line 57, in resource "google_netapp_volume" "storage_volumes":
│ 57: for_each = each.value.snapshot_policy.enabled ? ["volume_snapshot_policy"] : []
│ ├────────────────
│ │ each.value.snapshot_policy is null
│
│ This value is null, so it does not have any attributes.
╵
Hello,
This module defaults an empty
snapshot_policy
to null.From variables.tf:
However, there is check on fields of the
snapshot_policy
, resulting in errors ifsnapshot_policy
input isn't passed to the module.In main.tf:
When the module tries to access
each.value.snapshot_policy.<field>
, it fails ifsnapshot_policy
isn't passed as input to the module: