getServer

Use this data source to access information about an existing PostgreSQL Azure Database Server.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";
const example = azure.postgresql.getServer({
name: "postgresql-server-1",
resourceGroupName: "api-rg-pro",
});
export const postgresqlServerId = example.then(example => example.id);
import pulumi
import pulumi_azure as azure
example = azure.postgresql.get_server(name="postgresql-server-1",
resource_group_name="api-rg-pro")
pulumi.export("postgresqlServerId", example.id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Azure = Pulumi.Azure;
return await Deployment.RunAsync(() =>
{
var example = Azure.PostgreSql.GetServer.Invoke(new()
{
Name = "postgresql-server-1",
ResourceGroupName = "api-rg-pro",
});
return new Dictionary<string, object?>
{
["postgresqlServerId"] = example.Apply(getServerResult => getServerResult.Id),
};
});
package main
import (
"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/postgresql"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := postgresql.LookupServer(ctx, &postgresql.LookupServerArgs{
Name: "postgresql-server-1",
ResourceGroupName: "api-rg-pro",
}, nil)
if err != nil {
return err
}
ctx.Export("postgresqlServerId", example.Id)
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azure.postgresql.PostgresqlFunctions;
import com.pulumi.azure.postgresql.inputs.GetServerArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var example = PostgresqlFunctions.getServer(GetServerArgs.builder()
.name("postgresql-server-1")
.resourceGroupName("api-rg-pro")
.build());
ctx.export("postgresqlServerId", example.id());
}
}
variables:
example:
fn::invoke:
function: azure:postgresql:getServer
arguments:
name: postgresql-server-1
resourceGroupName: api-rg-pro
outputs:
postgresqlServerId: ${example.id}

API Providers

This data source uses the following Azure API Providers:

  • Microsoft.DBforPostgreSQL: 2017-12-01

Return

A collection of values returned by getServer.

Parameters

argument

A collection of arguments for invoking getServer.


suspend fun getServer(name: String, resourceGroupName: String): GetServerResult

Return

A collection of values returned by getServer.

Parameters

name

The name of the PostgreSQL Server.

resourceGroupName

Specifies the name of the Resource Group where the PostgreSQL Server exists.

See also


suspend fun getServer(argument: suspend GetServerPlainArgsBuilder.() -> Unit): GetServerResult

Return

A collection of values returned by getServer.

Parameters

argument

Builder for com.pulumi.azure.postgresql.kotlin.inputs.GetServerPlainArgs.

See also