Hope I am not spamming this channel too much 😉 If so let me know This is my work in progress how I enable google cloud services using babashka instead of terraform
(->>
(->
(gc :get (purl :use pid "services")
{:query-params {"fields" "services/name,nextPageToken"
"filter" "state:ENABLED"}})
(get :services []))
(map :name)
(map #(last (s/split % #"/" )))
set
(clojure.set/difference
#{""
""
""
""
""
""
""})
vec
(#(when-not (empty? %)
(gc :post (purl :use pid "services:batchEnable") {:body {:service-ids %}})))
(wait-for-operation :use))
and this is how it was in terraform
resource "google_project_service" "service" {
for_each = toset([
"",
"",
"",
"",
"",
""
])
service = each.key
project = google_project.project.project_id
disable_on_destroy = false
}
How I do it in babashka/clojure is imperative but written in an idempotent way but I think that a next step could be to have the resources be declared using clojure maps and lists and have it automatically resolve the dependencies and create or update the resources@mruzekw has joined the channel