需要 Pulumi azure-native 缺失 属性 'resourceGroupName'

Pulumi azure-native missing required property 'resourceGroupName'

在 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 但它已设置为如您所见。我错过了什么?

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

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