How do I add a firewall rule to a `Cluster` under ...
# azure
w
How do I add a firewall rule to a
Cluster
under
pulumi/azure-native/dbforpostgresql
? I tried using the
FirewallRule
resource and references the cluster name but it complains with:
error: Code="ResourceNotFound" Message="The Resource 'Microsoft.DBforPostgreSQL/flexibleServers/dbserverid' under resource group 'resourcegroup' was not found. For more details please go to https://aka.ms/ARMResourceNotFoundFix"
I've tried all kind of things for the server name when I try to creating the firewall rule, but none works. Has anyone else managed to create a
Cluster
(postgres for cosmos) and attached a firewall rule to the cluster?
@tall-librarian-49374, I take it here to be more specific instead. I managed to create the cluster but I'm failing with adding a firewall rule... Done this to other resources before without any problem, but not here. Key part of my code:
Copy code
import {
  Cluster,
  Role,
  FirewallRule,
} from "@pulumi/azure-native/dbforpostgresql";

const server = new Cluster(
  "dbserver",
  {
    administratorLoginPassword: password.result,
    location: "westeurope",
    coordinatorServerEdition: "GeneralPurpose",
    coordinatorStorageQuotaInMb: 524288,
    citusVersion: "11.1",
    coordinatorVCores: 2,
    nodeVCores: 4,
    postgresqlVersion: "14",
    nodeCount: 0,
    resourceGroupName: environmentConfig.azureConnections[0].resourceGroupName,
  },
  { provider: azureProvider }
);

const firewallRules = whitelistedIps.map((setting) => {
  return new FirewallRule(
    `whitelist-${setting.name}`,
    {
      resourceGroupName:
        environmentConfig.azureConnections[0].resourceGroupName,
      serverName: server.name,
      startIpAddress: setting.ip,
      endIpAddress: setting.ip,
    },
    { provider: azureProvider }
  );
});
t
w
very much so. I'll ask my question around status on it there then :)
@tall-librarian-49374, do you know of a workaround in scenarios like this before the feature is available in the SDK?
t
Not sure what kind of workaround it could be... you need a resource type to provision it. We discussed exposing some generic resource but haven't landed on a design. More tactically, I'm planning to take a look at these missing resources today or tomorrow.
w
Ok, sounds like I’ll be dealing with it manually for now then. That is currently doable, but it hurts my soul 🤣
t
Actually, it looks like we do generate those resources in explicit namespaces: https://github.com/pulumi/pulumi-azure-native/blob/master/sdk/nodejs/dbforpostgresql/v20221108/firewallRule.ts
So you should be able to import it with
pulumi/azure-native/dbforpostgresql/v20221108
w
that did solve it, thanks! But I guess it needs to be moved around at some point? Feels wrong to have to go into the explicit namespace to access the firewall for a cluster.
t
Yes, probably, I'll comment on the issue