ionoscloud.dbaas.PSQLDatabase
Explore with Pulumi AI
Manages a DbaaS PgSql Database.
Example Usage
Create a PgSQL
cluster as presented in the documentation for the cluster, then define a database resource
and link it with the previously created cluster:
import * as pulumi from "@pulumi/pulumi";
import * as ionoscloud from "@ionos-cloud/sdk-pulumi";
const examplePgDatabase = new ionoscloud.dbaas.PSQLDatabase("example_pg_database", {
clusterId: example.id,
name: "exampledatabase",
owner: "exampleuser",
});
import pulumi
import pulumi_ionoscloud as ionoscloud
example_pg_database = ionoscloud.dbaas.PSQLDatabase("example_pg_database",
cluster_id=example["id"],
name="exampledatabase",
owner="exampleuser")
package main
import (
"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/dbaas"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dbaas.NewPSQLDatabase(ctx, "example_pg_database", &dbaas.PSQLDatabaseArgs{
ClusterId: pulumi.Any(example.Id),
Name: pulumi.String("exampledatabase"),
Owner: pulumi.String("exampleuser"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ionoscloud = Ionoscloud.Pulumi.Ionoscloud;
return await Deployment.RunAsync(() =>
{
var examplePgDatabase = new Ionoscloud.Dbaas.PSQLDatabase("example_pg_database", new()
{
ClusterId = example.Id,
Name = "exampledatabase",
Owner = "exampleuser",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ionoscloud.dbaas.PSQLDatabase;
import com.pulumi.ionoscloud.dbaas.PSQLDatabaseArgs;
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 examplePgDatabase = new PSQLDatabase("examplePgDatabase", PSQLDatabaseArgs.builder()
.clusterId(example.id())
.name("exampledatabase")
.owner("exampleuser")
.build());
}
}
resources:
examplePgDatabase:
type: ionoscloud:dbaas:PSQLDatabase
name: example_pg_database
properties:
clusterId: ${example.id}
name: exampledatabase
owner: exampleuser
Create PSQLDatabase Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new PSQLDatabase(name: string, args: PSQLDatabaseArgs, opts?: CustomResourceOptions);
@overload
def PSQLDatabase(resource_name: str,
args: PSQLDatabaseArgs,
opts: Optional[ResourceOptions] = None)
@overload
def PSQLDatabase(resource_name: str,
opts: Optional[ResourceOptions] = None,
cluster_id: Optional[str] = None,
owner: Optional[str] = None,
name: Optional[str] = None)
func NewPSQLDatabase(ctx *Context, name string, args PSQLDatabaseArgs, opts ...ResourceOption) (*PSQLDatabase, error)
public PSQLDatabase(string name, PSQLDatabaseArgs args, CustomResourceOptions? opts = null)
public PSQLDatabase(String name, PSQLDatabaseArgs args)
public PSQLDatabase(String name, PSQLDatabaseArgs args, CustomResourceOptions options)
type: ionoscloud:dbaas:PSQLDatabase
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 PSQLDatabaseArgs
- 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 PSQLDatabaseArgs
- 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 PSQLDatabaseArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PSQLDatabaseArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PSQLDatabaseArgs
- 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 psqldatabaseResource = new Ionoscloud.Dbaas.PSQLDatabase("psqldatabaseResource", new()
{
ClusterId = "string",
Owner = "string",
Name = "string",
});
example, err := dbaas.NewPSQLDatabase(ctx, "psqldatabaseResource", &dbaas.PSQLDatabaseArgs{
ClusterId: pulumi.String("string"),
Owner: pulumi.String("string"),
Name: pulumi.String("string"),
})
var psqldatabaseResource = new PSQLDatabase("psqldatabaseResource", PSQLDatabaseArgs.builder()
.clusterId("string")
.owner("string")
.name("string")
.build());
psqldatabase_resource = ionoscloud.dbaas.PSQLDatabase("psqldatabaseResource",
cluster_id="string",
owner="string",
name="string")
const psqldatabaseResource = new ionoscloud.dbaas.PSQLDatabase("psqldatabaseResource", {
clusterId: "string",
owner: "string",
name: "string",
});
type: ionoscloud:dbaas:PSQLDatabase
properties:
clusterId: string
name: string
owner: string
PSQLDatabase 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 PSQLDatabase resource accepts the following input properties:
- cluster_
id str - [string] The unique ID of the cluster.
- owner str
- [string] The owner of the database.
- name str
- [string] The name of the database.
Outputs
All input properties are implicitly available as output properties. Additionally, the PSQLDatabase 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 PSQLDatabase Resource
Get an existing PSQLDatabase 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?: PSQLDatabaseState, opts?: CustomResourceOptions): PSQLDatabase
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
cluster_id: Optional[str] = None,
name: Optional[str] = None,
owner: Optional[str] = None) -> PSQLDatabase
func GetPSQLDatabase(ctx *Context, name string, id IDInput, state *PSQLDatabaseState, opts ...ResourceOption) (*PSQLDatabase, error)
public static PSQLDatabase Get(string name, Input<string> id, PSQLDatabaseState? state, CustomResourceOptions? opts = null)
public static PSQLDatabase get(String name, Output<String> id, PSQLDatabaseState state, CustomResourceOptions options)
resources: _: type: ionoscloud:dbaas:PSQLDatabase get: id: ${id}
- 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.
- cluster_
id str - [string] The unique ID of the cluster.
- name str
- [string] The name of the database.
- owner str
- [string] The owner of the database.
Import
In order to import a PgSql database, you can define an empty database resource in the plan:
hcl
resource “ionoscloud_pg_database” “example” {
}
The resource can be imported using the clusterId
and the name
, for example:
$ pulumi import ionoscloud:dbaas/pSQLDatabase:PSQLDatabase example clusterid/name
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- ionoscloud ionos-cloud/pulumi-ionoscloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
ionoscloud
Terraform Provider.