Confused a bit on using the .ElementsAs() and .Elements() for type.List. When I attempt to use .ElementsAs() in the following, I do not get my values set to the []string as I hope.
var resource_types []string
diags = plan.ResourceTypes.ElementsAs(ctx, resource_types, false)
if diags.HasError() {
return
}
But when I do this, it works:
var resource_types []string
list := plan.ResourceTypes.Elements()
if len(list) != 0 {
for _, item := range list {
resource_types = append(resource_types, item.String())
}
}
Is this expected behavior or am I missing something about the usage of .ElementsAs()? Seems like a lot of work to get just a list of strings from a types.List so I feel like I must be doing something wrong.