Did the officer ask you, or instruct you to sign the document? Such a situation lends itself to feel coercive, as the officer has already detained you for a search.
If anyone except a police officer made a similar request, they'd be guilty of brandishing a firearm and any contract (or agreement to have sex) would be invalid. But if you accede to a police officer's "request", when they have a legal right to kill you for any reason during the encounter, it's considered consent.
Is it though? I would say that the reason is that it is reported because the police are not expected to shoot you. As for legally being allowed to shoot you, there have been a lot of cases in the recent decades proving that point. For example https://en.wikipedia.org/wiki/Ruby_Ridge and https://en.wikipedia.org/wiki/2017_Wichita_swatting
Let's not forget it.