pulumi / pulumi-azure-native

Azure Native Provider
Apache License 2.0
125 stars 33 forks source link

Internal Server Error when creating Azure Cosmos DB for PostgreSQL Cluster #3573

Open AdelinaK opened 1 week ago

AdelinaK commented 1 week ago

Hello. I am using Pulumi with Python.

I want to deploy an Azure Cosmos DB for PostgreSQL Cluster. I am using azure-native.dbforpostgresql.Cluster. I was able to create the resource but I don't see any support to change the Authentication settings to accept Entra ID Authentication. Is this feature missing or is there another way/package I can use?

I would like to stick with the Cluster, even if I see the property available in azure-native.dbforpostgresql.Server.

Thanks in advance!

justinvp commented 1 week ago

Thanks for the question @AdelinaK. Moving this to the Azure Native repository and someone will take a look and get back to you soon.

thomas11 commented 1 week ago

Hi @AdelinaK, it seems that this functionality was added to the Azure API spec in a later API version. Therefore, our docs and the default Cluster class don't show it. However, you can explicitly import the later API version 20230302preview that has the functionality. The specifics depend on your programming language, e.g., in TypeScript you would use dbforpostgresql.v20230302preview.Cluster instead of dbforpostgresql.Cluster.

AdelinaK commented 5 days ago

As suggested, I tried to use the 20230302preview version based on what I found here. I mentioned I'm using Python but I get an unexpected error:

azure-native:dbforpostgresql:Cluster (<db-name>)
    error: Code="internal_server_error" Message="Internal server error."
thomas11 commented 3 days ago

That's unfortunate. This error comes from Azure and indicates a bug in their service.

If you can share the Pulumi code creating the Cluster, we might be able to spot something.

AdelinaK commented 1 day ago

Sure.

import pulumi
import pulumi_azure_native

postgresql_cluster = pulumi_azure_native.dbforpostgresql.v20230302preview.Cluster(
    resource_name="<name_of_resource>",
    cluster_name="<name_of_cluster>",
    resource_group_name=resource_group.name,
    location="westeurope",
    coordinator_storage_quota_in_mb=131072,
    coordinator_server_edition="GeneralPurpose",
    coordinator_v_cores=2,
    enable_ha=False,
    enable_shards_on_coordinator=True,
    node_count=0,
    administrator_login_password="<randomly_generated_password>",
    citus_version="12.1",
    postgresql_version="16",
    auth_config=azure.dbforpostgresql.v20230302preview.AuthConfigArgs(
        active_directory_auth="enabled",
        password_auth="enabled"
    )
)

pulumi version 3.132.0 pulumi-azure-native version 2.60.0

thomas11 commented 1 day ago

I don't see an issue with your cluster definition. An internal server error is a bug in the Azure service. In case the problem is an invalid cluster definition and they're just not validating it properly, I suggest investigating if your cluster definition is correct. There are some examples here.