2015-02-06 16:34:24 +01:00
|
|
|
---
|
|
|
|
layout: "aws"
|
|
|
|
page_title: "AWS: aws_iam_user"
|
|
|
|
sidebar_current: "docs-aws-resource-iam-user"
|
|
|
|
description: |-
|
|
|
|
Provides an IAM user.
|
|
|
|
---
|
|
|
|
|
|
|
|
# aws\_iam\_user
|
|
|
|
|
|
|
|
Provides an IAM user.
|
|
|
|
|
|
|
|
## Example Usage
|
|
|
|
|
|
|
|
```
|
|
|
|
resource "aws_iam_user" "lb" {
|
|
|
|
name = "loadbalancer"
|
|
|
|
path = "/system/"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_iam_access_key" "lb" {
|
|
|
|
user = "${aws_iam_user.lb.name}"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "aws_iam_user_policy" "lb_ro" {
|
|
|
|
name = "test"
|
|
|
|
user = "${aws_iam_user.lb.name}"
|
|
|
|
policy = <<EOF
|
|
|
|
{
|
|
|
|
"Version": "2012-10-17",
|
|
|
|
"Statement": [
|
|
|
|
{
|
|
|
|
"Action": [
|
|
|
|
"ec2:Describe*"
|
|
|
|
],
|
|
|
|
"Effect": "Allow",
|
|
|
|
"Resource": "*"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
|
|
|
* `name` - (Required) The user's name.
|
|
|
|
* `path` - (Optional, default "/") Path in which to create the user.
|
2016-07-25 09:15:03 +02:00
|
|
|
* `force_destroy` - (Optional, default false) When destroying this user, destroy
|
|
|
|
even if it has non-Terraform-managed IAM access keys. Without `force_destroy`
|
|
|
|
a user with non-Terraform-managed access keys will fail to be destroyed.
|
2015-02-06 16:34:24 +01:00
|
|
|
|
|
|
|
## Attributes Reference
|
|
|
|
|
|
|
|
The following attributes are exported:
|
|
|
|
|
|
|
|
* `unique_id` - The [unique ID][1] assigned by AWS.
|
|
|
|
* `arn` - The ARN assigned by AWS for this user.
|
|
|
|
|
2016-01-14 21:55:39 +01:00
|
|
|
[1]: https://docs.aws.amazon.com/IAM/latest/UserGuide/Using_Identifiers.html#GUIDs
|
2016-07-21 00:28:59 +02:00
|
|
|
|
|
|
|
|
|
|
|
## Import
|
|
|
|
|
|
|
|
IAM Users can be imported using the `name`, e.g.
|
|
|
|
|
|
|
|
```
|
|
|
|
$ terraform import aws_iam_user.lb loadbalancer
|
2016-07-25 09:15:03 +02:00
|
|
|
```
|