Skip to content

Commit ff9d783

Browse files
authored
fix: Correct encrypted ses_smtp_password_v4 output (#259)
1 parent 9210e6c commit ff9d783

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

modules/iam-user/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ When `pgp_key` is specified as `keybase:username`, make sure that that user has
1515
This module outputs commands and PGP messages which can be decrypted either using [keybase.io web-site](https://keybase.io/decrypt) or using command line to get user's password and user's secret key:
1616
- `keybase_password_decrypt_command`
1717
- `keybase_secret_key_decrypt_command`
18+
- `keybase_ses_smtp_password_v4_decrypt_command`
1819
- `keybase_password_pgp_message`
1920
- `keybase_secret_key_pgp_message`
21+
- `keybase_ses_smtp_password_v4_pgp_message`
2022

2123
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2224
## Requirements
@@ -70,6 +72,7 @@ No modules.
7072
| Name | Description |
7173
|------|-------------|
7274
| <a name="output_iam_access_key_encrypted_secret"></a> [iam\_access\_key\_encrypted\_secret](#output\_iam\_access\_key\_encrypted\_secret) | The encrypted secret, base64 encoded |
75+
| <a name="output_iam_access_key_encrypted_ses_smtp_password_v4"></a> [iam\_access\_key\_encrypted\_ses\_smtp\_password\_v4](#output\_iam\_access\_key\_encrypted\_ses\_smtp\_password\_v4) | The encrypted secret access key converted into an SES SMTP password by applying AWS's Sigv4 conversion algorithm |
7376
| <a name="output_iam_access_key_id"></a> [iam\_access\_key\_id](#output\_iam\_access\_key\_id) | The access key ID |
7477
| <a name="output_iam_access_key_key_fingerprint"></a> [iam\_access\_key\_key\_fingerprint](#output\_iam\_access\_key\_key\_fingerprint) | The fingerprint of the PGP key used to encrypt the secret |
7578
| <a name="output_iam_access_key_secret"></a> [iam\_access\_key\_secret](#output\_iam\_access\_key\_secret) | The access key secret |
@@ -87,5 +90,7 @@ No modules.
8790
| <a name="output_keybase_password_pgp_message"></a> [keybase\_password\_pgp\_message](#output\_keybase\_password\_pgp\_message) | Encrypted password |
8891
| <a name="output_keybase_secret_key_decrypt_command"></a> [keybase\_secret\_key\_decrypt\_command](#output\_keybase\_secret\_key\_decrypt\_command) | Decrypt access secret key command |
8992
| <a name="output_keybase_secret_key_pgp_message"></a> [keybase\_secret\_key\_pgp\_message](#output\_keybase\_secret\_key\_pgp\_message) | Encrypted access secret key |
93+
| <a name="output_keybase_ses_smtp_password_v4_decrypt_command"></a> [keybase\_ses\_smtp\_password\_v4\_decrypt\_command](#output\_keybase\_ses\_smtp\_password\_v4\_decrypt\_command) | Decrypt SES SMTP password command |
94+
| <a name="output_keybase_ses_smtp_password_v4_pgp_message"></a> [keybase\_ses\_smtp\_password\_v4\_pgp\_message](#output\_keybase\_ses\_smtp\_password\_v4\_pgp\_message) | Encrypted SES SMTP password |
9095
| <a name="output_pgp_key"></a> [pgp\_key](#output\_pgp\_key) | PGP key used to encrypt sensitive data for this user (if empty - secrets are not encrypted) |
9196
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

modules/iam-user/outputs.tf

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,15 @@ output "iam_access_key_encrypted_secret" {
5757

5858
output "iam_access_key_ses_smtp_password_v4" {
5959
description = "The secret access key converted into an SES SMTP password by applying AWS's Sigv4 conversion algorithm"
60-
value = try(aws_iam_access_key.this[0].ses_smtp_password_v4, aws_iam_access_key.this_no_pgp[0].ses_smtp_password_v4, "")
60+
value = try(aws_iam_access_key.this_no_pgp[0].ses_smtp_password_v4, "")
6161
sensitive = true
6262
}
6363

64+
output "iam_access_key_encrypted_ses_smtp_password_v4" {
65+
description = "The encrypted secret access key converted into an SES SMTP password by applying AWS's Sigv4 conversion algorithm"
66+
value = try(aws_iam_access_key.this[0].encrypted_ses_smtp_password_v4, "")
67+
}
68+
6469
output "iam_access_key_status" {
6570
description = "Active or Inactive. Keys are initially active, but can be made inactive by other means."
6671
value = try(aws_iam_access_key.this[0].status, aws_iam_access_key.this_no_pgp[0].status, "")
@@ -113,6 +118,27 @@ EOF
113118

114119
}
115120

121+
output "keybase_ses_smtp_password_v4_decrypt_command" {
122+
description = "Decrypt SES SMTP password command"
123+
value = !local.has_encrypted_secret ? null : <<EOF
124+
echo "${try(aws_iam_access_key.this[0].encrypted_ses_smtp_password_v4, "")}" | base64 --decode | keybase pgp decrypt
125+
EOF
126+
127+
}
128+
129+
output "keybase_ses_smtp_password_v4_pgp_message" {
130+
description = "Encrypted SES SMTP password"
131+
value = !local.has_encrypted_secret ? null : <<EOF
132+
-----BEGIN PGP MESSAGE-----
133+
Version: Keybase OpenPGP v2.0.76
134+
Comment: https://keybase.io/crypto
135+
136+
${try(aws_iam_access_key.this[0].encrypted_ses_smtp_password_v4, "")}
137+
-----END PGP MESSAGE-----
138+
EOF
139+
140+
}
141+
116142
output "iam_user_ssh_key_ssh_public_key_id" {
117143
description = "The unique identifier for the SSH public key"
118144
value = try(aws_iam_user_ssh_key.this[0].ssh_public_key_id, "")

0 commit comments

Comments
 (0)