1. Packages
  2. Aiven
  3. API Docs
  4. PgDatabase
Aiven v6.13.0 published on Monday, Mar 25, 2024 by Pulumi

aiven.PgDatabase

Explore with Pulumi AI

aiven logo
Aiven v6.13.0 published on Monday, Mar 25, 2024 by Pulumi

    The PG Database resource allows the creation and management of Aiven PostgreSQL Databases.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aiven from "@pulumi/aiven";
    
    const mydatabase = new aiven.PgDatabase("mydatabase", {
        project: aiven_project.myproject.project,
        serviceName: aiven_pg.mypg.service_name,
        databaseName: "<DATABASE_NAME>",
    });
    
    import pulumi
    import pulumi_aiven as aiven
    
    mydatabase = aiven.PgDatabase("mydatabase",
        project=aiven_project["myproject"]["project"],
        service_name=aiven_pg["mypg"]["service_name"],
        database_name="<DATABASE_NAME>")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aiven/sdk/v6/go/aiven"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := aiven.NewPgDatabase(ctx, "mydatabase", &aiven.PgDatabaseArgs{
    			Project:      pulumi.Any(aiven_project.Myproject.Project),
    			ServiceName:  pulumi.Any(aiven_pg.Mypg.Service_name),
    			DatabaseName: pulumi.String("<DATABASE_NAME>"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aiven = Pulumi.Aiven;
    
    return await Deployment.RunAsync(() => 
    {
        var mydatabase = new Aiven.PgDatabase("mydatabase", new()
        {
            Project = aiven_project.Myproject.Project,
            ServiceName = aiven_pg.Mypg.Service_name,
            DatabaseName = "<DATABASE_NAME>",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aiven.PgDatabase;
    import com.pulumi.aiven.PgDatabaseArgs;
    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 mydatabase = new PgDatabase("mydatabase", PgDatabaseArgs.builder()        
                .project(aiven_project.myproject().project())
                .serviceName(aiven_pg.mypg().service_name())
                .databaseName("<DATABASE_NAME>")
                .build());
    
        }
    }
    
    resources:
      mydatabase:
        type: aiven:PgDatabase
        properties:
          project: ${aiven_project.myproject.project}
          serviceName: ${aiven_pg.mypg.service_name}
          databaseName: <DATABASE_NAME>
    

    Create PgDatabase Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new PgDatabase(name: string, args: PgDatabaseArgs, opts?: CustomResourceOptions);
    @overload
    def PgDatabase(resource_name: str,
                   args: PgDatabaseArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def PgDatabase(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   database_name: Optional[str] = None,
                   project: Optional[str] = None,
                   service_name: Optional[str] = None,
                   lc_collate: Optional[str] = None,
                   lc_ctype: Optional[str] = None,
                   termination_protection: Optional[bool] = None)
    func NewPgDatabase(ctx *Context, name string, args PgDatabaseArgs, opts ...ResourceOption) (*PgDatabase, error)
    public PgDatabase(string name, PgDatabaseArgs args, CustomResourceOptions? opts = null)
    public PgDatabase(String name, PgDatabaseArgs args)
    public PgDatabase(String name, PgDatabaseArgs args, CustomResourceOptions options)
    
    type: aiven:PgDatabase
    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 PgDatabaseArgs
    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 PgDatabaseArgs
    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 PgDatabaseArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PgDatabaseArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PgDatabaseArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var pgDatabaseResource = new Aiven.PgDatabase("pgDatabaseResource", new()
    {
        DatabaseName = "string",
        Project = "string",
        ServiceName = "string",
        LcCollate = "string",
        LcCtype = "string",
        TerminationProtection = false,
    });
    
    example, err := aiven.NewPgDatabase(ctx, "pgDatabaseResource", &aiven.PgDatabaseArgs{
    	DatabaseName:          pulumi.String("string"),
    	Project:               pulumi.String("string"),
    	ServiceName:           pulumi.String("string"),
    	LcCollate:             pulumi.String("string"),
    	LcCtype:               pulumi.String("string"),
    	TerminationProtection: pulumi.Bool(false),
    })
    
    var pgDatabaseResource = new PgDatabase("pgDatabaseResource", PgDatabaseArgs.builder()        
        .databaseName("string")
        .project("string")
        .serviceName("string")
        .lcCollate("string")
        .lcCtype("string")
        .terminationProtection(false)
        .build());
    
    pg_database_resource = aiven.PgDatabase("pgDatabaseResource",
        database_name="string",
        project="string",
        service_name="string",
        lc_collate="string",
        lc_ctype="string",
        termination_protection=False)
    
    const pgDatabaseResource = new aiven.PgDatabase("pgDatabaseResource", {
        databaseName: "string",
        project: "string",
        serviceName: "string",
        lcCollate: "string",
        lcCtype: "string",
        terminationProtection: false,
    });
    
    type: aiven:PgDatabase
    properties:
        databaseName: string
        lcCollate: string
        lcCtype: string
        project: string
        serviceName: string
        terminationProtection: false
    

    PgDatabase Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The PgDatabase resource accepts the following input properties:

    DatabaseName string
    The name of the service database. Changing this property forces recreation of the resource.
    Project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    ServiceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    LcCollate string
    Default string sort order (LC_COLLATE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    LcCtype string
    Default character classification (LC_CTYPE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    TerminationProtection bool
    It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is false.
    DatabaseName string
    The name of the service database. Changing this property forces recreation of the resource.
    Project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    ServiceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    LcCollate string
    Default string sort order (LC_COLLATE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    LcCtype string
    Default character classification (LC_CTYPE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    TerminationProtection bool
    It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is false.
    databaseName String
    The name of the service database. Changing this property forces recreation of the resource.
    project String
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    serviceName String
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    lcCollate String
    Default string sort order (LC_COLLATE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    lcCtype String
    Default character classification (LC_CTYPE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    terminationProtection Boolean
    It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is false.
    databaseName string
    The name of the service database. Changing this property forces recreation of the resource.
    project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    serviceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    lcCollate string
    Default string sort order (LC_COLLATE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    lcCtype string
    Default character classification (LC_CTYPE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    terminationProtection boolean
    It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is false.
    database_name str
    The name of the service database. Changing this property forces recreation of the resource.
    project str
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    service_name str
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    lc_collate str
    Default string sort order (LC_COLLATE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    lc_ctype str
    Default character classification (LC_CTYPE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    termination_protection bool
    It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is false.
    databaseName String
    The name of the service database. Changing this property forces recreation of the resource.
    project String
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    serviceName String
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    lcCollate String
    Default string sort order (LC_COLLATE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    lcCtype String
    Default character classification (LC_CTYPE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    terminationProtection Boolean
    It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is false.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the PgDatabase 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 PgDatabase Resource

    Get an existing PgDatabase 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?: PgDatabaseState, opts?: CustomResourceOptions): PgDatabase
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            database_name: Optional[str] = None,
            lc_collate: Optional[str] = None,
            lc_ctype: Optional[str] = None,
            project: Optional[str] = None,
            service_name: Optional[str] = None,
            termination_protection: Optional[bool] = None) -> PgDatabase
    func GetPgDatabase(ctx *Context, name string, id IDInput, state *PgDatabaseState, opts ...ResourceOption) (*PgDatabase, error)
    public static PgDatabase Get(string name, Input<string> id, PgDatabaseState? state, CustomResourceOptions? opts = null)
    public static PgDatabase get(String name, Output<String> id, PgDatabaseState 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.
    The following state arguments are supported:
    DatabaseName string
    The name of the service database. Changing this property forces recreation of the resource.
    LcCollate string
    Default string sort order (LC_COLLATE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    LcCtype string
    Default character classification (LC_CTYPE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    Project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    ServiceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    TerminationProtection bool
    It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is false.
    DatabaseName string
    The name of the service database. Changing this property forces recreation of the resource.
    LcCollate string
    Default string sort order (LC_COLLATE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    LcCtype string
    Default character classification (LC_CTYPE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    Project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    ServiceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    TerminationProtection bool
    It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is false.
    databaseName String
    The name of the service database. Changing this property forces recreation of the resource.
    lcCollate String
    Default string sort order (LC_COLLATE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    lcCtype String
    Default character classification (LC_CTYPE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    project String
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    serviceName String
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    terminationProtection Boolean
    It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is false.
    databaseName string
    The name of the service database. Changing this property forces recreation of the resource.
    lcCollate string
    Default string sort order (LC_COLLATE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    lcCtype string
    Default character classification (LC_CTYPE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    project string
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    serviceName string
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    terminationProtection boolean
    It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is false.
    database_name str
    The name of the service database. Changing this property forces recreation of the resource.
    lc_collate str
    Default string sort order (LC_COLLATE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    lc_ctype str
    Default character classification (LC_CTYPE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    project str
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    service_name str
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    termination_protection bool
    It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is false.
    databaseName String
    The name of the service database. Changing this property forces recreation of the resource.
    lcCollate String
    Default string sort order (LC_COLLATE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    lcCtype String
    Default character classification (LC_CTYPE) of the database. The default value is en_US.UTF-8. Changing this property forces recreation of the resource.
    project String
    Identifies the project this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    serviceName String
    Specifies the name of the service that this resource belongs to. To set up proper dependencies please refer to this variable as a reference. Changing this property forces recreation of the resource.
    terminationProtection Boolean
    It is a Terraform client-side deletion protections, which prevents the database from being deleted by Terraform. It is recommended to enable this for any production databases containing critical data. The default value is false.

    Import

    $ pulumi import aiven:index/pgDatabase:PgDatabase mydatabase project/service_name/database_name
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Aiven pulumi/pulumi-aiven
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aiven Terraform Provider.
    aiven logo
    Aiven v6.13.0 published on Monday, Mar 25, 2024 by Pulumi