Oracle Cloud Infrastructure v2.33.0 published on Thursday, May 1, 2025 by Pulumi
oci.Identity.getDbCredentials
Explore with Pulumi AI
This data source provides the list of Db Credentials in Oracle Cloud Infrastructure Identity service.
Lists the DB credentials for the specified user. The returned object contains the credential’s OCID
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as oci from "@pulumi/oci";
const testDbCredentials = oci.Identity.getDbCredentials({
    userId: testUser.id,
    name: dbCredentialName,
    state: dbCredentialState,
});
import pulumi
import pulumi_oci as oci
test_db_credentials = oci.Identity.get_db_credentials(user_id=test_user["id"],
    name=db_credential_name,
    state=db_credential_state)
package main
import (
	"github.com/pulumi/pulumi-oci/sdk/v2/go/oci/identity"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := identity.GetDbCredentials(ctx, &identity.GetDbCredentialsArgs{
			UserId: testUser.Id,
			Name:   pulumi.StringRef(dbCredentialName),
			State:  pulumi.StringRef(dbCredentialState),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Oci = Pulumi.Oci;
return await Deployment.RunAsync(() => 
{
    var testDbCredentials = Oci.Identity.GetDbCredentials.Invoke(new()
    {
        UserId = testUser.Id,
        Name = dbCredentialName,
        State = dbCredentialState,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.oci.Identity.IdentityFunctions;
import com.pulumi.oci.Identity.inputs.GetDbCredentialsArgs;
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) {
        final var testDbCredentials = IdentityFunctions.getDbCredentials(GetDbCredentialsArgs.builder()
            .userId(testUser.id())
            .name(dbCredentialName)
            .state(dbCredentialState)
            .build());
    }
}
variables:
  testDbCredentials:
    fn::invoke:
      function: oci:Identity:getDbCredentials
      arguments:
        userId: ${testUser.id}
        name: ${dbCredentialName}
        state: ${dbCredentialState}
Using getDbCredentials
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getDbCredentials(args: GetDbCredentialsArgs, opts?: InvokeOptions): Promise<GetDbCredentialsResult>
function getDbCredentialsOutput(args: GetDbCredentialsOutputArgs, opts?: InvokeOptions): Output<GetDbCredentialsResult>def get_db_credentials(filters: Optional[Sequence[GetDbCredentialsFilter]] = None,
                       name: Optional[str] = None,
                       state: Optional[str] = None,
                       user_id: Optional[str] = None,
                       opts: Optional[InvokeOptions] = None) -> GetDbCredentialsResult
def get_db_credentials_output(filters: Optional[pulumi.Input[Sequence[pulumi.Input[GetDbCredentialsFilterArgs]]]] = None,
                       name: Optional[pulumi.Input[str]] = None,
                       state: Optional[pulumi.Input[str]] = None,
                       user_id: Optional[pulumi.Input[str]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetDbCredentialsResult]func GetDbCredentials(ctx *Context, args *GetDbCredentialsArgs, opts ...InvokeOption) (*GetDbCredentialsResult, error)
func GetDbCredentialsOutput(ctx *Context, args *GetDbCredentialsOutputArgs, opts ...InvokeOption) GetDbCredentialsResultOutput> Note: This function is named GetDbCredentials in the Go SDK.
public static class GetDbCredentials 
{
    public static Task<GetDbCredentialsResult> InvokeAsync(GetDbCredentialsArgs args, InvokeOptions? opts = null)
    public static Output<GetDbCredentialsResult> Invoke(GetDbCredentialsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetDbCredentialsResult> getDbCredentials(GetDbCredentialsArgs args, InvokeOptions options)
public static Output<GetDbCredentialsResult> getDbCredentials(GetDbCredentialsArgs args, InvokeOptions options)
fn::invoke:
  function: oci:Identity/getDbCredentials:getDbCredentials
  arguments:
    # arguments dictionaryThe following arguments are supported:
- UserId string
- The OCID of the user.
- Filters
List<GetDb Credentials Filter> 
- Name string
- A filter to only return resources that match the given name exactly.
- State string
- A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
- UserId string
- The OCID of the user.
- Filters
[]GetDb Credentials Filter 
- Name string
- A filter to only return resources that match the given name exactly.
- State string
- A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
- userId String
- The OCID of the user.
- filters
List<GetDb Credentials Filter> 
- name String
- A filter to only return resources that match the given name exactly.
- state String
- A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
- userId string
- The OCID of the user.
- filters
GetDb Credentials Filter[] 
- name string
- A filter to only return resources that match the given name exactly.
- state string
- A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
- user_id str
- The OCID of the user.
- filters
Sequence[GetDb Credentials Filter] 
- name str
- A filter to only return resources that match the given name exactly.
- state str
- A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
- userId String
- The OCID of the user.
- filters List<Property Map>
- name String
- A filter to only return resources that match the given name exactly.
- state String
- A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
getDbCredentials Result
The following output properties are available:
- DbCredentials List<GetDb Credentials Db Credential> 
- The list of db_credentials.
- Id string
- The provider-assigned unique ID for this managed resource.
- UserId string
- The OCID of the user the DB credential belongs to.
- Filters
List<GetDb Credentials Filter> 
- Name string
- State string
- The credential's current state. After creating a DB credential, make sure its lifecycleStatechanges from CREATING to ACTIVE before using it.
- DbCredentials []GetDb Credentials Db Credential 
- The list of db_credentials.
- Id string
- The provider-assigned unique ID for this managed resource.
- UserId string
- The OCID of the user the DB credential belongs to.
- Filters
[]GetDb Credentials Filter 
- Name string
- State string
- The credential's current state. After creating a DB credential, make sure its lifecycleStatechanges from CREATING to ACTIVE before using it.
- dbCredentials List<GetDb Credentials Db Credential> 
- The list of db_credentials.
- id String
- The provider-assigned unique ID for this managed resource.
- userId String
- The OCID of the user the DB credential belongs to.
- filters
List<GetDb Credentials Filter> 
- name String
- state String
- The credential's current state. After creating a DB credential, make sure its lifecycleStatechanges from CREATING to ACTIVE before using it.
- dbCredentials GetDb Credentials Db Credential[] 
- The list of db_credentials.
- id string
- The provider-assigned unique ID for this managed resource.
- userId string
- The OCID of the user the DB credential belongs to.
- filters
GetDb Credentials Filter[] 
- name string
- state string
- The credential's current state. After creating a DB credential, make sure its lifecycleStatechanges from CREATING to ACTIVE before using it.
- db_credentials Sequence[GetDb Credentials Db Credential] 
- The list of db_credentials.
- id str
- The provider-assigned unique ID for this managed resource.
- user_id str
- The OCID of the user the DB credential belongs to.
- filters
Sequence[GetDb Credentials Filter] 
- name str
- state str
- The credential's current state. After creating a DB credential, make sure its lifecycleStatechanges from CREATING to ACTIVE before using it.
- dbCredentials List<Property Map>
- The list of db_credentials.
- id String
- The provider-assigned unique ID for this managed resource.
- userId String
- The OCID of the user the DB credential belongs to.
- filters List<Property Map>
- name String
- state String
- The credential's current state. After creating a DB credential, make sure its lifecycleStatechanges from CREATING to ACTIVE before using it.
Supporting Types
GetDbCredentialsDbCredential    
- Description string
- The description you assign to the DB credential. Does not have to be unique, and it's changeable.
- Id string
- The OCID of the DB credential.
- LifecycleDetails string
- Password string
- State string
- A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
- TimeCreated string
- Date and time the DbCredentialobject was created, in the format defined by RFC3339. Example:2016-08-25T21:10:29.600Z
- TimeExpires string
- Date and time when this credential will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
- UserId string
- The OCID of the user.
- Description string
- The description you assign to the DB credential. Does not have to be unique, and it's changeable.
- Id string
- The OCID of the DB credential.
- LifecycleDetails string
- Password string
- State string
- A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
- TimeCreated string
- Date and time the DbCredentialobject was created, in the format defined by RFC3339. Example:2016-08-25T21:10:29.600Z
- TimeExpires string
- Date and time when this credential will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
- UserId string
- The OCID of the user.
- description String
- The description you assign to the DB credential. Does not have to be unique, and it's changeable.
- id String
- The OCID of the DB credential.
- lifecycleDetails String
- password String
- state String
- A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
- timeCreated String
- Date and time the DbCredentialobject was created, in the format defined by RFC3339. Example:2016-08-25T21:10:29.600Z
- timeExpires String
- Date and time when this credential will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
- userId String
- The OCID of the user.
- description string
- The description you assign to the DB credential. Does not have to be unique, and it's changeable.
- id string
- The OCID of the DB credential.
- lifecycleDetails string
- password string
- state string
- A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
- timeCreated string
- Date and time the DbCredentialobject was created, in the format defined by RFC3339. Example:2016-08-25T21:10:29.600Z
- timeExpires string
- Date and time when this credential will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
- userId string
- The OCID of the user.
- description str
- The description you assign to the DB credential. Does not have to be unique, and it's changeable.
- id str
- The OCID of the DB credential.
- lifecycle_details str
- password str
- state str
- A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
- time_created str
- Date and time the DbCredentialobject was created, in the format defined by RFC3339. Example:2016-08-25T21:10:29.600Z
- time_expires str
- Date and time when this credential will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
- user_id str
- The OCID of the user.
- description String
- The description you assign to the DB credential. Does not have to be unique, and it's changeable.
- id String
- The OCID of the DB credential.
- lifecycleDetails String
- password String
- state String
- A filter to only return resources that match the given lifecycle state. The state value is case-insensitive.
- timeCreated String
- Date and time the DbCredentialobject was created, in the format defined by RFC3339. Example:2016-08-25T21:10:29.600Z
- timeExpires String
- Date and time when this credential will expire, in the format defined by RFC3339. Null if it never expires. Example: 2016-08-25T21:10:29.600Z
- userId String
- The OCID of the user.
GetDbCredentialsFilter   
Package Details
- Repository
- oci pulumi/pulumi-oci
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the ociTerraform Provider.