code: func legacyFlatmapKeyForTraversal(traversal hcl.Traversal) string {
  	var buf bytes.Buffer
  	first := true
  	for _, step := range traversal {
  		if !first {
  			buf.WriteByte('.')
  		}
  		switch ts := step.(type) {
  		case hcl.TraverseRoot:
  			buf.WriteString(ts.Name)
  		case hcl.TraverseAttr:
  			buf.WriteString(ts.Name)
  		case hcl.TraverseIndex:
  			val := ts.Key
  			switch val.Type() {
  			case cty.Number:
  				bf := val.AsBigFloat()
  				buf.WriteString(bf.String())
  			case cty.String:
  				s := val.AsString()
  				buf.WriteString(s)
  			default:
  				// should never happen, since no other types appear in
  				// traversals in practice.
  				buf.WriteByte('?')
  			}
  		default:
  			// should never happen, since we've covered all of the types
  			// that show up in parsed traversals in practice.
  			buf.WriteByte('?')
  		}
  		first = false
  	}
  	return buf.String()
  }
docs: // legacyFlagmapKeyForTraversal constructs a key string compatible with what
  // the flatmap package would generate for an attribute addressable by the given
  // traversal.
  //
  // This is used only to shim references to attributes within the diff and
  // state structures, which have not (at the time of writing) yet been updated
  // to use the newer HCL-based representations.