-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
34 lines (30 loc) · 1.17 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
resource "aws_iam_user" "this" {
count = var.create_user ? 1 : 0
name = var.name
path = var.path
force_destroy = var.force_destroy
permissions_boundary = var.permissions_boundary
tags = var.tags
}
resource "aws_iam_user_login_profile" "this" {
count = var.create_user && var.create_iam_user_login_profile ? 1 : 0
user = aws_iam_user.this[0].name
pgp_key = var.pgp_key
password_length = var.password_length
password_reset_required = var.password_reset_required
}
resource "aws_iam_access_key" "this" {
count = var.create_user && var.create_iam_access_key && var.pgp_key != "" ? 1 : 0
user = aws_iam_user.this[0].name
pgp_key = var.pgp_key
}
resource "aws_iam_access_key" "this_no_pgp" {
count = var.create_user && var.create_iam_access_key && var.pgp_key == "" ? 1 : 0
user = aws_iam_user.this[0].name
}
resource "aws_iam_user_ssh_key" "this" {
count = var.create_user && var.upload_iam_user_ssh_key ? 1 : 0
username = aws_iam_user.this[0].name
encoding = var.ssh_key_encoding
public_key = var.ssh_public_key
}