pulumi / pulumi-azure-native

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

Split DBforPostgreSQL into PostgreSQL and CosmosDBForPostgresSQL #2753

Open mheers opened 11 months ago

mheers commented 11 months ago

There's two distinct services from Azure:

  1. PostgreSQL
  2. Azure Cosmos DB for PostgreSQL

Both of these services are using the Microsoft.DBforPostgreSQL namespace which results in us combining the types and resources. This means the resources PrivateEndpointConnection and FirewallRule conflict and one is ignored and is not available in the default namespace.

Move each of these services into their own module name to avoid the naming conflicts:

  1. PostgreSQL
  2. CosmosDBForPostgresSQL

Original Issue

What happened?

I'm using Go and the azure-native-v2 provider and try to setup resources from dbforpostgresql. I recognized that:

It would be nice to have ServerName AND ClusterName in both structs.

Expected Behavior

Steps to reproduce

pec, err := dbforpostgresql.NewFirewallRule(ctx, "my-cosmo", &dbforpostgresql.FirewallRuleArgs{
    ClusterName: pulumi.String("my-cluster"),
})

Output of pulumi about

CLI
Version 3.78.0 Go Version go1.20.6 Go Compiler gc

Plugins NAME VERSION azure-native 2.6.0 azure-native 2.6.0 azure-native 2.6.0 azure-native 2.6.0 azure-native 2.6.0 go unknown

Host
OS ubuntu Version 20.04 Arch x86_64

This project is written in go: executable='/usr/bin/go' version='go version go1.21.1 linux/amd64'

Current Stack: az-azure-cosmosdb-for-postgresql-marcel

TYPE URN pulumi:pulumi:Stack urn:pulumi:az-azure-cosmosdb-for-postgresql-marcel::azure-cosmosdb-for-postgresql::pulumi:pulumi:Stack::azure-cosmosdb-for-postgresql-az-azure-cosmosdb-for-postgresql-marcel pulumi:providers:azure-native urn:pulumi:az-azure-cosmosdb-for-postgresql-marcel::azure-cosmosdb-for-postgresql::pulumi:providers:azure-native::default azure-native:resources:ResourceGroup urn:pulumi:az-azure-cosmosdb-for-postgresql-marcel::azure-cosmosdb-for-postgresql::azure-native:resources:ResourceGroup::resourceGroup azure-native:dbforpostgresql:Cluster urn:pulumi:az-azure-cosmosdb-for-postgresql-marcel::azure-cosmosdb-for-postgresql::azure-native:dbforpostgresql:Cluster::my-cosmo

Found no pending operations associated with az-azure-cosmosdb-for-postgresql-marcel

Backend
Name marcel URL file://~ User marcel Organizations

Dependencies: NAME VERSION github.com/pulumi/pulumi-azure-native-sdk/compute/v2 2.6.0 github.com/pulumi/pulumi-azure-native-sdk/dbforpostgresql/v2 2.6.0 github.com/pulumi/pulumi-azure-native-sdk/network/v2 2.6.0 github.com/pulumi/pulumi-azure-native-sdk/resources/v2 2.6.0 github.com/pulumi/pulumi/sdk/v3 3.81.0

Pulumi locates its logs in /tmp by default

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

thomas11 commented 11 months ago

We're probably not doing the right thing in az-native when generating the dbforpostgresql schema. providers/Microsoft.DBforPostgreSQL has distinct services in it, with similar resources under different paths, e.g., Firewall at Microsoft.DBforPostgreSQL/flexibleServers/ and Firewall at Microsoft.DBforPostgreSQL/serverGroupsv2/. We have only one dbforpostgresql.FirewallRule, though.

mastoj commented 9 months ago

Is there any update on this one? I hit this issue when I tried to setup cosmos for postgres with firewall now.

mikhailshilkov commented 9 months ago

I took a look and I see that we do expose the serverGroupsv2 version of the Firewall resource in its explicit namespace. You can import that namespace pulumi/azure-native/dbforpostgresql/v20221108.

Similarly, pulumi/azure-native/dbforpostgresql/v20230601preview contains a PrivateEndpointConnection resource that would work for flexible servers.

Our problem is that flexible server/cluster resources have the same name and we haven't done the job of disambiguating them in the default namespace. That's a breaking change that we should probably take in 3.0 of the provider.

cleverguy25 commented 1 month ago

Added to epic https://github.com/pulumi/home/issues/3552