Managing the diff of an array


I would like to not the change the infrastructure when an array is changed from one order to another one. For example:

templates = ["Value1", "Value2"]

is equal to:

templates = ["Value2", "Value1"]

To do that I need to implement a CustomizeDiff function ?


Hi @smutel
could you tell us a bit more about the use case and/or what’s the type of the field in question?

Generally speaking this sounds like a good use case for TypeSet (where ordering doesn’t matter), while you seem to be using TypeList (where ordering matters).

Yeah, I am using TypeList …

"templates": {                                                            
        Type: schema.TypeList,                                                  
        Elem: &schema.Schema{                                                  
          Type: schema.TypeString,                                              
        Optional: true,                                                        

But the order does not mater for my needs. So I need to convert this into TypeSet …

Le lun. 21 oct. 2019 à 15:23, Radek Simko via HashiCorp Discuss a écrit :