Understanding become: true and become_user: root not working in custom GCP connection setup

become_user: root is not working as expected.
Dear community,

In the background, We have established the connectivity to the GCP VMs using the Service account JSON with below command

# --- Connect using OS Login and static SSH key ---
exec gcloud compute ssh "$host" \
    "${opts[@]}" \
    --tunnel-through-iap \
    --ssh-key-file="$SSH_KEY_PATH" \
    --strict-host-key-checking=no \
    --quiet \
    --command="$cmd"

So when executing the normal tasks like gather_facts, ls command and copy to /tmp directory works fine.

But when want to create some directory in a path owned by root (/) , I get permission denied error.
Suppose below command

- name: Ensure target directory exists
  file:
    path: /opt/code/awx/
    state: directory
    mode: '0755'
    recurse: true
  become: true
  become_method: sudo
  become_user: root

gives this error

  "path": "/opt/code/awx/",
  "msg": "There was an issue creating /opt as requested: [Errno 13] Permission denied: b'/opt'",

The same works when I do something like this with sudo in shell module.

- name: Create target directory and set permissions
  ansible.builtin.shell: |
    sudo mkdir -p /opt/code/awx
    sudo chmod -R 777 /opt/code/awx
  become: true

I am not able to achieve this with multiple combinations specified here.
My User has root privileges but still fails with become:true & become_user: root.

From server, it successfully switched to root.

sa_XXXXXX@XXXX-d-ubuntu24-XXX-1:~$ sudo -i
root@XXXX-d-ubuntu24-XXX-1:~#

Can some one please help here ? What am I missing here ?

Best regards

Is this because I am using a custom way of SSH ( with gcloud ) which does not support become:true ? since I have not defined what become: true means in the connection mechanism .