如何使用Google Cloud Deployment Manager部署防火墙资源时解决ResourceErrorCode:400

迈克尔·陈

我正在尝试使用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信息中心手动设置防火墙。

Wojtek_B

您实际需要的是为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] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

使用Google Cloud Platform Deployment Manager模板创建存储桶

尽管有防火墙规则,仍无法连接到Google Cloud Compute实例上的端口80

在公司防火墙后使用cloud_sql_proxy-无法连接到mysql实例

如何从GUI生成Cloud Deployment Manager配置YAML?

Google Cloud Deployment Manager无法使用权限被拒绝的“ logging.v2.sink”创建部署

配置Google Cloud Compute防火墙,以允许外部访问数据库服务器

如何使用Deployment Manager将文件写入Google Cloud Storage?

使用Google Cloud Platform时如何锁定状态文件?

尽管有防火墙规则,Google Cloud Compute Engine仍拒绝连接

设置防火墙规则-从Google Cloud Console还是从实例内部

Google Cloud Console安装防火墙上的节点检查

Google Deployment Manager Cloud Scheduler类型

使用FOSUserBundle时出现防火墙问题

您如何调试Google Deployment Manager模板?

使用Deployment Manager创建Cloud SQL-“前提条件检查失败”。错误

如何部署使用Google Cloud build和Source Repository新推的多个Cloud功能?

如何使用Deployment Manager将IAM策略设置为Cloud Function

通过Google Cloud Deployment Manager创建的Google数据流

使用Deployment Manager配置防火墙和启动脚本

Google Cloud Platform创建防火墙规则,该规则允许来自一个特定国家的请求

如何部署使用Google Cloud数据库运行的Laravel 8 Google Cloud

使用VPN时需要软件防火墙吗?

DataLab Cloud Deployment 403错误

创建Google Cloud Platform实例时有多个防火墙。使用哪个?

Google Cloud 防火墙在地址中使用端口时阻止连接

使用部署管理器模板配置防火墙和启动脚本时出现问题

使用 Deployment Manager 运行时在 Cloud Build 日志中看不到输出

尽管配置了防火墙,但 Google Cloud Linux VM 将不允许 HTTP 访问事件

Cloud Run 静态出站 IP 地址不通过 Google App Engine 防火墙