Provides an IAM Service Specific Credential.
resource "aws_iam_user" "example" {
name = "example"
}
resource "aws_iam_service_specific_credential" "example" {
service_name = "codecommit.amazonaws.com"
user_name = aws_iam_user.example.name
}
This resource supports the following arguments:
service_name
- (Required) 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.user_name
- (Required) 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.status
- (Optional) The status to be assigned to the service-specific credential. Valid values are Active
and Inactive
. Default value is Active
.This resource exports the following attributes in addition to the arguments above:
id
- The combination of service_name
and user_name
as such: service_name:user_name:service_specific_credential_id
.service_password
- The generated password for the service-specific credential.service_user_name
- 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.service_specific_credential_id
- The unique identifier for the service-specific credential.In Terraform v1.5.0 and later, use an import
block to import IAM Service Specific Credentials using the service_name:user_name:service_specific_credential_id
. For example:
import {
to = aws_iam_service_specific_credential.default
id = "`codecommit.amazonaws.com:example:some-id`"
}
Using terraform import
, import IAM Service Specific Credentials using the service_name:user_name:service_specific_credential_id
. For example:
% terraform import aws_iam_service_specific_credential.default `codecommit.amazonaws.com:example:some-id`