ResourceErrorCodeを解決する方法:Google Cloud DeploymentManagerを使用してファイアウォールリソースをデプロイする場合は400
Google Cloud DeploymentManagerを使用して単一のファイアウォールリソースをデプロイしようとしています。ファイアウォールで、自分のIPアドレスだけがすでにデプロイされているAppEngineアプリにアクセスするのをブロックしたいhttps://cloudfunctiongateway.uc.r.appspot.com/。ただし、エラーが発生します。
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
ただし、同じエラーメッセージが表示されます。これを修正する方法はありますか?これをDeploymentManagerで実行できるようにしたいことに注意してください。AppEngineダッシュボードからファイアウォールを手動で設定できることはすでに知っています。
回答
実際に必要なのは、GCPファイアウォールとは異なるAppEngineアプリケーションのファイアウォールルールを作成することです。これらは2つの異なるものです。
したがって、これを行うには、これを実行してみてください。
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
(ベータ版のリストははるかに包括的です)。