You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can't access attributes on a list of objects. Did you mean to access an attribute for a specific element of the list, or across all elements of the list?
#3
Closed
1 task done
sammyxd2305 opened this issue
Jun 23, 2023
· 0 comments
volume=[{
name ="test",
storage_name ="test"
storage_type ="AzureFile"
}]
Debug Output/Panic Output
│ Error: Unsupported attribute
│
│ on ..\_modules\environment_v1\_modules\container-apps\main.tf line 121, in resource "azurerm_container_app""container_app":
│ 121: name = volume.value[each.value.template.volume.key].name
│ ├────────────────
│ │ each.value.template.volume is list of object with 1 element
│
│ Can't access attributes on a list of objects. Did you mean to access an attribute for a specific element of the list, or across all elements of the list?╵╷│ Error: Unsupported attribute││ on ..\_modules\environment_v1\_modules\container-apps\main.tf line 122, in resource "azurerm_container_app" "container_app":│ 122: storage_name = volume.value[each.value.template.volume.key].storage_name│ ├────────────────│ │ each.value.template.volume is list of object with 1 element││ Can't access attributes on a list of objects. Did you mean to access an attribute for a specific element of the list, or across all elements of the list?
╵
╷
│ Error: Unsupported attribute
│
│ on ..\_modules\environment_v1\_modules\container-apps\main.tf line 123, in resource "azurerm_container_app""container_app":
│ 123: storage_type = volume.value[each.value.template.volume.key].storage_type
│ ├────────────────
│ │ each.value.template.volume is list of object with 1 element
│
│ Can't access attributes on a list of objects. Did you mean to access an attribute for a specific element of the list, or across all elements of the list?
Expected Behaviour
add volume to container
Actual Behaviour
error
Steps to Reproduce
terraform apply
Important Factoids
No response
References
Solution to the Problem for me:
dynamic "volume" {
for_each = each.value.template.volume == null ? [] : [each.value.template.volume]
Is there an existing issue for this?
Greenfield/Brownfield provisioning
greenfield
Terraform Version
3.51.0
Module Version
newest
AzureRM Provider Version
newest
Affected Resource(s)/Data Source(s)
azurerm_container_app
Terraform Configuration Files
tfvars variables values
Debug Output/Panic Output
Expected Behaviour
add volume to container
Actual Behaviour
error
Steps to Reproduce
terraform apply
Important Factoids
No response
References
Solution to the Problem for me:
dynamic "volume" {
for_each = each.value.template.volume == null ? [] : [each.value.template.volume]
(Added volume.key)
The text was updated successfully, but these errors were encountered: