Question: nested attribute lists result in "tolist([" json/output... why?

i’m using the terraform framework sdk for my provider.

    github.com/hashicorp/terraform-plugin-docs v0.8.0
    github.com/hashicorp/terraform-plugin-framework v0.7.0
    github.com/hashicorp/terraform-plugin-go v0.9.0
    github.com/hashicorp/terraform-plugin-log v0.4.0
    github.com/hashicorp/terraform-plugin-sdk/v2 v2.15.0

my schema uses ListNestedAttributes for a data source and when applying / refreshing the state, i can see the below output (note the tolist([ parts…) I guess I might be missing something in the declaration of my go type structs…

Output:

bla = {
  "id" = "0662d84c-dbf3-4883-9531-53c98d89bc73"
  "nodes" = tolist([
    {
      "id" = "034edb82-ab9f-4be0-8619-9260eb75f7e9"
      "interfaces" = tolist([
        {    },

I basically have something like

type resultNode struct {
	Id         types.String      `tfsdk:"id"`
	Interfaces []resultInterface `tfsdk:"interfaces"`
}

type cmlDataSourceData struct {
	Id         types.String `tfsdk:"id"`
	Nodes      []resultNode `tfsdk:"nodes"`
}

it basically works – but i am wondering if this tolist() is something that i can avoid… in addition, when looking at the output, i do see “sensitive data” that is reported for those lists which i completely do not understand… is this related? what does it tell me?

          "sensitive_values": {
            "nodes": [
              {
                "interfaces": [
                  {
                    "ip4": [
                      false
                    ],
                    "ip6": [
                      false
                    ]
                  }
                ]
              },
              {
                "interfaces": [
                  {

why would it mark those as “sensitive” and also why does it show some of them as “false”? it seems like this is related in a way.

thanks for any insight…

I did some additional verification with the official GitHub provider and it seems like I’m getting the same behavior (tolist() and sensitive_values). So is it safe to assume that this is just normal?

for reference, code lives here: GitHub

Hi @rschmied :wave: In Terraform’s configuration language, square brackets typically represent a tuple type to start. Sometimes when it can determine it is a list type (an ordered array with a single element type), it will show the wrapping tolist() syntax in the plan output. If you have questions about this particular feature of the plan output, it might be best to raise them over in the Terraform CLI section, Terraform - HashiCorp Discuss, as providers do not influence this particular output design.