I'm using Google Cloud CLI to create a VM, and I needed to create firewall rules via the CLI also;
I have a bash script, with some predefined variables like the port, description, etc; that creates a VM, and then applies firewall rules for it;
To apply the rules I use
gcloud compute firewall-rules create
But the errors I get are arguments defined in the GCP documentation here
ERROR: (gcloud.compute.firewall-rules.create) unrecognized arguments:
./1541078390.sh: line 84: --allow: command not found
./1541078390.sh: line 86: --source-ranges: command not found
./1541078390.sh: line 87: --priority: command not found
I've tried different, but similar approaches and I keep getting them. Is there anything I'm missing?
An example of the script is
ports="udp:2555"
vm="client"
priority=100
description="Port 2555"
gcloud compute firewall-rules create "${ports%%:*} rule" \
--allow "${ports}" \ (line 84)
--source-tags "$vm" \
--source-ranges "0.0.0.0/0" \ (line 86)
--priority "$priority" \(line 87)
--description "$description" \
--direction INGRESS