postgresql.Server
Explore with Pulumi AI
The postgresql.Server
resource creates and manages a foreign server on a PostgreSQL server.
Usage
import * as pulumi from "@pulumi/pulumi";
import * as postgresql from "@pulumi/postgresql";
const extPostgresFdw = new postgresql.Extension("ext_postgres_fdw", {name: "postgres_fdw"});
const myserverPostgres = new postgresql.Server("myserver_postgres", {
serverName: "myserver_postgres",
fdwName: "postgres_fdw",
options: {
host: "foo",
dbname: "foodb",
port: "5432",
},
}, {
dependsOn: [extPostgresFdw],
});
import pulumi
import pulumi_postgresql as postgresql
ext_postgres_fdw = postgresql.Extension("ext_postgres_fdw", name="postgres_fdw")
myserver_postgres = postgresql.Server("myserver_postgres",
server_name="myserver_postgres",
fdw_name="postgres_fdw",
options={
"host": "foo",
"dbname": "foodb",
"port": "5432",
},
opts = pulumi.ResourceOptions(depends_on=[ext_postgres_fdw]))
package main
import (
"github.com/pulumi/pulumi-postgresql/sdk/v3/go/postgresql"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
extPostgresFdw, err := postgresql.NewExtension(ctx, "ext_postgres_fdw", &postgresql.ExtensionArgs{
Name: pulumi.String("postgres_fdw"),
})
if err != nil {
return err
}
_, err = postgresql.NewServer(ctx, "myserver_postgres", &postgresql.ServerArgs{
ServerName: pulumi.String("myserver_postgres"),
FdwName: pulumi.String("postgres_fdw"),
Options: pulumi.StringMap{
"host": pulumi.String("foo"),
"dbname": pulumi.String("foodb"),
"port": pulumi.String("5432"),
},
}, pulumi.DependsOn([]pulumi.Resource{
extPostgresFdw,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using PostgreSql = Pulumi.PostgreSql;
return await Deployment.RunAsync(() =>
{
var extPostgresFdw = new PostgreSql.Extension("ext_postgres_fdw", new()
{
Name = "postgres_fdw",
});
var myserverPostgres = new PostgreSql.Server("myserver_postgres", new()
{
ServerName = "myserver_postgres",
FdwName = "postgres_fdw",
Options =
{
{ "host", "foo" },
{ "dbname", "foodb" },
{ "port", "5432" },
},
}, new CustomResourceOptions
{
DependsOn =
{
extPostgresFdw,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.postgresql.Extension;
import com.pulumi.postgresql.ExtensionArgs;
import com.pulumi.postgresql.Server;
import com.pulumi.postgresql.ServerArgs;
import com.pulumi.resources.CustomResourceOptions;
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) {
var extPostgresFdw = new Extension("extPostgresFdw", ExtensionArgs.builder()
.name("postgres_fdw")
.build());
var myserverPostgres = new Server("myserverPostgres", ServerArgs.builder()
.serverName("myserver_postgres")
.fdwName("postgres_fdw")
.options(Map.ofEntries(
Map.entry("host", "foo"),
Map.entry("dbname", "foodb"),
Map.entry("port", "5432")
))
.build(), CustomResourceOptions.builder()
.dependsOn(extPostgresFdw)
.build());
}
}
resources:
extPostgresFdw:
type: postgresql:Extension
name: ext_postgres_fdw
properties:
name: postgres_fdw
myserverPostgres:
type: postgresql:Server
name: myserver_postgres
properties:
serverName: myserver_postgres
fdwName: postgres_fdw
options:
host: foo
dbname: foodb
port: '5432'
options:
dependson:
- ${extPostgresFdw}
import * as pulumi from "@pulumi/pulumi";
import * as postgresql from "@pulumi/postgresql";
const extFileFdw = new postgresql.Extension("ext_file_fdw", {name: "file_fdw"});
const myserverFile = new postgresql.Server("myserver_file", {
serverName: "myserver_file",
fdwName: "file_fdw",
}, {
dependsOn: [extFileFdw],
});
import pulumi
import pulumi_postgresql as postgresql
ext_file_fdw = postgresql.Extension("ext_file_fdw", name="file_fdw")
myserver_file = postgresql.Server("myserver_file",
server_name="myserver_file",
fdw_name="file_fdw",
opts = pulumi.ResourceOptions(depends_on=[ext_file_fdw]))
package main
import (
"github.com/pulumi/pulumi-postgresql/sdk/v3/go/postgresql"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
extFileFdw, err := postgresql.NewExtension(ctx, "ext_file_fdw", &postgresql.ExtensionArgs{
Name: pulumi.String("file_fdw"),
})
if err != nil {
return err
}
_, err = postgresql.NewServer(ctx, "myserver_file", &postgresql.ServerArgs{
ServerName: pulumi.String("myserver_file"),
FdwName: pulumi.String("file_fdw"),
}, pulumi.DependsOn([]pulumi.Resource{
extFileFdw,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using PostgreSql = Pulumi.PostgreSql;
return await Deployment.RunAsync(() =>
{
var extFileFdw = new PostgreSql.Extension("ext_file_fdw", new()
{
Name = "file_fdw",
});
var myserverFile = new PostgreSql.Server("myserver_file", new()
{
ServerName = "myserver_file",
FdwName = "file_fdw",
}, new CustomResourceOptions
{
DependsOn =
{
extFileFdw,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.postgresql.Extension;
import com.pulumi.postgresql.ExtensionArgs;
import com.pulumi.postgresql.Server;
import com.pulumi.postgresql.ServerArgs;
import com.pulumi.resources.CustomResourceOptions;
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) {
var extFileFdw = new Extension("extFileFdw", ExtensionArgs.builder()
.name("file_fdw")
.build());
var myserverFile = new Server("myserverFile", ServerArgs.builder()
.serverName("myserver_file")
.fdwName("file_fdw")
.build(), CustomResourceOptions.builder()
.dependsOn(extFileFdw)
.build());
}
}
resources:
extFileFdw:
type: postgresql:Extension
name: ext_file_fdw
properties:
name: file_fdw
myserverFile:
type: postgresql:Server
name: myserver_file
properties:
serverName: myserver_file
fdwName: file_fdw
options:
dependson:
- ${extFileFdw}
Create Server Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Server(name: string, args: ServerArgs, opts?: CustomResourceOptions);
@overload
def Server(resource_name: str,
args: ServerArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Server(resource_name: str,
opts: Optional[ResourceOptions] = None,
fdw_name: Optional[str] = None,
server_name: Optional[str] = None,
drop_cascade: Optional[bool] = None,
options: Optional[Mapping[str, str]] = None,
server_owner: Optional[str] = None,
server_type: Optional[str] = None,
server_version: Optional[str] = None)
func NewServer(ctx *Context, name string, args ServerArgs, opts ...ResourceOption) (*Server, error)
public Server(string name, ServerArgs args, CustomResourceOptions? opts = null)
public Server(String name, ServerArgs args)
public Server(String name, ServerArgs args, CustomResourceOptions options)
type: postgresql:Server
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ServerArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args ServerArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args ServerArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ServerArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ServerArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var serverResource = new PostgreSql.Server("serverResource", new()
{
FdwName = "string",
ServerName = "string",
DropCascade = false,
Options =
{
{ "string", "string" },
},
ServerOwner = "string",
ServerType = "string",
ServerVersion = "string",
});
example, err := postgresql.NewServer(ctx, "serverResource", &postgresql.ServerArgs{
FdwName: pulumi.String("string"),
ServerName: pulumi.String("string"),
DropCascade: pulumi.Bool(false),
Options: pulumi.StringMap{
"string": pulumi.String("string"),
},
ServerOwner: pulumi.String("string"),
ServerType: pulumi.String("string"),
ServerVersion: pulumi.String("string"),
})
var serverResource = new Server("serverResource", ServerArgs.builder()
.fdwName("string")
.serverName("string")
.dropCascade(false)
.options(Map.of("string", "string"))
.serverOwner("string")
.serverType("string")
.serverVersion("string")
.build());
server_resource = postgresql.Server("serverResource",
fdw_name="string",
server_name="string",
drop_cascade=False,
options={
"string": "string",
},
server_owner="string",
server_type="string",
server_version="string")
const serverResource = new postgresql.Server("serverResource", {
fdwName: "string",
serverName: "string",
dropCascade: false,
options: {
string: "string",
},
serverOwner: "string",
serverType: "string",
serverVersion: "string",
});
type: postgresql:Server
properties:
dropCascade: false
fdwName: string
options:
string: string
serverName: string
serverOwner: string
serverType: string
serverVersion: string
Server Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The Server resource accepts the following input properties:
- Fdw
Name string - The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- Server
Name string - The name of the foreign server to be created.
- Drop
Cascade bool - When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
- Options Dictionary<string, string>
- This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
- Server
Owner string - By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
- Server
Type string - Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- Server
Version string - Optional server version, potentially useful to foreign-data wrappers.
- Fdw
Name string - The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- Server
Name string - The name of the foreign server to be created.
- Drop
Cascade bool - When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
- Options map[string]string
- This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
- Server
Owner string - By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
- Server
Type string - Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- Server
Version string - Optional server version, potentially useful to foreign-data wrappers.
- fdw
Name String - The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- server
Name String - The name of the foreign server to be created.
- drop
Cascade Boolean - When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
- options Map<String,String>
- This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
- server
Owner String - By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
- server
Type String - Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- server
Version String - Optional server version, potentially useful to foreign-data wrappers.
- fdw
Name string - The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- server
Name string - The name of the foreign server to be created.
- drop
Cascade boolean - When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
- options {[key: string]: string}
- This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
- server
Owner string - By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
- server
Type string - Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- server
Version string - Optional server version, potentially useful to foreign-data wrappers.
- fdw_
name str - The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- server_
name str - The name of the foreign server to be created.
- drop_
cascade bool - When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
- options Mapping[str, str]
- This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
- server_
owner str - By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
- server_
type str - Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- server_
version str - Optional server version, potentially useful to foreign-data wrappers.
- fdw
Name String - The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- server
Name String - The name of the foreign server to be created.
- drop
Cascade Boolean - When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
- options Map<String>
- This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
- server
Owner String - By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
- server
Type String - Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- server
Version String - Optional server version, potentially useful to foreign-data wrappers.
Outputs
All input properties are implicitly available as output properties. Additionally, the Server resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Server Resource
Get an existing Server resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: ServerState, opts?: CustomResourceOptions): Server
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
drop_cascade: Optional[bool] = None,
fdw_name: Optional[str] = None,
options: Optional[Mapping[str, str]] = None,
server_name: Optional[str] = None,
server_owner: Optional[str] = None,
server_type: Optional[str] = None,
server_version: Optional[str] = None) -> Server
func GetServer(ctx *Context, name string, id IDInput, state *ServerState, opts ...ResourceOption) (*Server, error)
public static Server Get(string name, Input<string> id, ServerState? state, CustomResourceOptions? opts = null)
public static Server get(String name, Output<String> id, ServerState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Drop
Cascade bool - When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
- Fdw
Name string - The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- Options Dictionary<string, string>
- This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
- Server
Name string - The name of the foreign server to be created.
- Server
Owner string - By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
- Server
Type string - Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- Server
Version string - Optional server version, potentially useful to foreign-data wrappers.
- Drop
Cascade bool - When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
- Fdw
Name string - The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- Options map[string]string
- This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
- Server
Name string - The name of the foreign server to be created.
- Server
Owner string - By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
- Server
Type string - Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- Server
Version string - Optional server version, potentially useful to foreign-data wrappers.
- drop
Cascade Boolean - When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
- fdw
Name String - The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- options Map<String,String>
- This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
- server
Name String - The name of the foreign server to be created.
- server
Owner String - By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
- server
Type String - Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- server
Version String - Optional server version, potentially useful to foreign-data wrappers.
- drop
Cascade boolean - When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
- fdw
Name string - The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- options {[key: string]: string}
- This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
- server
Name string - The name of the foreign server to be created.
- server
Owner string - By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
- server
Type string - Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- server
Version string - Optional server version, potentially useful to foreign-data wrappers.
- drop_
cascade bool - When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
- fdw_
name str - The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- options Mapping[str, str]
- This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
- server_
name str - The name of the foreign server to be created.
- server_
owner str - By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
- server_
type str - Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- server_
version str - Optional server version, potentially useful to foreign-data wrappers.
- drop
Cascade Boolean - When true, will drop objects that depend on the server (such as user mappings), and in turn all objects that depend on those objects . (Default: false)
- fdw
Name String - The name of the foreign-data wrapper that manages the server. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- options Map<String>
- This clause specifies the options for the server. The options typically define the connection details of the server, but the actual names and values are dependent on the server's foreign-data wrapper.
- server
Name String - The name of the foreign server to be created.
- server
Owner String - By default, the user who defines the server becomes its owner. Set this value to configure the new owner of the foreign server.
- server
Type String - Optional server type, potentially useful to foreign-data wrappers. Changing this value will force the creation of a new resource as this value can only be set when the foreign server is created.
- server
Version String - Optional server version, potentially useful to foreign-data wrappers.
Package Details
- Repository
- PostgreSQL pulumi/pulumi-postgresql
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
postgresql
Terraform Provider.