Oracle Cloud Infrastructure v3.9.0 published on Wednesday, Sep 24, 2025 by Pulumi
oci.Core.getInstanceCredentials
This data source provides details about a specific Instance Credential resource in Oracle Cloud Infrastructure Core service.
Gets the generated credentials for the instance. Only works for instances that require a password to log in, such as Windows. For certain operating systems, users will be forced to change the initial credentials.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as oci from "@pulumi/oci";
const testInstanceCredential = oci.Core.getInstanceCredentials({
    instanceId: testInstance.id,
});
import pulumi
import pulumi_oci as oci
test_instance_credential = oci.Core.get_instance_credentials(instance_id=test_instance["id"])
package main
import (
	"github.com/pulumi/pulumi-oci/sdk/v3/go/oci/core"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := core.GetInstanceCredentials(ctx, &core.GetInstanceCredentialsArgs{
			InstanceId: testInstance.Id,
		}, 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 testInstanceCredential = Oci.Core.GetInstanceCredentials.Invoke(new()
    {
        InstanceId = testInstance.Id,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.oci.Core.CoreFunctions;
import com.pulumi.oci.Core.inputs.GetInstanceCredentialsArgs;
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 testInstanceCredential = CoreFunctions.getInstanceCredentials(GetInstanceCredentialsArgs.builder()
            .instanceId(testInstance.id())
            .build());
    }
}
variables:
  testInstanceCredential:
    fn::invoke:
      function: oci:Core:getInstanceCredentials
      arguments:
        instanceId: ${testInstance.id}
Using getInstanceCredentials
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 getInstanceCredentials(args: GetInstanceCredentialsArgs, opts?: InvokeOptions): Promise<GetInstanceCredentialsResult>
function getInstanceCredentialsOutput(args: GetInstanceCredentialsOutputArgs, opts?: InvokeOptions): Output<GetInstanceCredentialsResult>def get_instance_credentials(instance_id: Optional[str] = None,
                             opts: Optional[InvokeOptions] = None) -> GetInstanceCredentialsResult
def get_instance_credentials_output(instance_id: Optional[pulumi.Input[str]] = None,
                             opts: Optional[InvokeOptions] = None) -> Output[GetInstanceCredentialsResult]func GetInstanceCredentials(ctx *Context, args *GetInstanceCredentialsArgs, opts ...InvokeOption) (*GetInstanceCredentialsResult, error)
func GetInstanceCredentialsOutput(ctx *Context, args *GetInstanceCredentialsOutputArgs, opts ...InvokeOption) GetInstanceCredentialsResultOutput> Note: This function is named GetInstanceCredentials in the Go SDK.
public static class GetInstanceCredentials 
{
    public static Task<GetInstanceCredentialsResult> InvokeAsync(GetInstanceCredentialsArgs args, InvokeOptions? opts = null)
    public static Output<GetInstanceCredentialsResult> Invoke(GetInstanceCredentialsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetInstanceCredentialsResult> getInstanceCredentials(GetInstanceCredentialsArgs args, InvokeOptions options)
public static Output<GetInstanceCredentialsResult> getInstanceCredentials(GetInstanceCredentialsArgs args, InvokeOptions options)
fn::invoke:
  function: oci:Core/getInstanceCredentials:getInstanceCredentials
  arguments:
    # arguments dictionaryThe following arguments are supported:
- InstanceId string
- The OCID of the instance.
- InstanceId string
- The OCID of the instance.
- instanceId String
- The OCID of the instance.
- instanceId string
- The OCID of the instance.
- instance_id str
- The OCID of the instance.
- instanceId String
- The OCID of the instance.
getInstanceCredentials Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- InstanceId string
- Password string
- The password for the username.
- Username string
- The username.
- Id string
- The provider-assigned unique ID for this managed resource.
- InstanceId string
- Password string
- The password for the username.
- Username string
- The username.
- id String
- The provider-assigned unique ID for this managed resource.
- instanceId String
- password String
- The password for the username.
- username String
- The username.
- id string
- The provider-assigned unique ID for this managed resource.
- instanceId string
- password string
- The password for the username.
- username string
- The username.
- id str
- The provider-assigned unique ID for this managed resource.
- instance_id str
- password str
- The password for the username.
- username str
- The username.
- id String
- The provider-assigned unique ID for this managed resource.
- instanceId String
- password String
- The password for the username.
- username String
- The username.
Package Details
- Repository
- oci pulumi/pulumi-oci
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the ociTerraform Provider.
