code: func (s *Store) ensureConfigEntryTxn(tx *memdb.Txn, idx uint64, conf structs.ConfigEntry) error {
  	// Check for existing configuration.
  	existing, err := tx.First(configTableName, "id", conf.GetKind(), conf.GetName())
  	if err != nil {
  		return fmt.Errorf("failed configuration lookup: %s", err)
  	}
  
  	raftIndex := conf.GetRaftIndex()
  	if existing != nil {
  		existingIdx := existing.(structs.ConfigEntry).GetRaftIndex()
  		raftIndex.CreateIndex = existingIdx.CreateIndex
  		raftIndex.ModifyIndex = existingIdx.ModifyIndex
  	} else {
  		raftIndex.CreateIndex = idx
  	}
  	raftIndex.ModifyIndex = idx
  
  	// Insert the config entry and update the index
  	if err := tx.Insert(configTableName, conf); err != nil {
  		return fmt.Errorf("failed inserting config entry: %s", err)
  	}
  	if err := indexUpdateMaxTxn(tx, idx, configTableName); err != nil {
  		return fmt.Errorf("failed updating index: %v", err)
  	}
  
  	return nil
  }
docs: // ensureConfigEntryTxn upserts a config entry inside of a transaction.