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

vault.appRole.getAuthBackendRoleId

Explore with Pulumi AI

HashiCorp Vault v6.6.0 published on Thursday, Mar 13, 2025 by Pulumi

Reads the Role ID of an AppRole from a Vault server.

Example Usage

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

export = async () => {
    const role = await vault.appRole.getAuthBackendRoleId({
        backend: "my-approle-backend",
        roleName: "my-role",
    });
    return {
        "role-id": role.roleId,
    };
}
Copy
import pulumi
import pulumi_vault as vault

role = vault.appRole.get_auth_backend_role_id(backend="my-approle-backend",
    role_name="my-role")
pulumi.export("role-id", role.role_id)
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		role, err := approle.GetAuthBackendRoleId(ctx, &approle.GetAuthBackendRoleIdArgs{
			Backend:  pulumi.StringRef("my-approle-backend"),
			RoleName: "my-role",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("role-id", role.RoleId)
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vault = Pulumi.Vault;

return await Deployment.RunAsync(() => 
{
    var role = Vault.AppRole.GetAuthBackendRoleId.Invoke(new()
    {
        Backend = "my-approle-backend",
        RoleName = "my-role",
    });

    return new Dictionary<string, object?>
    {
        ["role-id"] = role.Apply(getAuthBackendRoleIdResult => getAuthBackendRoleIdResult.RoleId),
    };
});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vault.appRole.AppRoleFunctions;
import com.pulumi.vault.appRole.inputs.GetAuthBackendRoleIdArgs;
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 role = AppRoleFunctions.getAuthBackendRoleId(GetAuthBackendRoleIdArgs.builder()
            .backend("my-approle-backend")
            .roleName("my-role")
            .build());

        ctx.export("role-id", role.applyValue(getAuthBackendRoleIdResult -> getAuthBackendRoleIdResult.roleId()));
    }
}
Copy
variables:
  role:
    fn::invoke:
      function: vault:appRole:getAuthBackendRoleId
      arguments:
        backend: my-approle-backend
        roleName: my-role
outputs:
  role-id: ${role.roleId}
Copy

Using getAuthBackendRoleId

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 getAuthBackendRoleId(args: GetAuthBackendRoleIdArgs, opts?: InvokeOptions): Promise<GetAuthBackendRoleIdResult>
function getAuthBackendRoleIdOutput(args: GetAuthBackendRoleIdOutputArgs, opts?: InvokeOptions): Output<GetAuthBackendRoleIdResult>
Copy
def get_auth_backend_role_id(backend: Optional[str] = None,
                             namespace: Optional[str] = None,
                             role_name: Optional[str] = None,
                             opts: Optional[InvokeOptions] = None) -> GetAuthBackendRoleIdResult
def get_auth_backend_role_id_output(backend: Optional[pulumi.Input[str]] = None,
                             namespace: Optional[pulumi.Input[str]] = None,
                             role_name: Optional[pulumi.Input[str]] = None,
                             opts: Optional[InvokeOptions] = None) -> Output[GetAuthBackendRoleIdResult]
Copy
func GetAuthBackendRoleId(ctx *Context, args *GetAuthBackendRoleIdArgs, opts ...InvokeOption) (*GetAuthBackendRoleIdResult, error)
func GetAuthBackendRoleIdOutput(ctx *Context, args *GetAuthBackendRoleIdOutputArgs, opts ...InvokeOption) GetAuthBackendRoleIdResultOutput
Copy

> Note: This function is named GetAuthBackendRoleId in the Go SDK.

public static class GetAuthBackendRoleId 
{
    public static Task<GetAuthBackendRoleIdResult> InvokeAsync(GetAuthBackendRoleIdArgs args, InvokeOptions? opts = null)
    public static Output<GetAuthBackendRoleIdResult> Invoke(GetAuthBackendRoleIdInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetAuthBackendRoleIdResult> getAuthBackendRoleId(GetAuthBackendRoleIdArgs args, InvokeOptions options)
public static Output<GetAuthBackendRoleIdResult> getAuthBackendRoleId(GetAuthBackendRoleIdArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: vault:appRole/getAuthBackendRoleId:getAuthBackendRoleId
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

RoleName
This property is required.
Changes to this property will trigger replacement.
string
The name of the role to retrieve the Role ID for.
Backend Changes to this property will trigger replacement. string
The unique name for the AppRole backend the role to retrieve a RoleID for resides in. Defaults to "approle".
Namespace Changes to this property will trigger replacement. string
The namespace of the target resource. 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.
RoleName
This property is required.
Changes to this property will trigger replacement.
string
The name of the role to retrieve the Role ID for.
Backend Changes to this property will trigger replacement. string
The unique name for the AppRole backend the role to retrieve a RoleID for resides in. Defaults to "approle".
Namespace Changes to this property will trigger replacement. string
The namespace of the target resource. 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.
roleName
This property is required.
Changes to this property will trigger replacement.
String
The name of the role to retrieve the Role ID for.
backend Changes to this property will trigger replacement. String
The unique name for the AppRole backend the role to retrieve a RoleID for resides in. Defaults to "approle".
namespace Changes to this property will trigger replacement. String
The namespace of the target resource. 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.
roleName
This property is required.
Changes to this property will trigger replacement.
string
The name of the role to retrieve the Role ID for.
backend Changes to this property will trigger replacement. string
The unique name for the AppRole backend the role to retrieve a RoleID for resides in. Defaults to "approle".
namespace Changes to this property will trigger replacement. string
The namespace of the target resource. 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.
role_name
This property is required.
Changes to this property will trigger replacement.
str
The name of the role to retrieve the Role ID for.
backend Changes to this property will trigger replacement. str
The unique name for the AppRole backend the role to retrieve a RoleID for resides in. Defaults to "approle".
namespace Changes to this property will trigger replacement. str
The namespace of the target resource. 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.
roleName
This property is required.
Changes to this property will trigger replacement.
String
The name of the role to retrieve the Role ID for.
backend Changes to this property will trigger replacement. String
The unique name for the AppRole backend the role to retrieve a RoleID for resides in. Defaults to "approle".
namespace Changes to this property will trigger replacement. String
The namespace of the target resource. 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.

getAuthBackendRoleId Result

The following output properties are available:

Id string
The provider-assigned unique ID for this managed resource.
RoleId string
The RoleID of the role.
RoleName string
Backend string
Namespace string
Id string
The provider-assigned unique ID for this managed resource.
RoleId string
The RoleID of the role.
RoleName string
Backend string
Namespace string
id String
The provider-assigned unique ID for this managed resource.
roleId String
The RoleID of the role.
roleName String
backend String
namespace String
id string
The provider-assigned unique ID for this managed resource.
roleId string
The RoleID of the role.
roleName string
backend string
namespace string
id str
The provider-assigned unique ID for this managed resource.
role_id str
The RoleID of the role.
role_name str
backend str
namespace str
id String
The provider-assigned unique ID for this managed resource.
roleId String
The RoleID of the role.
roleName String
backend String
namespace String

Package Details

Repository
Vault pulumi/pulumi-vault
License
Apache-2.0
Notes
This Pulumi package is based on the vault Terraform Provider.
HashiCorp Vault v6.6.0 published on Thursday, Mar 13, 2025 by Pulumi