gpt4 book ai didi

python - Pulumi azure-native 缺少必需的属性 'resourceGroupName'

转载 作者:行者123 更新时间:2023-12-03 05:22:01 25 4
gpt4 key购买 nike

在 pulumi 脚本中,运行 pulumi up 时出现以下错误

azure-native:sql:DatabaseSecurityAlertPolicy (sap_primary):
error: azure-native:sql:DatabaseSecurityAlertPolicy resource 'sap_primary' has a problem: missing required property 'resourceGroupName'

这是代码的相关部分:

resource_group = resources.ResourceGroup(
resource_name = <rg-name>,
tags={
<tags> # placeholder for the real tags
},
opts=pulumi.ResourceOptions(import_=<rg id>))


sql_server = sql.Server(
resource_name = str(app_stage) + '-' + str(app_key) + '-sql',
resource_group_name = resource_group.name,
location = resource_group.location,
administrator_login = sql_server_admin_user,
administrator_login_password = sql_server_admin_password,
version = sql_version,
tags = resource_group.tags,
identity = sql.ResourceIdentityArgs(type=sql.IdentityType.SYSTEM_ASSIGNED)
)


sql_database_primary = sql.Database(
resource_name = sql_database_name,
resource_group_name = resource_group.name,
location = resource_group.location,
server_name = sql_server.name,
sku = sql.SkuArgs(
name = 'GP_Gen5_2',
tier = sql_edition),
zone_redundant = sql_zone_redundancy,
tags = resource_group.tags,
)

database_security_alert_policy = sql.DatabaseSecurityAlertPolicy(
resource_name = 'sap_primary',
resource_group_name = sql_server.resource_group_name,
database_name = sql_database_name,
server_name = sql_server.name,
state = sql.SecurityAlertsPolicyState.ENABLED,
)

我不明白为什么它说 resourceGroupName 丢失,但它的设置如您所见。我错过了什么?

为了避免这样的问题:例如在哪里? sql_server_admin_user 来自,它们在 Pulumi.dev.yaml 文件中设置,并在 config.get('sql_server_admin_user') 等脚本中导入

最佳答案

sql_server.resource_group_name 不存在。请改用 resource_group.name

关于python - Pulumi azure-native 缺少必需的属性 'resourceGroupName',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/71440983/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com