ServiceSpecificCredential class

Provides an IAM Service Specific Credential.

Example Usage

Basic Usage

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

const example = new aws.iam.User("example", {name: "example"});
const exampleServiceSpecificCredential = new aws.iam.ServiceSpecificCredential("example", {
    serviceName: "codecommit.amazonaws.com",
    userName: example.name,
});
import pulumi
import pulumi_aws as aws

example = aws.iam.User("example", name="example")
example_service_specific_credential = aws.iam.ServiceSpecificCredential("example",
    service_name="codecommit.amazonaws.com",
    user_name=example.name)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Iam.User("example", new()
    {
        Name = "example",
    });

    var exampleServiceSpecificCredential = new Aws.Iam.ServiceSpecificCredential("example", new()
    {
        ServiceName = "codecommit.amazonaws.com",
        UserName = example.Name,
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := iam.NewUser(ctx, "example", &iam.UserArgs{
			Name: pulumi.String("example"),
		})
		if err != nil {
			return err
		}
		_, err = iam.NewServiceSpecificCredential(ctx, "example", &iam.ServiceSpecificCredentialArgs{
			ServiceName: pulumi.String("codecommit.amazonaws.com"),
			UserName:    example.Name,
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_iam_user" "example" {
  name = "example"
}
resource "aws_iam_servicespecificcredential" "example" {
  service_name = "codecommit.amazonaws.com"
  user_name    = aws_iam_user.example.name
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.User;
import com.pulumi.aws.iam.UserArgs;
import com.pulumi.aws.iam.ServiceSpecificCredential;
import com.pulumi.aws.iam.ServiceSpecificCredentialArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 example = new User("example", UserArgs.builder()
            .name("example")
            .build());

        var exampleServiceSpecificCredential = new ServiceSpecificCredential("exampleServiceSpecificCredential", ServiceSpecificCredentialArgs.builder()
            .serviceName("codecommit.amazonaws.com")
            .userName(example.name())
            .build());

    }
}
resources:
  example:
    type: aws:iam:User
    properties:
      name: example
  exampleServiceSpecificCredential:
    type: aws:iam:ServiceSpecificCredential
    name: example
    properties:
      serviceName: codecommit.amazonaws.com
      userName: ${example.name}

Bedrock API Key with Expiration

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

const example = new aws.iam.User("example", {name: "example"});
const bedrock = new aws.iam.ServiceSpecificCredential("bedrock", {
    serviceName: "bedrock.amazonaws.com",
    userName: example.name,
    credentialAgeDays: 30,
});
import pulumi
import pulumi_aws as aws

example = aws.iam.User("example", name="example")
bedrock = aws.iam.ServiceSpecificCredential("bedrock",
    service_name="bedrock.amazonaws.com",
    user_name=example.name,
    credential_age_days=30)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() =>
{
    var example = new Aws.Iam.User("example", new()
    {
        Name = "example",
    });

    var bedrock = new Aws.Iam.ServiceSpecificCredential("bedrock", new()
    {
        ServiceName = "bedrock.amazonaws.com",
        UserName = example.Name,
        CredentialAgeDays = 30,
    });

});
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/iam"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		example, err := iam.NewUser(ctx, "example", &iam.UserArgs{
			Name: pulumi.String("example"),
		})
		if err != nil {
			return err
		}
		_, err = iam.NewServiceSpecificCredential(ctx, "bedrock", &iam.ServiceSpecificCredentialArgs{
			ServiceName:       pulumi.String("bedrock.amazonaws.com"),
			UserName:          example.Name,
			CredentialAgeDays: pulumi.Int(30),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    aws = {
      source = "pulumi/aws"
    }
  }
}

resource "aws_iam_user" "example" {
  name = "example"
}
resource "aws_iam_servicespecificcredential" "bedrock" {
  service_name        = "bedrock.amazonaws.com"
  user_name           = aws_iam_user.example.name
  credential_age_days = 30 # API key expires after 30 days
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.iam.User;
import com.pulumi.aws.iam.UserArgs;
import com.pulumi.aws.iam.ServiceSpecificCredential;
import com.pulumi.aws.iam.ServiceSpecificCredentialArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 example = new User("example", UserArgs.builder()
            .name("example")
            .build());

        var bedrock = new ServiceSpecificCredential("bedrock", ServiceSpecificCredentialArgs.builder()
            .serviceName("bedrock.amazonaws.com")
            .userName(example.name())
            .credentialAgeDays(30)
            .build());

    }
}
resources:
  example:
    type: aws:iam:User
    properties:
      name: example
  bedrock:
    type: aws:iam:ServiceSpecificCredential
    properties:
      serviceName: bedrock.amazonaws.com
      userName: ${example.name}
      credentialAgeDays: 30 # API key expires after 30 days

Import

Using pulumi import, import IAM Service Specific Credentials using the service_name:user_name:service_specific_credential_id. For example:

$ pulumi import aws:iam/serviceSpecificCredential:ServiceSpecificCredential default `codecommit.amazonaws.com:example:some-id`

Constructors

ServiceSpecificCredential(String name, {ServiceSpecificCredentialArgs? args, CustomResourceOptions? options})
Creates a new ServiceSpecificCredential. name The Pulumi resource name. args Arguments used to configure this ServiceSpecificCredential. The set of arguments for ServiceSpecificCredential. options Resource options controlling this resource's behavior.
ServiceSpecificCredential.reference(String urn)
Creates a typed reference to an existing ServiceSpecificCredential resource.

Properties

childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
createDate ↔ Output<String>
The date and time, in RFC3339 format, when the service-specific credential was created.
latefinal
credentialAgeDays ↔ Output<int?>
The number of days until the service specific credential expires. This field is only valid for Bedrock API keys and must be between 1 and 36600 (approximately 100 years). When not specified, the credential will not expire.
latefinal
expirationDate ↔ Output<String>
The date and time, in RFC3339 format, when the service specific credential expires. This field is only present for Bedrock API keys that were created with an expiration period.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
id ↔ Output<String>
getter/setter pairinherited
isCustom → bool
Returns whether this resource is provider-managed.
no setterinherited
isProtected → bool
Returns whether this resource is protected from deletion.
no setterinherited
isRemote → bool
Whether this resource is registered as remote.
no setterinherited
isResourceReference → bool
Whether this instance represents a resource value returned over RPC.
finalinherited
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
serviceCredentialAlias ↔ Output<String>
For Bedrock API keys, this is the public portion of the credential that includes the IAM user name and a suffix containing version and creation information.
latefinal
serviceCredentialSecret ↔ Output<String>
For Bedrock API keys, this is the secret portion of the credential that should be used to authenticate API calls. This value is only available when the credential is created.
latefinal
serviceName ↔ Output<String>
The name of the AWS service that is to be associated with the credentials. The service you specify here is the only service that can be accessed using these credentials. Supported services are codecommit.amazonaws.com, bedrock.amazonaws.com, and cassandra.amazonaws.com.
latefinal
servicePassword ↔ Output<String>
The generated password for the service-specific credential. This value is only available when the credential is created.
latefinal
serviceSpecificCredentialId ↔ Output<String>
The unique identifier for the service-specific credential.
latefinal
serviceUserName ↔ Output<String>
The generated user name for the service-specific credential. This value is generated by combining the IAM user's name combined with the ID number of the AWS account, as in jane-at-123456789012, for example.
latefinal
status ↔ Output<String?>
The status to be assigned to the service-specific credential. Valid values are Active, Inactive, and Expired. Default value is Active. Note that Expired is only used for read operations and cannot be set manually.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
urn ↔ Output<String>
latefinalinherited
userName ↔ Output<String>
The name of the IAM user that is to be associated with the credentials. The new service-specific credentials have the same permissions as the associated user except that they can be used only to access the specified service.
latefinal

Methods

failId(Object error) → void
Completes this resource ID with an error when registration fails.
inherited
failOutputs(Object error) → void
Completes all output properties with error.
inherited
failUrn(Object error) → void
Completes this resource URN with an error when registration fails.
inherited
getProvider(String moduleMember) → ProviderResource?
Returns provider for moduleMember's package, if configured.
inherited
getResourceName() → String
Returns this resource's logical name.
inherited
getResourceType() → String
Returns this resource's Pulumi type token.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerOutput<T>(String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output<T>
Registers a dynamic output property for this resource.
inherited
resolveId(String? value, {required bool isKnown}) → void
Resolves the provider-assigned ID for this resource.
inherited
resolveOutputs(Struct outputs) → void
Resolves all output properties from a monitor response payload.
inherited
resolveUrn(String value) → void
Resolves this resource's URN once assigned by the engine.
inherited
serializeProperties(Map<String, dynamic> properties) → Future<Struct>
Serializes resource properties for RPC transmission.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

get(String name, Input<String> id, {ServiceSpecificCredentialState? state, CustomResourceOptions? options}) → ServiceSpecificCredential
Gets an existing ServiceSpecificCredential resource's state with the given name and id.