I am attempting to test the input mapping fields for azurerm_eventgrid_topic
run “full” {
command = plan
variables {
name = “custom-eventgrid”
resource_group_name = run.setup_rg.resource_group_name
input_schema = “CustomEventSchema”
input_mapping_fields = { id : “guid”
topic : “channel”
event_type : “datatype”
event_time : “dateTime”
data_version : “version”
subject : “event” }
input_mapping_default_values = { event_type : “event”,
subject : “CustomEvent”,
data_version : “1.0” }
}
assert {
condition = azurerm_eventgrid_topic.topic.input_mapping_fields == var.input_mapping_fields
error_message = “”
}
assert {
condition = azurerm_eventgrid_topic.topic.input_mapping_default_values == var.input_mapping_default_values
error_message = “”
}
here is the results:
Error: Test assertion failed
│
│ on tests/passthrough.tftest.hcl line 70, in run “full”:
│ 70: condition = azurerm_eventgrid_topic.topic.input_mapping_fields == tomap(var.input_mapping_fields)
│ ├────────────────
│ │ azurerm_eventgrid_topic.topic.input_mapping_fields is list of object with 1 element
│ │ var.input_mapping_fields is map of string with 6 elements
│
╵
╷
│ Error: Test assertion failed
│
│ on tests/passthrough.tftest.hcl line 75, in run “full”:
│ 75: condition = azurerm_eventgrid_topic.topic.input_mapping_default_values == var.input_mapping_default_values
│ ├────────────────
│ │ azurerm_eventgrid_topic.topic.input_mapping_default_values is list of object with 1 element
│ │ var.input_mapping_default_values is map of string with 3 elements
my question is what type is the input_mapping_fields, and why does it think my input is an object, with 1 element?