I believe that you can achieve what you want by setting the counter (here: variable g:I) to 1:
let g:I=1
And then do the substitution on each line that matches ^- id: \d\+$:
%g/^- id: \d\+$/ s/\d\+/\=g:I/|let g:I=g:I+1
Substitution uses \=thingy (see :help sub-replace-expression) to substitute \d\+with the actual value g:I. After substitution, the counter is incremented ( let g:I=g:I+1).
g/^- id: \d\+$/ , , ^- id: \d\+.
. , .vimrc:
nnoremap resync :let g:I=1<CR>:%g/^- id: \d\+$/ s/\d\+/\=g:I/\|let g:I=g:I+1<CR>
, resync .
| \ <CR>, enter.