1. Packages
  2. HashiCorp Vault Provider
  3. API Docs
  4. terraformcloud
  5. SecretRole
HashiCorp Vault v6.7.0 published on Thursday, Apr 24, 2025 by Pulumi

vault.terraformcloud.SecretRole

Explore with Pulumi AI

Example Usage

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

const test = new vault.terraformcloud.SecretBackend("test", {
    backend: "terraform",
    description: "Manages the Terraform Cloud backend",
    token: "V0idfhi2iksSDU234ucdbi2nidsi...",
});
const example = new vault.terraformcloud.SecretRole("example", {
    backend: test.backend,
    name: "test-role",
    organization: "example-organization-name",
    teamId: "team-ieF4isC...",
});
Copy
import pulumi
import pulumi_vault as vault

test = vault.terraformcloud.SecretBackend("test",
    backend="terraform",
    description="Manages the Terraform Cloud backend",
    token="V0idfhi2iksSDU234ucdbi2nidsi...")
example = vault.terraformcloud.SecretRole("example",
    backend=test.backend,
    name="test-role",
    organization="example-organization-name",
    team_id="team-ieF4isC...")
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		test, err := terraformcloud.NewSecretBackend(ctx, "test", &terraformcloud.SecretBackendArgs{
			Backend:     pulumi.String("terraform"),
			Description: pulumi.String("Manages the Terraform Cloud backend"),
			Token:       pulumi.String("V0idfhi2iksSDU234ucdbi2nidsi..."),
		})
		if err != nil {
			return err
		}
		_, err = terraformcloud.NewSecretRole(ctx, "example", &terraformcloud.SecretRoleArgs{
			Backend:      test.Backend,
			Name:         pulumi.String("test-role"),
			Organization: pulumi.String("example-organization-name"),
			TeamId:       pulumi.String("team-ieF4isC..."),
		})
		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 test = new Vault.TerraformCloud.SecretBackend("test", new()
    {
        Backend = "terraform",
        Description = "Manages the Terraform Cloud backend",
        Token = "V0idfhi2iksSDU234ucdbi2nidsi...",
    });

    var example = new Vault.TerraformCloud.SecretRole("example", new()
    {
        Backend = test.Backend,
        Name = "test-role",
        Organization = "example-organization-name",
        TeamId = "team-ieF4isC...",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vault.terraformcloud.SecretBackend;
import com.pulumi.vault.terraformcloud.SecretBackendArgs;
import com.pulumi.vault.terraformcloud.SecretRole;
import com.pulumi.vault.terraformcloud.SecretRoleArgs;
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 test = new SecretBackend("test", SecretBackendArgs.builder()
            .backend("terraform")
            .description("Manages the Terraform Cloud backend")
            .token("V0idfhi2iksSDU234ucdbi2nidsi...")
            .build());

        var example = new SecretRole("example", SecretRoleArgs.builder()
            .backend(test.backend())
            .name("test-role")
            .organization("example-organization-name")
            .teamId("team-ieF4isC...")
            .build());

    }
}
Copy
resources:
  test:
    type: vault:terraformcloud:SecretBackend
    properties:
      backend: terraform
      description: Manages the Terraform Cloud backend
      token: V0idfhi2iksSDU234ucdbi2nidsi...
  example:
    type: vault:terraformcloud:SecretRole
    properties:
      backend: ${test.backend}
      name: test-role
      organization: example-organization-name
      teamId: team-ieF4isC...
Copy

Create SecretRole Resource

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

Constructor syntax

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

@overload
def SecretRole(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               backend: Optional[str] = None,
               max_ttl: Optional[int] = None,
               name: Optional[str] = None,
               namespace: Optional[str] = None,
               organization: Optional[str] = None,
               team_id: Optional[str] = None,
               ttl: Optional[int] = None,
               user_id: Optional[str] = None)
func NewSecretRole(ctx *Context, name string, args *SecretRoleArgs, opts ...ResourceOption) (*SecretRole, error)
public SecretRole(string name, SecretRoleArgs? args = null, CustomResourceOptions? opts = null)
public SecretRole(String name, SecretRoleArgs args)
public SecretRole(String name, SecretRoleArgs args, CustomResourceOptions options)
type: vault:terraformcloud:SecretRole
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 SecretRoleArgs
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 SecretRoleArgs
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 SecretRoleArgs
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 SecretRoleArgs
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. SecretRoleArgs
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 examplesecretRoleResourceResourceFromTerraformcloudsecretRole = new Vault.TerraformCloud.SecretRole("examplesecretRoleResourceResourceFromTerraformcloudsecretRole", new()
{
    Backend = "string",
    MaxTtl = 0,
    Name = "string",
    Namespace = "string",
    Organization = "string",
    TeamId = "string",
    Ttl = 0,
    UserId = "string",
});
Copy
example, err := terraformcloud.NewSecretRole(ctx, "examplesecretRoleResourceResourceFromTerraformcloudsecretRole", &terraformcloud.SecretRoleArgs{
	Backend:      pulumi.String("string"),
	MaxTtl:       pulumi.Int(0),
	Name:         pulumi.String("string"),
	Namespace:    pulumi.String("string"),
	Organization: pulumi.String("string"),
	TeamId:       pulumi.String("string"),
	Ttl:          pulumi.Int(0),
	UserId:       pulumi.String("string"),
})
Copy
var examplesecretRoleResourceResourceFromTerraformcloudsecretRole = new com.pulumi.vault.terraformcloud.SecretRole("examplesecretRoleResourceResourceFromTerraformcloudsecretRole", com.pulumi.vault.terraformcloud.SecretRoleArgs.builder()
    .backend("string")
    .maxTtl(0)
    .name("string")
    .namespace("string")
    .organization("string")
    .teamId("string")
    .ttl(0)
    .userId("string")
    .build());
Copy
examplesecret_role_resource_resource_from_terraformcloudsecret_role = vault.terraformcloud.SecretRole("examplesecretRoleResourceResourceFromTerraformcloudsecretRole",
    backend="string",
    max_ttl=0,
    name="string",
    namespace="string",
    organization="string",
    team_id="string",
    ttl=0,
    user_id="string")
Copy
const examplesecretRoleResourceResourceFromTerraformcloudsecretRole = new vault.terraformcloud.SecretRole("examplesecretRoleResourceResourceFromTerraformcloudsecretRole", {
    backend: "string",
    maxTtl: 0,
    name: "string",
    namespace: "string",
    organization: "string",
    teamId: "string",
    ttl: 0,
    userId: "string",
});
Copy
type: vault:terraformcloud:SecretRole
properties:
    backend: string
    maxTtl: 0
    name: string
    namespace: string
    organization: string
    teamId: string
    ttl: 0
    userId: string
Copy

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

Backend Changes to this property will trigger replacement. string
MaxTtl int
Maximum TTL for leases associated with this role, in seconds.
Name Changes to this property will trigger replacement. string
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.
Organization string
TeamId string
Ttl int
Specifies the TTL for this role, in seconds.
UserId string
Backend Changes to this property will trigger replacement. string
MaxTtl int
Maximum TTL for leases associated with this role, in seconds.
Name Changes to this property will trigger replacement. string
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.
Organization string
TeamId string
Ttl int
Specifies the TTL for this role, in seconds.
UserId string
backend Changes to this property will trigger replacement. String
maxTtl Integer
Maximum TTL for leases associated with this role, in seconds.
name Changes to this property will trigger replacement. String
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.
organization String
teamId String
ttl Integer
Specifies the TTL for this role, in seconds.
userId String
backend Changes to this property will trigger replacement. string
maxTtl number
Maximum TTL for leases associated with this role, in seconds.
name Changes to this property will trigger replacement. string
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.
organization string
teamId string
ttl number
Specifies the TTL for this role, in seconds.
userId string
backend Changes to this property will trigger replacement. str
max_ttl int
Maximum TTL for leases associated with this role, in seconds.
name Changes to this property will trigger replacement. str
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.
organization str
team_id str
ttl int
Specifies the TTL for this role, in seconds.
user_id str
backend Changes to this property will trigger replacement. String
maxTtl Number
Maximum TTL for leases associated with this role, in seconds.
name Changes to this property will trigger replacement. String
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.
organization String
teamId String
ttl Number
Specifies the TTL for this role, in seconds.
userId String

Outputs

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

Get an existing SecretRole 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?: SecretRoleState, opts?: CustomResourceOptions): SecretRole
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        backend: Optional[str] = None,
        max_ttl: Optional[int] = None,
        name: Optional[str] = None,
        namespace: Optional[str] = None,
        organization: Optional[str] = None,
        team_id: Optional[str] = None,
        ttl: Optional[int] = None,
        user_id: Optional[str] = None) -> SecretRole
func GetSecretRole(ctx *Context, name string, id IDInput, state *SecretRoleState, opts ...ResourceOption) (*SecretRole, error)
public static SecretRole Get(string name, Input<string> id, SecretRoleState? state, CustomResourceOptions? opts = null)
public static SecretRole get(String name, Output<String> id, SecretRoleState state, CustomResourceOptions options)
resources:  _:    type: vault:terraformcloud:SecretRole    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
MaxTtl int
Maximum TTL for leases associated with this role, in seconds.
Name Changes to this property will trigger replacement. string
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.
Organization string
TeamId string
Ttl int
Specifies the TTL for this role, in seconds.
UserId string
Backend Changes to this property will trigger replacement. string
MaxTtl int
Maximum TTL for leases associated with this role, in seconds.
Name Changes to this property will trigger replacement. string
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.
Organization string
TeamId string
Ttl int
Specifies the TTL for this role, in seconds.
UserId string
backend Changes to this property will trigger replacement. String
maxTtl Integer
Maximum TTL for leases associated with this role, in seconds.
name Changes to this property will trigger replacement. String
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.
organization String
teamId String
ttl Integer
Specifies the TTL for this role, in seconds.
userId String
backend Changes to this property will trigger replacement. string
maxTtl number
Maximum TTL for leases associated with this role, in seconds.
name Changes to this property will trigger replacement. string
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.
organization string
teamId string
ttl number
Specifies the TTL for this role, in seconds.
userId string
backend Changes to this property will trigger replacement. str
max_ttl int
Maximum TTL for leases associated with this role, in seconds.
name Changes to this property will trigger replacement. str
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.
organization str
team_id str
ttl int
Specifies the TTL for this role, in seconds.
user_id str
backend Changes to this property will trigger replacement. String
maxTtl Number
Maximum TTL for leases associated with this role, in seconds.
name Changes to this property will trigger replacement. String
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.
organization String
teamId String
ttl Number
Specifies the TTL for this role, in seconds.
userId String

Import

Terraform Cloud secret backend roles can be imported using the backend, /roles/, and the name e.g.

$ pulumi import vault:terraformcloud/secretRole:SecretRole example terraform/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.