We are trying to create IAM user via terraform and to generate password using base-64 encoded PGP public key:
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_user_login_profile
https://registry.terraform.io/providers/ekristen/pgp/latest/docs/resources/pgp_key
We want this to be done without installing/using Keybase
Can someone please let me know the step-by-step process to get that?
resource “aws_iam_user” “test_users” {
name = “testuser”
}
resource “pgp_key” “pgp_gen” {
name = “krishna”
email = “mxxxxxxa@xxxxxx.com”
comment = “Generated PGP Key for”
}
resource “aws_iam_user_login_profile” “user_password_gen” {
user = “testuser”
pgp_key = pgp_key.pgp_gen.public_key_base64
password_reset_required = true
depends_on = [aws_iam_user.test_users]
}
data “pgp_decrypt” “decrypt_private_key” {
ciphertext = aws_iam_user_login_profile.user_password_gen.encrypted_password
private_key = pgp_key.pgp_gen.private_key
}