skip to Main Content

I’m currently working through some GCP training courses via https://www.cloudskillsboost.google/ and seeing some differences in my output versus the documentation. Not sure if this is down to the software version, account settings or what?

Example given is for a list of firewall rules:

gcloud compute firewall-rules list

and the example output is

    NAME                         NETWORK      DIRECTION  PRIORITY  ALLOW                         DENY  DISABLED
default-allow-icmp           default      INGRESS    65534     icmp                                False
default-allow-internal       default      INGRESS    65534     tcp:0-65535,udp:0-65535,icmp        False
default-allow-rdp            default      INGRESS    65534     tcp:3389                            False
default-allow-ssh            default      INGRESS    65534     tcp:22                              False
dev-net-allow-ssh            dev-network  INGRESS    1000      tcp:22                              False
serverless-to-vpc-connector  dev-network  INGRESS    1000      icmp,udp:665-666,tcp:667            False
vpc-connector-egress         dev-network  INGRESS    1000      icmp,udp,tcp                        False
vpc-connector-health-check   dev-network  INGRESS    1000      tcp:667                             False
vpc-connector-to-serverless  dev-network  EGRESS     1000      icmp,udp:665-666,tcp:667            False

One rule per line with multiple fields horizontally. However, when I run this command in the Cloud Shell I get the following:

NAME: default-allow-icmp
NETWORK: default
DIRECTION: INGRESS
PRIORITY: 65534
ALLOW: icmp
DENY:
DISABLED: False

NAME: default-allow-internal
NETWORK: default
DIRECTION: INGRESS
PRIORITY: 65534
ALLOW: tcp:0-65535,udp:0-65535,icmp
DENY:
DISABLED: False

NAME: default-allow-rdp
NETWORK: default
DIRECTION: INGRESS
PRIORITY: 65534
ALLOW: tcp:3389
DENY:
DISABLED: False

NAME: default-allow-ssh
NETWORK: default
DIRECTION: INGRESS
PRIORITY: 65534
ALLOW: tcp:22
DENY:
DISABLED: False

NAME: fw-allow-health-check
NETWORK: default
DIRECTION: INGRESS
PRIORITY: 1000
ALLOW: tcp:80
DENY:
DISABLED: False

NAME: www-firewall-network-lb
NETWORK: default
DIRECTION: INGRESS
PRIORITY: 1000
ALLOW: tcp:80
DENY:
DISABLED: False

It’s the same data but the layout is different. (Appreciate that output is not identical, but I’m ot concerned abiout that. Differences between sample and live data is ok here I think)

Now, you can change the output format with the format option, but I can’t recreate this tab separated table.

Is this just down to the documentation reformatting the output? Is it down to the software version or a setting I’ve missed? Can the format option do this and I’ve just not figured it out?

Any pointers much appreciated, as it’s frustrating me.

2

Answers


  1. Sharing you the best practices document [1], which explains the ways to format with example scripts.

    You can check the possible outputs of –format in the [2] and also a similar thread [SO link] explains the ways to generate excel format output.

    Login or Signup to reply.
  2. @Richard Gieg has already provided a solution to this issue in this stack overflow discussion Output of gcloud list commands not displaying in table form.

    Setting the below flag will provide the table format that you are looking for.

    gcloud config set accessibility/screen_reader false
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search