You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Pulumi Python创建Google Cloud Armor自适应防护安全策略报错

在Google Kubernetes中配置Cloud Armor自适应防护时遇到无效键错误

我需要在Google Kubernetes中创建安全策略,为应用层DDoS攻击启用自适应防护(Adaptive Protection)。参考Pulumi文档后,编写了如下代码:

ddos_layer7_defense_policy_name = "ddos-layer7-defense-policy"
ddos_layer7_defense_policy = gcp.compute.SecurityPolicy(
    resource_name=ddos_layer7_defense_policy_name,
    description="Policy for enabling DDoS defence on L7",
    name=ddos_layer7_defense_policy_name,
    adaptive_protection_config=gcp.compute.SecurityPolicyAdaptiveProtectionConfigArgs(
        layer7_ddos_defense_config=gcp.compute.SecurityPolicyAdaptiveProtectionConfigLayer7DdosDefenseConfigArgs(
            enable=False, # enable DDoS defense
            rule_visibility="STANDARD" 
        )
    )

)

查阅官方文档后发现,文档显示enable=True为第一个参数,但本地虚拟环境安装的Pulumi库没有该关键字参数(kwarg),不过查看代码时这两个参数确实存在。

即便如此,我还是收到了无效键错误:

error: gcp:compute/securityPolicy:SecurityPolicy resource 'ddos-layer7-defense-policy' has a problem: Invalid or unknown key. Examine values at 'SecurityPolicy.AdaptiveProtectionConfig.Layer7DdosDefenseConfig'.

查看源代码也无济于事,因为签名与我提供的参数匹配。该问题在Pulumi社区也未得到解决。

更新1:设置enable=True并移除rule_visibility后,仍出现相同错误。


内容的提问来源于stack exchange,提问作者Aviral Srivastava

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.17 13:17:10