AuthBackendRole

class AuthBackendRole : KotlinCustomResource

Manages an AWS auth backend role in a Vault server. Roles constrain the instances or principals that can perform the login operation against the backend. See the [Vault

  • documentation](https://www.vaultproject.io/docs/auth/aws.html) for more information.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as vault from "@pulumi/vault";
const aws = new vault.AuthBackend("aws", {type: "aws"});
const example = new vault.aws.AuthBackendRole("example", {
backend: aws.path,
role: "test-role",
authType: "iam",
boundAmiIds: ["ami-8c1be5f6"],
boundAccountIds: ["123456789012"],
boundVpcIds: ["vpc-b61106d4"],
boundSubnetIds: ["vpc-133128f1"],
boundIamRoleArns: ["arn:aws:iam::123456789012:role/MyRole"],
boundIamInstanceProfileArns: ["arn:aws:iam::123456789012:instance-profile/MyProfile"],
inferredEntityType: "ec2_instance",
inferredAwsRegion: "us-east-1",
tokenTtl: 60,
tokenMaxTtl: 120,
tokenPolicies: [
"default",
"dev",
"prod",
],
});
import pulumi
import pulumi_vault as vault
aws = vault.AuthBackend("aws", type="aws")
example = vault.aws.AuthBackendRole("example",
backend=aws.path,
role="test-role",
auth_type="iam",
bound_ami_ids=["ami-8c1be5f6"],
bound_account_ids=["123456789012"],
bound_vpc_ids=["vpc-b61106d4"],
bound_subnet_ids=["vpc-133128f1"],
bound_iam_role_arns=["arn:aws:iam::123456789012:role/MyRole"],
bound_iam_instance_profile_arns=["arn:aws:iam::123456789012:instance-profile/MyProfile"],
inferred_entity_type="ec2_instance",
inferred_aws_region="us-east-1",
token_ttl=60,
token_max_ttl=120,
token_policies=[
"default",
"dev",
"prod",
])
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vault = Pulumi.Vault;
return await Deployment.RunAsync(() =>
{
var aws = new Vault.AuthBackend("aws", new()
{
Type = "aws",
});
var example = new Vault.Aws.AuthBackendRole("example", new()
{
Backend = aws.Path,
Role = "test-role",
AuthType = "iam",
BoundAmiIds = new[]
{
"ami-8c1be5f6",
},
BoundAccountIds = new[]
{
"123456789012",
},
BoundVpcIds = new[]
{
"vpc-b61106d4",
},
BoundSubnetIds = new[]
{
"vpc-133128f1",
},
BoundIamRoleArns = new[]
{
"arn:aws:iam::123456789012:role/MyRole",
},
BoundIamInstanceProfileArns = new[]
{
"arn:aws:iam::123456789012:instance-profile/MyProfile",
},
InferredEntityType = "ec2_instance",
InferredAwsRegion = "us-east-1",
TokenTtl = 60,
TokenMaxTtl = 120,
TokenPolicies = new[]
{
"default",
"dev",
"prod",
},
});
});
package main
import (
"github.com/pulumi/pulumi-vault/sdk/v6/go/vault"
"github.com/pulumi/pulumi-vault/sdk/v6/go/vault/aws"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
aws, err := vault.NewAuthBackend(ctx, "aws", &vault.AuthBackendArgs{
Type: pulumi.String("aws"),
})
if err != nil {
return err
}
_, err = aws.NewAuthBackendRole(ctx, "example", &aws.AuthBackendRoleArgs{
Backend: aws.Path,
Role: pulumi.String("test-role"),
AuthType: pulumi.String("iam"),
BoundAmiIds: pulumi.StringArray{
pulumi.String("ami-8c1be5f6"),
},
BoundAccountIds: pulumi.StringArray{
pulumi.String("123456789012"),
},
BoundVpcIds: pulumi.StringArray{
pulumi.String("vpc-b61106d4"),
},
BoundSubnetIds: pulumi.StringArray{
pulumi.String("vpc-133128f1"),
},
BoundIamRoleArns: pulumi.StringArray{
pulumi.String("arn:aws:iam::123456789012:role/MyRole"),
},
BoundIamInstanceProfileArns: pulumi.StringArray{
pulumi.String("arn:aws:iam::123456789012:instance-profile/MyProfile"),
},
InferredEntityType: pulumi.String("ec2_instance"),
InferredAwsRegion: pulumi.String("us-east-1"),
TokenTtl: pulumi.Int(60),
TokenMaxTtl: pulumi.Int(120),
TokenPolicies: pulumi.StringArray{
pulumi.String("default"),
pulumi.String("dev"),
pulumi.String("prod"),
},
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vault.AuthBackend;
import com.pulumi.vault.AuthBackendArgs;
import com.pulumi.vault.aws.AuthBackendRole;
import com.pulumi.vault.aws.AuthBackendRoleArgs;
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 aws = new AuthBackend("aws", AuthBackendArgs.builder()
.type("aws")
.build());
var example = new AuthBackendRole("example", AuthBackendRoleArgs.builder()
.backend(aws.path())
.role("test-role")
.authType("iam")
.boundAmiIds("ami-8c1be5f6")
.boundAccountIds("123456789012")
.boundVpcIds("vpc-b61106d4")
.boundSubnetIds("vpc-133128f1")
.boundIamRoleArns("arn:aws:iam::123456789012:role/MyRole")
.boundIamInstanceProfileArns("arn:aws:iam::123456789012:instance-profile/MyProfile")
.inferredEntityType("ec2_instance")
.inferredAwsRegion("us-east-1")
.tokenTtl(60)
.tokenMaxTtl(120)
.tokenPolicies(
"default",
"dev",
"prod")
.build());
}
}
resources:
aws:
type: vault:AuthBackend
properties:
type: aws
example:
type: vault:aws:AuthBackendRole
properties:
backend: ${aws.path}
role: test-role
authType: iam
boundAmiIds:
- ami-8c1be5f6
boundAccountIds:
- '123456789012'
boundVpcIds:
- vpc-b61106d4
boundSubnetIds:
- vpc-133128f1
boundIamRoleArns:
- arn:aws:iam::123456789012:role/MyRole
boundIamInstanceProfileArns:
- arn:aws:iam::123456789012:instance-profile/MyProfile
inferredEntityType: ec2_instance
inferredAwsRegion: us-east-1
tokenTtl: 60
tokenMaxTtl: 120
tokenPolicies:
- default
- dev
- prod

Import

AWS auth backend roles can be imported using auth/, the backend path, /role/, and the role name e.g.

$ pulumi import vault:aws/authBackendRole:AuthBackendRole example auth/aws/role/test-role

Properties

Link copied to clipboard

If set to true, allows migration of the underlying instance where the client resides.

Link copied to clipboard
val authType: Output<String>?

The auth type permitted for this role. Valid choices are ec2 and iam. Defaults to iam.

Link copied to clipboard
val backend: Output<String>?

Path to the mounted aws auth backend.

Link copied to clipboard
val boundAccountIds: Output<List<String>>?

If set, defines a constraint on the EC2 instances that can perform the login operation that they should be using the account ID specified by this field. auth_type must be set to ec2 or inferred_entity_type must be set to ec2_instance to use this constraint.

Link copied to clipboard
val boundAmiIds: Output<List<String>>?

If set, defines a constraint on the EC2 instances that can perform the login operation that they should be using the AMI ID specified by this field. auth_type must be set to ec2 or inferred_entity_type must be set to ec2_instance to use this constraint.

Link copied to clipboard

Only EC2 instances that match this instance ID will be permitted to log in.

Link copied to clipboard

If set, defines a constraint on the EC2 instances that can perform the login operation that they must be associated with an IAM instance profile ARN which has a prefix that matches the value specified by this field. The value is prefix-matched as though it were a glob ending in *. auth_type must be set to ec2 or inferred_entity_type must be set to ec2_instance to use this constraint.

Link copied to clipboard

If set, defines the IAM principal that must be authenticated when auth_type is set to iam. Wildcards are supported at the end of the ARN.

Link copied to clipboard

If set, defines a constraint on the EC2 instances that can perform the login operation that they must match the IAM role ARN specified by this field. auth_type must be set to ec2 or inferred_entity_type must be set to ec2_instance to use this constraint.

Link copied to clipboard
val boundRegions: Output<List<String>>?

If set, defines a constraint on the EC2 instances that can perform the login operation that the region in their identity document must match the one specified by this field. auth_type must be set to ec2 or inferred_entity_type must be set to ec2_instance to use this constraint.

Link copied to clipboard
val boundSubnetIds: Output<List<String>>?

If set, defines a constraint on the EC2 instances that can perform the login operation that they be associated with the subnet ID that matches the value specified by this field. auth_type must be set to ec2 or inferred_entity_type must be set to ec2_instance to use this constraint.

Link copied to clipboard
val boundVpcIds: Output<List<String>>?

If set, defines a constraint on the EC2 instances that can perform the login operation that they be associated with the VPC ID that matches the value specified by this field. auth_type must be set to ec2 or inferred_entity_type must be set to ec2_instance to use this constraint.

Link copied to clipboard

IF set to true, only allows a single token to be granted per instance ID. This can only be set when auth_type is set to ec2.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard

When inferred_entity_type is set, this is the region to search for the inferred entities. Required if inferred_entity_type is set. This only applies when auth_type is set to iam.

Link copied to clipboard

If set, instructs Vault to turn on inferencing. The only valid value is ec2_instance, which instructs Vault to infer that the role comes from an EC2 instance in an IAM instance profile. This only applies when auth_type is set to iam.

Link copied to clipboard
val namespace: Output<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.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Only valid when auth_type is iam. If set to true, the bound_iam_principal_arns are resolved to [AWS Unique

Link copied to clipboard
val role: Output<String>

The name of the role.

Link copied to clipboard
val roleId: Output<String>

The Vault generated role ID.

Link copied to clipboard
val roleTag: Output<String>?

If set, enable role tags for this role. The value set for this field should be the key of the tag on the EC2 instance. auth_type must be set to ec2 or inferred_entity_type must be set to ec2_instance to use this constraint.

Link copied to clipboard
val tokenBoundCidrs: Output<List<String>>?

Specifies the blocks of IP addresses which are allowed to use the generated token

Link copied to clipboard
val tokenExplicitMaxTtl: Output<Int>?

Generated Token's Explicit Maximum TTL in seconds

Link copied to clipboard
val tokenMaxTtl: Output<Int>?

The maximum lifetime of the generated token

Link copied to clipboard

If true, the 'default' policy will not automatically be added to generated tokens

Link copied to clipboard
val tokenNumUses: Output<Int>?

The maximum number of times a token may be used, a value of zero means unlimited

Link copied to clipboard
val tokenPeriod: Output<Int>?

Generated Token's Period

Link copied to clipboard
val tokenPolicies: Output<List<String>>?

Generated Token's Policies

Link copied to clipboard
val tokenTtl: Output<Int>?

The initial ttl of the token to generate in seconds

Link copied to clipboard
val tokenType: Output<String>?

The type of token to generate, service or batch

Link copied to clipboard
val urn: Output<String>