1. Packages
  2. HashiCorp Vault Provider
  3. API Docs
  4. database
  5. SecretBackendStaticRole
HashiCorp Vault v6.6.0 published on Thursday, Mar 13, 2025 by Pulumi

vault.database.SecretBackendStaticRole

Explore with Pulumi AI

Creates a Database Secret Backend static role in Vault. Database secret backend static roles can be used to manage 1-to-1 mapping of a Vault Role to a user in a database for the database.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as vault from "@pulumi/vault";

const db = new vault.Mount("db", {
    path: "postgres",
    type: "database",
});
const postgres = new vault.database.SecretBackendConnection("postgres", {
    backend: db.path,
    name: "postgres",
    allowedRoles: ["*"],
    postgresql: {
        connectionUrl: "postgres://username:password@host:port/database",
    },
});
// configure a static role with period-based rotations
const periodRole = new vault.database.SecretBackendStaticRole("period_role", {
    backend: db.path,
    name: "my-period-role",
    dbName: postgres.name,
    username: "example",
    rotationPeriod: 3600,
    rotationStatements: ["ALTER USER \"{{name}}\" WITH PASSWORD '{{password}}';"],
});
// configure a static role with schedule-based rotations
const scheduleRole = new vault.database.SecretBackendStaticRole("schedule_role", {
    backend: db.path,
    name: "my-schedule-role",
    dbName: postgres.name,
    username: "example",
    rotationSchedule: "0 0 * * SAT",
    rotationWindow: 172800,
    rotationStatements: ["ALTER USER \"{{name}}\" WITH PASSWORD '{{password}}';"],
});
Copy
import pulumi
import pulumi_vault as vault

db = vault.Mount("db",
    path="postgres",
    type="database")
postgres = vault.database.SecretBackendConnection("postgres",
    backend=db.path,
    name="postgres",
    allowed_roles=["*"],
    postgresql={
        "connection_url": "postgres://username:password@host:port/database",
    })
# configure a static role with period-based rotations
period_role = vault.database.SecretBackendStaticRole("period_role",
    backend=db.path,
    name="my-period-role",
    db_name=postgres.name,
    username="example",
    rotation_period=3600,
    rotation_statements=["ALTER USER \"{{name}}\" WITH PASSWORD '{{password}}';"])
# configure a static role with schedule-based rotations
schedule_role = vault.database.SecretBackendStaticRole("schedule_role",
    backend=db.path,
    name="my-schedule-role",
    db_name=postgres.name,
    username="example",
    rotation_schedule="0 0 * * SAT",
    rotation_window=172800,
    rotation_statements=["ALTER USER \"{{name}}\" WITH PASSWORD '{{password}}';"])
Copy
package main

import (
	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault"
	"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/database"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		db, err := vault.NewMount(ctx, "db", &vault.MountArgs{
			Path: pulumi.String("postgres"),
			Type: pulumi.String("database"),
		})
		if err != nil {
			return err
		}
		postgres, err := database.NewSecretBackendConnection(ctx, "postgres", &database.SecretBackendConnectionArgs{
			Backend: db.Path,
			Name:    pulumi.String("postgres"),
			AllowedRoles: pulumi.StringArray{
				pulumi.String("*"),
			},
			Postgresql: &database.SecretBackendConnectionPostgresqlArgs{
				ConnectionUrl: pulumi.String("postgres://username:password@host:port/database"),
			},
		})
		if err != nil {
			return err
		}
		// configure a static role with period-based rotations
		_, err = database.NewSecretBackendStaticRole(ctx, "period_role", &database.SecretBackendStaticRoleArgs{
			Backend:        db.Path,
			Name:           pulumi.String("my-period-role"),
			DbName:         postgres.Name,
			Username:       pulumi.String("example"),
			RotationPeriod: pulumi.Int(3600),
			RotationStatements: pulumi.StringArray{
				pulumi.String("ALTER USER \"{{name}}\" WITH PASSWORD '{{password}}';"),
			},
		})
		if err != nil {
			return err
		}
		// configure a static role with schedule-based rotations
		_, err = database.NewSecretBackendStaticRole(ctx, "schedule_role", &database.SecretBackendStaticRoleArgs{
			Backend:          db.Path,
			Name:             pulumi.String("my-schedule-role"),
			DbName:           postgres.Name,
			Username:         pulumi.String("example"),
			RotationSchedule: pulumi.String("0 0 * * SAT"),
			RotationWindow:   pulumi.Int(172800),
			RotationStatements: pulumi.StringArray{
				pulumi.String("ALTER USER \"{{name}}\" WITH PASSWORD '{{password}}';"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vault = Pulumi.Vault;

return await Deployment.RunAsync(() => 
{
    var db = new Vault.Mount("db", new()
    {
        Path = "postgres",
        Type = "database",
    });

    var postgres = new Vault.Database.SecretBackendConnection("postgres", new()
    {
        Backend = db.Path,
        Name = "postgres",
        AllowedRoles = new[]
        {
            "*",
        },
        Postgresql = new Vault.Database.Inputs.SecretBackendConnectionPostgresqlArgs
        {
            ConnectionUrl = "postgres://username:password@host:port/database",
        },
    });

    // configure a static role with period-based rotations
    var periodRole = new Vault.Database.SecretBackendStaticRole("period_role", new()
    {
        Backend = db.Path,
        Name = "my-period-role",
        DbName = postgres.Name,
        Username = "example",
        RotationPeriod = 3600,
        RotationStatements = new[]
        {
            "ALTER USER \"{{name}}\" WITH PASSWORD '{{password}}';",
        },
    });

    // configure a static role with schedule-based rotations
    var scheduleRole = new Vault.Database.SecretBackendStaticRole("schedule_role", new()
    {
        Backend = db.Path,
        Name = "my-schedule-role",
        DbName = postgres.Name,
        Username = "example",
        RotationSchedule = "0 0 * * SAT",
        RotationWindow = 172800,
        RotationStatements = new[]
        {
            "ALTER USER \"{{name}}\" WITH PASSWORD '{{password}}';",
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vault.Mount;
import com.pulumi.vault.MountArgs;
import com.pulumi.vault.database.SecretBackendConnection;
import com.pulumi.vault.database.SecretBackendConnectionArgs;
import com.pulumi.vault.database.inputs.SecretBackendConnectionPostgresqlArgs;
import com.pulumi.vault.database.SecretBackendStaticRole;
import com.pulumi.vault.database.SecretBackendStaticRoleArgs;
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 db = new Mount("db", MountArgs.builder()
            .path("postgres")
            .type("database")
            .build());

        var postgres = new SecretBackendConnection("postgres", SecretBackendConnectionArgs.builder()
            .backend(db.path())
            .name("postgres")
            .allowedRoles("*")
            .postgresql(SecretBackendConnectionPostgresqlArgs.builder()
                .connectionUrl("postgres://username:password@host:port/database")
                .build())
            .build());

        // configure a static role with period-based rotations
        var periodRole = new SecretBackendStaticRole("periodRole", SecretBackendStaticRoleArgs.builder()
            .backend(db.path())
            .name("my-period-role")
            .dbName(postgres.name())
            .username("example")
            .rotationPeriod("3600")
            .rotationStatements("ALTER USER \"{{name}}\" WITH PASSWORD '{{password}}';")
            .build());

        // configure a static role with schedule-based rotations
        var scheduleRole = new SecretBackendStaticRole("scheduleRole", SecretBackendStaticRoleArgs.builder()
            .backend(db.path())
            .name("my-schedule-role")
            .dbName(postgres.name())
            .username("example")
            .rotationSchedule("0 0 * * SAT")
            .rotationWindow("172800")
            .rotationStatements("ALTER USER \"{{name}}\" WITH PASSWORD '{{password}}';")
            .build());

    }
}
Copy
resources:
  db:
    type: vault:Mount
    properties:
      path: postgres
      type: database
  postgres:
    type: vault:database:SecretBackendConnection
    properties:
      backend: ${db.path}
      name: postgres
      allowedRoles:
        - '*'
      postgresql:
        connectionUrl: postgres://username:password@host:port/database
  # configure a static role with period-based rotations
  periodRole:
    type: vault:database:SecretBackendStaticRole
    name: period_role
    properties:
      backend: ${db.path}
      name: my-period-role
      dbName: ${postgres.name}
      username: example
      rotationPeriod: '3600'
      rotationStatements:
        - ALTER USER "{{name}}" WITH PASSWORD '{{password}}';
  # configure a static role with schedule-based rotations
  scheduleRole:
    type: vault:database:SecretBackendStaticRole
    name: schedule_role
    properties:
      backend: ${db.path}
      name: my-schedule-role
      dbName: ${postgres.name}
      username: example
      rotationSchedule: 0 0 * * SAT
      rotationWindow: '172800'
      rotationStatements:
        - ALTER USER "{{name}}" WITH PASSWORD '{{password}}';
Copy

Create SecretBackendStaticRole Resource

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

Constructor syntax

new SecretBackendStaticRole(name: string, args: SecretBackendStaticRoleArgs, opts?: CustomResourceOptions);
@overload
def SecretBackendStaticRole(resource_name: str,
                            args: SecretBackendStaticRoleArgs,
                            opts: Optional[ResourceOptions] = None)

@overload
def SecretBackendStaticRole(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            db_name: Optional[str] = None,
                            username: Optional[str] = None,
                            backend: Optional[str] = None,
                            rotation_period: Optional[int] = None,
                            name: Optional[str] = None,
                            namespace: Optional[str] = None,
                            credential_type: Optional[str] = None,
                            rotation_schedule: Optional[str] = None,
                            rotation_statements: Optional[Sequence[str]] = None,
                            rotation_window: Optional[int] = None,
                            self_managed_password: Optional[str] = None,
                            skip_import_rotation: Optional[bool] = None,
                            credential_config: Optional[Mapping[str, str]] = None)
func NewSecretBackendStaticRole(ctx *Context, name string, args SecretBackendStaticRoleArgs, opts ...ResourceOption) (*SecretBackendStaticRole, error)
public SecretBackendStaticRole(string name, SecretBackendStaticRoleArgs args, CustomResourceOptions? opts = null)
public SecretBackendStaticRole(String name, SecretBackendStaticRoleArgs args)
public SecretBackendStaticRole(String name, SecretBackendStaticRoleArgs args, CustomResourceOptions options)
type: vault:database:SecretBackendStaticRole
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. SecretBackendStaticRoleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. SecretBackendStaticRoleArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. SecretBackendStaticRoleArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. SecretBackendStaticRoleArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. SecretBackendStaticRoleArgs
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 vaultSecretBackendStaticRoleResource = new Vault.Database.SecretBackendStaticRole("vaultSecretBackendStaticRoleResource", new()
{
    DbName = "string",
    Username = "string",
    Backend = "string",
    RotationPeriod = 0,
    Name = "string",
    Namespace = "string",
    CredentialType = "string",
    RotationSchedule = "string",
    RotationStatements = new[]
    {
        "string",
    },
    RotationWindow = 0,
    SelfManagedPassword = "string",
    SkipImportRotation = false,
    CredentialConfig = 
    {
        { "string", "string" },
    },
});
Copy
example, err := database.NewSecretBackendStaticRole(ctx, "vaultSecretBackendStaticRoleResource", &database.SecretBackendStaticRoleArgs{
	DbName:           pulumi.String("string"),
	Username:         pulumi.String("string"),
	Backend:          pulumi.String("string"),
	RotationPeriod:   pulumi.Int(0),
	Name:             pulumi.String("string"),
	Namespace:        pulumi.String("string"),
	CredentialType:   pulumi.String("string"),
	RotationSchedule: pulumi.String("string"),
	RotationStatements: pulumi.StringArray{
		pulumi.String("string"),
	},
	RotationWindow:      pulumi.Int(0),
	SelfManagedPassword: pulumi.String("string"),
	SkipImportRotation:  pulumi.Bool(false),
	CredentialConfig: pulumi.StringMap{
		"string": pulumi.String("string"),
	},
})
Copy
var vaultSecretBackendStaticRoleResource = new SecretBackendStaticRole("vaultSecretBackendStaticRoleResource", SecretBackendStaticRoleArgs.builder()
    .dbName("string")
    .username("string")
    .backend("string")
    .rotationPeriod(0)
    .name("string")
    .namespace("string")
    .credentialType("string")
    .rotationSchedule("string")
    .rotationStatements("string")
    .rotationWindow(0)
    .selfManagedPassword("string")
    .skipImportRotation(false)
    .credentialConfig(Map.of("string", "string"))
    .build());
Copy
vault_secret_backend_static_role_resource = vault.database.SecretBackendStaticRole("vaultSecretBackendStaticRoleResource",
    db_name="string",
    username="string",
    backend="string",
    rotation_period=0,
    name="string",
    namespace="string",
    credential_type="string",
    rotation_schedule="string",
    rotation_statements=["string"],
    rotation_window=0,
    self_managed_password="string",
    skip_import_rotation=False,
    credential_config={
        "string": "string",
    })
Copy
const vaultSecretBackendStaticRoleResource = new vault.database.SecretBackendStaticRole("vaultSecretBackendStaticRoleResource", {
    dbName: "string",
    username: "string",
    backend: "string",
    rotationPeriod: 0,
    name: "string",
    namespace: "string",
    credentialType: "string",
    rotationSchedule: "string",
    rotationStatements: ["string"],
    rotationWindow: 0,
    selfManagedPassword: "string",
    skipImportRotation: false,
    credentialConfig: {
        string: "string",
    },
});
Copy
type: vault:database:SecretBackendStaticRole
properties:
    backend: string
    credentialConfig:
        string: string
    credentialType: string
    dbName: string
    name: string
    namespace: string
    rotationPeriod: 0
    rotationSchedule: string
    rotationStatements:
        - string
    rotationWindow: 0
    selfManagedPassword: string
    skipImportRotation: false
    username: string
Copy

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

Backend
This property is required.
Changes to this property will trigger replacement.
string
The unique name of the Vault mount to configure.
DbName
This property is required.
Changes to this property will trigger replacement.
string
The unique name of the database connection to use for the static role.
Username
This property is required.
Changes to this property will trigger replacement.
string
The database username that this static role corresponds to.
CredentialConfig Dictionary<string, string>
CredentialType string
The credential type for the user, can be one of "password", "rsa_private_key" or "client_certificate".The configuration can be done in credential_config.
Name Changes to this property will trigger replacement. string
A unique name to give the static role.
Namespace Changes to this property will trigger replacement. string
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
RotationPeriod int
The amount of time Vault should wait before rotating the password, in seconds. Mutually exclusive with rotation_schedule.
RotationSchedule string

A cron-style string that will define the schedule on which rotations should occur. Mutually exclusive with rotation_period.

Warning: The rotation_period and rotation_schedule fields are mutually exclusive. One of them must be set but not both.

RotationStatements List<string>
Database statements to execute to rotate the password for the configured database user.
RotationWindow int
The amount of time, in seconds, in which rotations are allowed to occur starting from a given rotation_schedule.
SelfManagedPassword string
The password corresponding to the username in the database. Required when using the Rootless Password Rotation workflow for static roles. Only enabled for select DB engines (Postgres). Requires Vault 1.18+ Enterprise.
SkipImportRotation bool
If set to true, Vault will skip the initial secret rotation on import. Requires Vault 1.18+ Enterprise.
Backend
This property is required.
Changes to this property will trigger replacement.
string
The unique name of the Vault mount to configure.
DbName
This property is required.
Changes to this property will trigger replacement.
string
The unique name of the database connection to use for the static role.
Username
This property is required.
Changes to this property will trigger replacement.
string
The database username that this static role corresponds to.
CredentialConfig map[string]string
CredentialType string
The credential type for the user, can be one of "password", "rsa_private_key" or "client_certificate".The configuration can be done in credential_config.
Name Changes to this property will trigger replacement. string
A unique name to give the static role.
Namespace Changes to this property will trigger replacement. string
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
RotationPeriod int
The amount of time Vault should wait before rotating the password, in seconds. Mutually exclusive with rotation_schedule.
RotationSchedule string

A cron-style string that will define the schedule on which rotations should occur. Mutually exclusive with rotation_period.

Warning: The rotation_period and rotation_schedule fields are mutually exclusive. One of them must be set but not both.

RotationStatements []string
Database statements to execute to rotate the password for the configured database user.
RotationWindow int
The amount of time, in seconds, in which rotations are allowed to occur starting from a given rotation_schedule.
SelfManagedPassword string
The password corresponding to the username in the database. Required when using the Rootless Password Rotation workflow for static roles. Only enabled for select DB engines (Postgres). Requires Vault 1.18+ Enterprise.
SkipImportRotation bool
If set to true, Vault will skip the initial secret rotation on import. Requires Vault 1.18+ Enterprise.
backend
This property is required.
Changes to this property will trigger replacement.
String
The unique name of the Vault mount to configure.
dbName
This property is required.
Changes to this property will trigger replacement.
String
The unique name of the database connection to use for the static role.
username
This property is required.
Changes to this property will trigger replacement.
String
The database username that this static role corresponds to.
credentialConfig Map<String,String>
credentialType String
The credential type for the user, can be one of "password", "rsa_private_key" or "client_certificate".The configuration can be done in credential_config.
name Changes to this property will trigger replacement. String
A unique name to give the static role.
namespace Changes to this property will trigger replacement. String
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
rotationPeriod Integer
The amount of time Vault should wait before rotating the password, in seconds. Mutually exclusive with rotation_schedule.
rotationSchedule String

A cron-style string that will define the schedule on which rotations should occur. Mutually exclusive with rotation_period.

Warning: The rotation_period and rotation_schedule fields are mutually exclusive. One of them must be set but not both.

rotationStatements List<String>
Database statements to execute to rotate the password for the configured database user.
rotationWindow Integer
The amount of time, in seconds, in which rotations are allowed to occur starting from a given rotation_schedule.
selfManagedPassword String
The password corresponding to the username in the database. Required when using the Rootless Password Rotation workflow for static roles. Only enabled for select DB engines (Postgres). Requires Vault 1.18+ Enterprise.
skipImportRotation Boolean
If set to true, Vault will skip the initial secret rotation on import. Requires Vault 1.18+ Enterprise.
backend
This property is required.
Changes to this property will trigger replacement.
string
The unique name of the Vault mount to configure.
dbName
This property is required.
Changes to this property will trigger replacement.
string
The unique name of the database connection to use for the static role.
username
This property is required.
Changes to this property will trigger replacement.
string
The database username that this static role corresponds to.
credentialConfig {[key: string]: string}
credentialType string
The credential type for the user, can be one of "password", "rsa_private_key" or "client_certificate".The configuration can be done in credential_config.
name Changes to this property will trigger replacement. string
A unique name to give the static role.
namespace Changes to this property will trigger replacement. string
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
rotationPeriod number
The amount of time Vault should wait before rotating the password, in seconds. Mutually exclusive with rotation_schedule.
rotationSchedule string

A cron-style string that will define the schedule on which rotations should occur. Mutually exclusive with rotation_period.

Warning: The rotation_period and rotation_schedule fields are mutually exclusive. One of them must be set but not both.

rotationStatements string[]
Database statements to execute to rotate the password for the configured database user.
rotationWindow number
The amount of time, in seconds, in which rotations are allowed to occur starting from a given rotation_schedule.
selfManagedPassword string
The password corresponding to the username in the database. Required when using the Rootless Password Rotation workflow for static roles. Only enabled for select DB engines (Postgres). Requires Vault 1.18+ Enterprise.
skipImportRotation boolean
If set to true, Vault will skip the initial secret rotation on import. Requires Vault 1.18+ Enterprise.
backend
This property is required.
Changes to this property will trigger replacement.
str
The unique name of the Vault mount to configure.
db_name
This property is required.
Changes to this property will trigger replacement.
str
The unique name of the database connection to use for the static role.
username
This property is required.
Changes to this property will trigger replacement.
str
The database username that this static role corresponds to.
credential_config Mapping[str, str]
credential_type str
The credential type for the user, can be one of "password", "rsa_private_key" or "client_certificate".The configuration can be done in credential_config.
name Changes to this property will trigger replacement. str
A unique name to give the static role.
namespace Changes to this property will trigger replacement. str
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
rotation_period int
The amount of time Vault should wait before rotating the password, in seconds. Mutually exclusive with rotation_schedule.
rotation_schedule str

A cron-style string that will define the schedule on which rotations should occur. Mutually exclusive with rotation_period.

Warning: The rotation_period and rotation_schedule fields are mutually exclusive. One of them must be set but not both.

rotation_statements Sequence[str]
Database statements to execute to rotate the password for the configured database user.
rotation_window int
The amount of time, in seconds, in which rotations are allowed to occur starting from a given rotation_schedule.
self_managed_password str
The password corresponding to the username in the database. Required when using the Rootless Password Rotation workflow for static roles. Only enabled for select DB engines (Postgres). Requires Vault 1.18+ Enterprise.
skip_import_rotation bool
If set to true, Vault will skip the initial secret rotation on import. Requires Vault 1.18+ Enterprise.
backend
This property is required.
Changes to this property will trigger replacement.
String
The unique name of the Vault mount to configure.
dbName
This property is required.
Changes to this property will trigger replacement.
String
The unique name of the database connection to use for the static role.
username
This property is required.
Changes to this property will trigger replacement.
String
The database username that this static role corresponds to.
credentialConfig Map<String>
credentialType String
The credential type for the user, can be one of "password", "rsa_private_key" or "client_certificate".The configuration can be done in credential_config.
name Changes to this property will trigger replacement. String
A unique name to give the static role.
namespace Changes to this property will trigger replacement. String
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
rotationPeriod Number
The amount of time Vault should wait before rotating the password, in seconds. Mutually exclusive with rotation_schedule.
rotationSchedule String

A cron-style string that will define the schedule on which rotations should occur. Mutually exclusive with rotation_period.

Warning: The rotation_period and rotation_schedule fields are mutually exclusive. One of them must be set but not both.

rotationStatements List<String>
Database statements to execute to rotate the password for the configured database user.
rotationWindow Number
The amount of time, in seconds, in which rotations are allowed to occur starting from a given rotation_schedule.
selfManagedPassword String
The password corresponding to the username in the database. Required when using the Rootless Password Rotation workflow for static roles. Only enabled for select DB engines (Postgres). Requires Vault 1.18+ Enterprise.
skipImportRotation Boolean
If set to true, Vault will skip the initial secret rotation on import. Requires Vault 1.18+ Enterprise.

Outputs

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

Get an existing SecretBackendStaticRole 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?: SecretBackendStaticRoleState, opts?: CustomResourceOptions): SecretBackendStaticRole
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        backend: Optional[str] = None,
        credential_config: Optional[Mapping[str, str]] = None,
        credential_type: Optional[str] = None,
        db_name: Optional[str] = None,
        name: Optional[str] = None,
        namespace: Optional[str] = None,
        rotation_period: Optional[int] = None,
        rotation_schedule: Optional[str] = None,
        rotation_statements: Optional[Sequence[str]] = None,
        rotation_window: Optional[int] = None,
        self_managed_password: Optional[str] = None,
        skip_import_rotation: Optional[bool] = None,
        username: Optional[str] = None) -> SecretBackendStaticRole
func GetSecretBackendStaticRole(ctx *Context, name string, id IDInput, state *SecretBackendStaticRoleState, opts ...ResourceOption) (*SecretBackendStaticRole, error)
public static SecretBackendStaticRole Get(string name, Input<string> id, SecretBackendStaticRoleState? state, CustomResourceOptions? opts = null)
public static SecretBackendStaticRole get(String name, Output<String> id, SecretBackendStaticRoleState state, CustomResourceOptions options)
resources:  _:    type: vault:database:SecretBackendStaticRole    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Backend Changes to this property will trigger replacement. string
The unique name of the Vault mount to configure.
CredentialConfig Dictionary<string, string>
CredentialType string
The credential type for the user, can be one of "password", "rsa_private_key" or "client_certificate".The configuration can be done in credential_config.
DbName Changes to this property will trigger replacement. string
The unique name of the database connection to use for the static role.
Name Changes to this property will trigger replacement. string
A unique name to give the static role.
Namespace Changes to this property will trigger replacement. string
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
RotationPeriod int
The amount of time Vault should wait before rotating the password, in seconds. Mutually exclusive with rotation_schedule.
RotationSchedule string

A cron-style string that will define the schedule on which rotations should occur. Mutually exclusive with rotation_period.

Warning: The rotation_period and rotation_schedule fields are mutually exclusive. One of them must be set but not both.

RotationStatements List<string>
Database statements to execute to rotate the password for the configured database user.
RotationWindow int
The amount of time, in seconds, in which rotations are allowed to occur starting from a given rotation_schedule.
SelfManagedPassword string
The password corresponding to the username in the database. Required when using the Rootless Password Rotation workflow for static roles. Only enabled for select DB engines (Postgres). Requires Vault 1.18+ Enterprise.
SkipImportRotation bool
If set to true, Vault will skip the initial secret rotation on import. Requires Vault 1.18+ Enterprise.
Username Changes to this property will trigger replacement. string
The database username that this static role corresponds to.
Backend Changes to this property will trigger replacement. string
The unique name of the Vault mount to configure.
CredentialConfig map[string]string
CredentialType string
The credential type for the user, can be one of "password", "rsa_private_key" or "client_certificate".The configuration can be done in credential_config.
DbName Changes to this property will trigger replacement. string
The unique name of the database connection to use for the static role.
Name Changes to this property will trigger replacement. string
A unique name to give the static role.
Namespace Changes to this property will trigger replacement. string
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
RotationPeriod int
The amount of time Vault should wait before rotating the password, in seconds. Mutually exclusive with rotation_schedule.
RotationSchedule string

A cron-style string that will define the schedule on which rotations should occur. Mutually exclusive with rotation_period.

Warning: The rotation_period and rotation_schedule fields are mutually exclusive. One of them must be set but not both.

RotationStatements []string
Database statements to execute to rotate the password for the configured database user.
RotationWindow int
The amount of time, in seconds, in which rotations are allowed to occur starting from a given rotation_schedule.
SelfManagedPassword string
The password corresponding to the username in the database. Required when using the Rootless Password Rotation workflow for static roles. Only enabled for select DB engines (Postgres). Requires Vault 1.18+ Enterprise.
SkipImportRotation bool
If set to true, Vault will skip the initial secret rotation on import. Requires Vault 1.18+ Enterprise.
Username Changes to this property will trigger replacement. string
The database username that this static role corresponds to.
backend Changes to this property will trigger replacement. String
The unique name of the Vault mount to configure.
credentialConfig Map<String,String>
credentialType String
The credential type for the user, can be one of "password", "rsa_private_key" or "client_certificate".The configuration can be done in credential_config.
dbName Changes to this property will trigger replacement. String
The unique name of the database connection to use for the static role.
name Changes to this property will trigger replacement. String
A unique name to give the static role.
namespace Changes to this property will trigger replacement. String
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
rotationPeriod Integer
The amount of time Vault should wait before rotating the password, in seconds. Mutually exclusive with rotation_schedule.
rotationSchedule String

A cron-style string that will define the schedule on which rotations should occur. Mutually exclusive with rotation_period.

Warning: The rotation_period and rotation_schedule fields are mutually exclusive. One of them must be set but not both.

rotationStatements List<String>
Database statements to execute to rotate the password for the configured database user.
rotationWindow Integer
The amount of time, in seconds, in which rotations are allowed to occur starting from a given rotation_schedule.
selfManagedPassword String
The password corresponding to the username in the database. Required when using the Rootless Password Rotation workflow for static roles. Only enabled for select DB engines (Postgres). Requires Vault 1.18+ Enterprise.
skipImportRotation Boolean
If set to true, Vault will skip the initial secret rotation on import. Requires Vault 1.18+ Enterprise.
username Changes to this property will trigger replacement. String
The database username that this static role corresponds to.
backend Changes to this property will trigger replacement. string
The unique name of the Vault mount to configure.
credentialConfig {[key: string]: string}
credentialType string
The credential type for the user, can be one of "password", "rsa_private_key" or "client_certificate".The configuration can be done in credential_config.
dbName Changes to this property will trigger replacement. string
The unique name of the database connection to use for the static role.
name Changes to this property will trigger replacement. string
A unique name to give the static role.
namespace Changes to this property will trigger replacement. string
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
rotationPeriod number
The amount of time Vault should wait before rotating the password, in seconds. Mutually exclusive with rotation_schedule.
rotationSchedule string

A cron-style string that will define the schedule on which rotations should occur. Mutually exclusive with rotation_period.

Warning: The rotation_period and rotation_schedule fields are mutually exclusive. One of them must be set but not both.

rotationStatements string[]
Database statements to execute to rotate the password for the configured database user.
rotationWindow number
The amount of time, in seconds, in which rotations are allowed to occur starting from a given rotation_schedule.
selfManagedPassword string
The password corresponding to the username in the database. Required when using the Rootless Password Rotation workflow for static roles. Only enabled for select DB engines (Postgres). Requires Vault 1.18+ Enterprise.
skipImportRotation boolean
If set to true, Vault will skip the initial secret rotation on import. Requires Vault 1.18+ Enterprise.
username Changes to this property will trigger replacement. string
The database username that this static role corresponds to.
backend Changes to this property will trigger replacement. str
The unique name of the Vault mount to configure.
credential_config Mapping[str, str]
credential_type str
The credential type for the user, can be one of "password", "rsa_private_key" or "client_certificate".The configuration can be done in credential_config.
db_name Changes to this property will trigger replacement. str
The unique name of the database connection to use for the static role.
name Changes to this property will trigger replacement. str
A unique name to give the static role.
namespace Changes to this property will trigger replacement. str
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
rotation_period int
The amount of time Vault should wait before rotating the password, in seconds. Mutually exclusive with rotation_schedule.
rotation_schedule str

A cron-style string that will define the schedule on which rotations should occur. Mutually exclusive with rotation_period.

Warning: The rotation_period and rotation_schedule fields are mutually exclusive. One of them must be set but not both.

rotation_statements Sequence[str]
Database statements to execute to rotate the password for the configured database user.
rotation_window int
The amount of time, in seconds, in which rotations are allowed to occur starting from a given rotation_schedule.
self_managed_password str
The password corresponding to the username in the database. Required when using the Rootless Password Rotation workflow for static roles. Only enabled for select DB engines (Postgres). Requires Vault 1.18+ Enterprise.
skip_import_rotation bool
If set to true, Vault will skip the initial secret rotation on import. Requires Vault 1.18+ Enterprise.
username Changes to this property will trigger replacement. str
The database username that this static role corresponds to.
backend Changes to this property will trigger replacement. String
The unique name of the Vault mount to configure.
credentialConfig Map<String>
credentialType String
The credential type for the user, can be one of "password", "rsa_private_key" or "client_certificate".The configuration can be done in credential_config.
dbName Changes to this property will trigger replacement. String
The unique name of the database connection to use for the static role.
name Changes to this property will trigger replacement. String
A unique name to give the static role.
namespace Changes to this property will trigger replacement. String
The namespace to provision the resource in. The value should not contain leading or trailing forward slashes. The namespace is always relative to the provider's configured namespace. Available only for Vault Enterprise.
rotationPeriod Number
The amount of time Vault should wait before rotating the password, in seconds. Mutually exclusive with rotation_schedule.
rotationSchedule String

A cron-style string that will define the schedule on which rotations should occur. Mutually exclusive with rotation_period.

Warning: The rotation_period and rotation_schedule fields are mutually exclusive. One of them must be set but not both.

rotationStatements List<String>
Database statements to execute to rotate the password for the configured database user.
rotationWindow Number
The amount of time, in seconds, in which rotations are allowed to occur starting from a given rotation_schedule.
selfManagedPassword String
The password corresponding to the username in the database. Required when using the Rootless Password Rotation workflow for static roles. Only enabled for select DB engines (Postgres). Requires Vault 1.18+ Enterprise.
skipImportRotation Boolean
If set to true, Vault will skip the initial secret rotation on import. Requires Vault 1.18+ Enterprise.
username Changes to this property will trigger replacement. String
The database username that this static role corresponds to.

Import

Database secret backend static roles can be imported using the backend, /static-roles/, and the name e.g.

$ pulumi import vault:database/secretBackendStaticRole:SecretBackendStaticRole example postgres/static-roles/my-role
Copy

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

Package Details

Repository
Vault pulumi/pulumi-vault
License
Apache-2.0
Notes
This Pulumi package is based on the vault Terraform Provider.