I’m not sure exactly how your question relates to the error message in the summary because the summary message is referring to
cidr_blocks but your question is referring to
security_groups. If you could share a little more detail about what you are doing (ideally, a full configuration, exactly what Terraform commands you ran, and what output you saw) then we might be able to help further.
With that said, the “element 0: string required” error message usually occurs when you have created a list of lists in a situation where a provider is expecting a list of strings. For example, if you were to write something like this:
cidr_blocks = [var.cidr_blocks]
var.cidr_blocks were a list itself, e.g.
["192.168.0.0/16"], then this would evaluate like
[["192.168.0.0/16"]], which would cause the error you saw because element zero of the outer list is itself a list, not a string.
Instead, that should be written like this:
cidr_blocks = var.cidr_blocks
If you need to combine multiple lists together to produce a value, you can use the