【发布时间】:2018-11-02 00:32:41
【问题描述】:
我正在使用 Google Cloud CLI 创建虚拟机,我还需要通过 CLI 创建防火墙规则;
我有一个 bash 脚本,其中包含一些预定义的变量,例如端口、描述等;创建虚拟机,然后为其应用防火墙规则;
应用我使用的规则
gcloud compute firewall-rules create
但我得到的错误是 GCP 文档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
我尝试了不同但相似的方法,我不断得到它们。 我有什么遗漏吗?
脚本的一个例子是
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
【问题讨论】:
标签: google-cloud-platform firewall