Add "sync" function for edge dictionary items
As a fastly configuration maintainer
When I change my local version of an edge dictionary
I want to easily synchronize adds, updates, and deletes with fastly
So that I don't leave cruft behind by forgetting to delete values
Notes: This is a larger enhancement but I'm hoping it's valuable to other users. We have a git repo where we maintain batch files for a few edge dictionaries and use the fastly CLI to push those batches up to our service. It would be great if my local copy of the dictionary, stored in json, could be synchronized with the remote copy via the CLI instead of manually maintaining batch files that have an expectation of the remote values.
@benzvan in your current workflow, is this the command you are using?
fastly dictionaryitem batchmodify --dictionary-id $dictionary_id --file dictionary_items.json
Yep. That's the one. We're using op: upsert for basically all the items.
I'm coming back to this today because we have an effort on our team to simplify the way we maintain our edge dictionaries. I'd love to see something like
fastly dictionary set --dictionary-id $dictionary_id --file dictionary_items.json
Where dictionary_items.json ==
{
"dictionary_key1": "value1",
"dictionary_key2": "value2",
"dictionary_key3": "value3",
"dictionary_key4": "value4"
}
and the result is the $dictionary_id matches the key/value pairs in the file when completed. If this was a built-in fastly API function, it would also simplify some of the terraform we use to copy k/v pairs into a dictionary.