Skip to content

Commit a30ac92

Browse files
committed
Create aws iam create user persistence module
1 parent ecec8c5 commit a30ac92

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

main.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
resource "aws_iam_user" "this" {
2+
name = var.user_name
3+
}
4+
5+
resource "aws_iam_access_key" "this" {
6+
user = aws_iam_user.this.name
7+
}
8+
9+
resource "aws_iam_user_policy_attachment" "this" {
10+
user = aws_iam_user.this.name
11+
policy_arn = var.policy_arn
12+
}

outputs.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
output "aws_iam_user" {
2+
value = aws_iam_user.this.name
3+
}
4+
5+
output "aws_iam_user_policy_arn" {
6+
value = aws_iam_user_policy_attachment.this.policy_arn
7+
}
8+
9+
output "access_key" {
10+
value = aws_iam_access_key.this.id
11+
}
12+
13+
output "secret_key" {
14+
value = aws_iam_access_key.this.secret
15+
}

variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
variable "user_name" {
2+
type = string
3+
description = "(Required) The user's name."
4+
}
5+
6+
variable "policy_arn" {
7+
type = string
8+
description = "(Required) The ARN of the policy you want to apply"
9+
}

0 commit comments

Comments
 (0)