terraform: Fixing panics and TODOs