我正在尝试使用Google Cloud Deployment Manager部署单个防火墙资源。我希望防火墙仅阻止我自己的IP地址访问已部署在https://cloudfunctiongateway.uc.r.appspot.com/的App Engine应用程序。但是,我得到一个错误:
location: /deployments/firewall-deployment2/resources/app-firewall
message: '{"ResourceType":"compute.v1.firewall","ResourceErrorCode":"400","ResourceErrorMessage":{"code":400,"message":"Request
contains an invalid argument.","status":"INVALID_ARGUMENT","statusMessage":"Bad
Request","requestPath":"https://compute.googleapis.com/compute/v1/projects/cloudfunctiongateway/global/firewalls","httpMethod":"POST"}}'
这是我的配置文件firewall.yaml
:
resources:
- type: compute.v1.firewall
name: app-firewall
properties:
network: https://cloudfunctiongateway.uc.r.appspot.com/
denied:
- IPProtocol: 33.27.10.123 # a fake ip address, I use my real one
sourceRanges: [ 0.0.0.0/0 ]
我在同一目录中运行此命令:
gcloud deployment-manager deployments create firewall-deployment --config firewall.yaml
我什至尝试在我的配置文件中部署以下代码:
resources:
- type: compute.v1.firewall
name: app-firewall
但是仍然会收到相同的错误消息。有任何解决这个问题的方法吗?注意我希望能够使用Deployment Manager进行此操作。我已经知道我可以从App Engine信息中心手动设置防火墙。
您实际需要的是为App Engine应用程序创建防火墙规则,这与GCP防火墙是不同的-这是两件事。
所以-为了做到这一点,请尝试运行以下命令:
resources:
- name: dmapprule1
type: gcp-types/appengine-v1:apps.firewall.ingressRules
properties:
appsId: 00c61b117c74f1a3bbcb4900df618a4c4ae211790ade0822a63cb492d671f318776a5a
priority: 1000
action: "DENY"
source_range: "0.0.0.0/0"
并运行它 gcloud deployment-manager deployments create firewall-deployment --config firewall.yaml
要查看受支持类型的完整列表,请使用gcloud beta deployment-manager types list
(beta版本列表更为全面)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句