This message was deleted.
# azure
s
This message was deleted.
g
If I'm understanding your question, you would do something like this:
Copy code
import * as azure from "@pulumi/azure";
import * as pg from "@pulumi/postgresql";

const resourceGroup = new azure.core.ResourceGroup("resourceGroup");

const server = new azure.sql.SqlServer("main",{});

const db = new azure.sql.Database("main",{});

const pgProvider = new pg.Provider("main",{
    username: server.administratorLogin,
    password: server.administratorLoginPassword,
    host: db.serverName,
});

const pgRole = new pg.Role("main",{
    // role args
}, {provider: pgProvider})
(pseudocode)
You need to create an explicit provider (e.g.
pg.Provider
in this case) and then pass it into the PostgreSQL specific resources in order to tie it to the specific server that you created.
e
Nice, thanks!
👍 1
Running into this:
Copy code
azure:sql:Database (ground-control-db):
    error: Error issuing create/update request for SQL Database "ground-control-db" (Resource Group "RD-FoundationalServices-rg", Server "ground-control-db-server"): sql.DatabasesClient#CreateOrUpdate: Failure sending request: StatusCode=404 -- Original Error: Code="ParentResourceNotFound" Message="Can not perform requested operation on nested resource. Parent resource 'ground-control-db-server' not found."
Relevant code:
Copy code
const server = new azure.postgresql.Server(name, {
        name: name + '-server',
        location: resourceGroup.location,
        resourceGroupName: resourceGroup.name,
        administratorLogin: "psqladmin",
        administratorLoginPassword: adminPassword,
        skuName: "GP_Gen5_4",
        version: "11",
        sslEnforcement: `Enabled`,
        storageProfile: {
            storageMb: 5120,
            backupRetentionDays: 7,
            autoGrow: 'Enabled',
        },
        tags: {
            "project": "mercury"
        }
    });

    const db = new azure.sql.Database(name,{
        name: name,
        resourceGroupName: resourceGroup.name,
        serverName: server.name,
    }, {
        dependsOn: server
    });
@gentle-diamond-70147 thoughts on this?
g
Nothing obvious jumps out at me. You might try setting
location
on the
Database
too. Maybe the "not found" error is because it's trying to reference the Server from a different region.
If you re-run the
up
, does it succeed or same error?
Sometimes these "not found" errors are due to eventual consistency type issues at the provider. Meaning Azure returned an "ok" response for the Server and then Pulumi very quickly tried to create the Database referencing it and Azure's internal database hasn't fully propagated.
e
@gentle-diamond-70147 see my posts in the main channel... Changed to a specific postgres type