1. Packages
  2. Ionoscloud
  3. API Docs
  4. dbaas
  5. PSQLUser
IonosCloud v0.2.3 published on Tuesday, May 13, 2025 by ionos-cloud

ionoscloud.dbaas.PSQLUser

Explore with Pulumi AI

ionoscloud logo
IonosCloud v0.2.3 published on Tuesday, May 13, 2025 by ionos-cloud

    Manages a DbaaS PgSql User.

    Example Usage

    Create a PgSQL cluster as presented in the documentation for the cluster, then define a user resource and link it with the previously created cluster:

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@ionos-cloud/sdk-pulumi";
    import * as random from "@pulumi/random";
    
    const userPassword = new random.index.Password("user_password", {
        length: 16,
        special: true,
        overrideSpecial: "!#$%&*()-_=+[]{}<>:?",
    });
    const examplePgUser = new ionoscloud.dbaas.PSQLUser("example_pg_user", {
        clusterId: example.id,
        username: "exampleuser",
        password: userPassword.result,
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    import pulumi_random as random
    
    user_password = random.index.Password("user_password",
        length=16,
        special=True,
        override_special=!#$%&*()-_=+[]{}<>:?)
    example_pg_user = ionoscloud.dbaas.PSQLUser("example_pg_user",
        cluster_id=example["id"],
        username="exampleuser",
        password=user_password["result"])
    
    package main
    
    import (
    	"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/dbaas"
    	"github.com/pulumi/pulumi-random/sdk/go/random"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		userPassword, err := random.NewPassword(ctx, "user_password", &random.PasswordArgs{
    			Length:          16,
    			Special:         true,
    			OverrideSpecial: "!#$%&*()-_=+[]{}<>:?",
    		})
    		if err != nil {
    			return err
    		}
    		_, err = dbaas.NewPSQLUser(ctx, "example_pg_user", &dbaas.PSQLUserArgs{
    			ClusterId: pulumi.Any(example.Id),
    			Username:  pulumi.String("exampleuser"),
    			Password:  userPassword.Result,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Ionoscloud.Pulumi.Ionoscloud;
    using Random = Pulumi.Random;
    
    return await Deployment.RunAsync(() => 
    {
        var userPassword = new Random.Index.Password("user_password", new()
        {
            Length = 16,
            Special = true,
            OverrideSpecial = "!#$%&*()-_=+[]{}<>:?",
        });
    
        var examplePgUser = new Ionoscloud.Dbaas.PSQLUser("example_pg_user", new()
        {
            ClusterId = example.Id,
            Username = "exampleuser",
            Password = userPassword.Result,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.random.password;
    import com.pulumi.random.PasswordArgs;
    import com.pulumi.ionoscloud.dbaas.PSQLUser;
    import com.pulumi.ionoscloud.dbaas.PSQLUserArgs;
    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 userPassword = new Password("userPassword", PasswordArgs.builder()
                .length(16)
                .special(true)
                .overrideSpecial("!#$%&*()-_=+[]{}<>:?")
                .build());
    
            var examplePgUser = new PSQLUser("examplePgUser", PSQLUserArgs.builder()
                .clusterId(example.id())
                .username("exampleuser")
                .password(userPassword.result())
                .build());
    
        }
    }
    
    resources:
      examplePgUser:
        type: ionoscloud:dbaas:PSQLUser
        name: example_pg_user
        properties:
          clusterId: ${example.id}
          username: exampleuser
          password: ${userPassword.result}
      userPassword:
        type: random:password
        name: user_password
        properties:
          length: 16
          special: true
          overrideSpecial: '!#$%&*()-_=+[]{}<>:?'
    

    Create PSQLUser Resource

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

    Constructor syntax

    new PSQLUser(name: string, args: PSQLUserArgs, opts?: CustomResourceOptions);
    @overload
    def PSQLUser(resource_name: str,
                 args: PSQLUserArgs,
                 opts: Optional[ResourceOptions] = None)
    
    @overload
    def PSQLUser(resource_name: str,
                 opts: Optional[ResourceOptions] = None,
                 cluster_id: Optional[str] = None,
                 password: Optional[str] = None,
                 username: Optional[str] = None)
    func NewPSQLUser(ctx *Context, name string, args PSQLUserArgs, opts ...ResourceOption) (*PSQLUser, error)
    public PSQLUser(string name, PSQLUserArgs args, CustomResourceOptions? opts = null)
    public PSQLUser(String name, PSQLUserArgs args)
    public PSQLUser(String name, PSQLUserArgs args, CustomResourceOptions options)
    
    type: ionoscloud:dbaas:PSQLUser
    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 PSQLUserArgs
    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 PSQLUserArgs
    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 PSQLUserArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PSQLUserArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PSQLUserArgs
    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 psqluserResource = new Ionoscloud.Dbaas.PSQLUser("psqluserResource", new()
    {
        ClusterId = "string",
        Password = "string",
        Username = "string",
    });
    
    example, err := dbaas.NewPSQLUser(ctx, "psqluserResource", &dbaas.PSQLUserArgs{
    	ClusterId: pulumi.String("string"),
    	Password:  pulumi.String("string"),
    	Username:  pulumi.String("string"),
    })
    
    var psqluserResource = new PSQLUser("psqluserResource", PSQLUserArgs.builder()
        .clusterId("string")
        .password("string")
        .username("string")
        .build());
    
    psqluser_resource = ionoscloud.dbaas.PSQLUser("psqluserResource",
        cluster_id="string",
        password="string",
        username="string")
    
    const psqluserResource = new ionoscloud.dbaas.PSQLUser("psqluserResource", {
        clusterId: "string",
        password: "string",
        username: "string",
    });
    
    type: ionoscloud:dbaas:PSQLUser
    properties:
        clusterId: string
        password: string
        username: string
    

    PSQLUser 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 PSQLUser resource accepts the following input properties:

    ClusterId string
    [string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
    Password string
    [string] User password.
    Username string
    [string] Used for authentication. Updates to the value of the field force the cluster to be re-created.
    ClusterId string
    [string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
    Password string
    [string] User password.
    Username string
    [string] Used for authentication. Updates to the value of the field force the cluster to be re-created.
    clusterId String
    [string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
    password String
    [string] User password.
    username String
    [string] Used for authentication. Updates to the value of the field force the cluster to be re-created.
    clusterId string
    [string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
    password string
    [string] User password.
    username string
    [string] Used for authentication. Updates to the value of the field force the cluster to be re-created.
    cluster_id str
    [string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
    password str
    [string] User password.
    username str
    [string] Used for authentication. Updates to the value of the field force the cluster to be re-created.
    clusterId String
    [string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
    password String
    [string] User password.
    username String
    [string] Used for authentication. Updates to the value of the field force the cluster to be re-created.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the PSQLUser resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    IsSystemUser bool
    [bool] Describes whether this user is a system user or not. A system user cannot be updated or deleted.
    Id string
    The provider-assigned unique ID for this managed resource.
    IsSystemUser bool
    [bool] Describes whether this user is a system user or not. A system user cannot be updated or deleted.
    id String
    The provider-assigned unique ID for this managed resource.
    isSystemUser Boolean
    [bool] Describes whether this user is a system user or not. A system user cannot be updated or deleted.
    id string
    The provider-assigned unique ID for this managed resource.
    isSystemUser boolean
    [bool] Describes whether this user is a system user or not. A system user cannot be updated or deleted.
    id str
    The provider-assigned unique ID for this managed resource.
    is_system_user bool
    [bool] Describes whether this user is a system user or not. A system user cannot be updated or deleted.
    id String
    The provider-assigned unique ID for this managed resource.
    isSystemUser Boolean
    [bool] Describes whether this user is a system user or not. A system user cannot be updated or deleted.

    Look up Existing PSQLUser Resource

    Get an existing PSQLUser 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?: PSQLUserState, opts?: CustomResourceOptions): PSQLUser
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cluster_id: Optional[str] = None,
            is_system_user: Optional[bool] = None,
            password: Optional[str] = None,
            username: Optional[str] = None) -> PSQLUser
    func GetPSQLUser(ctx *Context, name string, id IDInput, state *PSQLUserState, opts ...ResourceOption) (*PSQLUser, error)
    public static PSQLUser Get(string name, Input<string> id, PSQLUserState? state, CustomResourceOptions? opts = null)
    public static PSQLUser get(String name, Output<String> id, PSQLUserState state, CustomResourceOptions options)
    resources:  _:    type: ionoscloud:dbaas:PSQLUser    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.
    The following state arguments are supported:
    ClusterId string
    [string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
    IsSystemUser bool
    [bool] Describes whether this user is a system user or not. A system user cannot be updated or deleted.
    Password string
    [string] User password.
    Username string
    [string] Used for authentication. Updates to the value of the field force the cluster to be re-created.
    ClusterId string
    [string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
    IsSystemUser bool
    [bool] Describes whether this user is a system user or not. A system user cannot be updated or deleted.
    Password string
    [string] User password.
    Username string
    [string] Used for authentication. Updates to the value of the field force the cluster to be re-created.
    clusterId String
    [string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
    isSystemUser Boolean
    [bool] Describes whether this user is a system user or not. A system user cannot be updated or deleted.
    password String
    [string] User password.
    username String
    [string] Used for authentication. Updates to the value of the field force the cluster to be re-created.
    clusterId string
    [string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
    isSystemUser boolean
    [bool] Describes whether this user is a system user or not. A system user cannot be updated or deleted.
    password string
    [string] User password.
    username string
    [string] Used for authentication. Updates to the value of the field force the cluster to be re-created.
    cluster_id str
    [string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
    is_system_user bool
    [bool] Describes whether this user is a system user or not. A system user cannot be updated or deleted.
    password str
    [string] User password.
    username str
    [string] Used for authentication. Updates to the value of the field force the cluster to be re-created.
    clusterId String
    [string] The unique ID of the cluster. Updates to the value of the field force the cluster to be re-created.
    isSystemUser Boolean
    [bool] Describes whether this user is a system user or not. A system user cannot be updated or deleted.
    password String
    [string] User password.
    username String
    [string] Used for authentication. Updates to the value of the field force the cluster to be re-created.

    Import

    In order to import a PgSql user, you can define an empty user resource in the plan:

    hcl

    resource “ionoscloud_pg_user” “example” {

    }

    The resource can be imported using the clusterId and the username, for example:

    $ pulumi import ionoscloud:dbaas/pSQLUser:PSQLUser example clusterid/username
    

    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.
    ionoscloud logo
    IonosCloud v0.2.3 published on Tuesday, May 13, 2025 by ionos-cloud