create an AWS Console user for stefantalpalaru

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2020-05-25 18:49:07 +02:00
parent 333c0939bc
commit 1d4de55a25
No known key found for this signature in database
GPG Key ID: 4EF064D0E6D63020
4 changed files with 110 additions and 2 deletions

View File

@ -50,12 +50,15 @@ install-provisioner:
init-terraform:
terraform init -upgrade=true
secrets:
consul-certs:
@echo "Saving Consul certificates: ansible/files/consul*"
pass services/consul/ca-crt > ansible/files/consul-ca.crt
pass services/consul/ca-key > ansible/files/consul-ca.key
pass services/consul/client-crt > ansible/files/consul-client.crt
pass services/consul/client-key > ansible/files/consul-client.key
echo "Saving secrets to: terraform.tfvars"
tf-secrets:
@echo "Saving secrets to: terraform.tfvars"
@echo -e "\
# secrets extracted from password-store\n\
cloudflare_token = \"$(shell pass cloud/Cloudflare/token)\"\n\
@ -65,5 +68,7 @@ aws_access_key = \"$(shell pass cloud/AWS/Nimbus/access-key)\"\n\
aws_secret_key = \"$(shell pass cloud/AWS/Nimbus/secret-key)\"\n\
" > terraform.tfvars
secrets: consul-certs tf-secrets
cleanup:
rm -r $(PLUGIN_DIR)/$(ARCHIVE)

40
files/stefantalpalaru.gpg Normal file
View File

@ -0,0 +1,40 @@
mQINBFcJJPkBEADRxTiwfCiF6XoNnZonFIiISK9Lizp9zIYDQ/L3jlPnf2Ac+lAxD/HG/+B8faAv
TPrNQNiGmzIf3ZhfJ88AQZvPxhAoFQbGcuRmMvkqkHO01hdcNwelg48qE4UT4NcsQUWBX3L8XPb0
ewY4k3gUJsSsbF+nIEpQ0PF0Qo34cpNiRlAnmUUQckWkJ0E7WsVKm2hIugzAjSzZhgqrD/uio3Cj
I4UJv5Sg49IlP8Vw1GxCmZNvmvrQ3P5vfBG/A/bfwHCnOT68efUlS66j5qApHHXktctYDYMpCtHR
ilMdLAE19Mwutn28etj7zuVwy8zEqqqv5JxbmSBouR0n/rPlggcl5qH5te49qseVobmahyFpe3F+
ebhqpodmnj3g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mRaJzEuLe7W6eRNppvD8I+cj+7PLgur1t5kvm3cw03BjOf7r+fA3kNOktjsmY
XZ+Q8oWt/lqilZXFB6RhGUZw28sIgXPvyuZYPHQo6UsavRaybUlmMspzCWiBJuFHKKe71HtezZjF
DHsJaaJemkeLV7Hnzk4lSkoK529xpSrU9WKBbVIzJ7q4NC63KG22esuSADtny1kgDeTXhHT7MRPD
HjOTDubtjqVrVI+XULoy+xUFOO9JiGaMM6GTA5SRhplSNuaRIIeHfOpRBJZZ/OsTDVrwAy9Msd3v
qXMGlM6LG7/Vl5Y0F0yLLv2G947Nu7jxV1GuZom5rbOhsQ4vRpDpFvwrEcP1ru5dh7AnDYSRyiN+
KxuDfyFhfLuaVBLp0k4l5ICmh9XoFeqKNoB/I48Rie6eFzUfGtSd6mwufevYPodJOrXdWy3VTnzy
kCbSKzz43WRDjBghwqLdAkvDU1OerxxAFw/cJ5+9ZeHOlLl/T8uXEeQprI1eaylMMpPeB9sN

55
users.tf Normal file
View File

@ -0,0 +1,55 @@
resource "aws_iam_user" "nimbus_team" {
name = var.nimbus_team_members[count.index]
count = length(var.nimbus_team_members)
tags = { Purpose = "Nimbus team Console access" }
}
resource "aws_iam_group" "nimbus_team" {
name = "nimbus-team-members"
path = "/users/"
}
resource "aws_iam_access_key" "nimbus_team" {
user = aws_iam_user.nimbus_team[count.index].name
count = length(aws_iam_user.nimbus_team)
/* GPG key for encrypting the secret key */
pgp_key = file("files/${aws_iam_user.nimbus_team[count.index].name}.gpg")
}
resource "aws_iam_user_login_profile" "nimbus_team" {
user = aws_iam_user.nimbus_team[count.index].name
count = length(var.nimbus_team_members)
/* GPG key for encrypting the secret key */
pgp_key = file("files/${aws_iam_user.nimbus_team[count.index].name}.gpg")
/* Make user change password after first login */
password_reset_required = true
/* Avoid re-creating due to password change */
lifecycle {
ignore_changes = [password_length, password_reset_required, pgp_key]
}
}
resource "aws_iam_group_membership" "nimbus_team" {
name = "nimbus-team-group-membership"
group = aws_iam_group.nimbus_team.name
users = aws_iam_user.nimbus_team.*.name
}
resource "aws_iam_group_policy_attachment" "nimbus_team" {
group = aws_iam_group.nimbus_team.name
policy_arn = "arn:aws:iam::aws:policy/AdministratorAccess"
}
/* These are encrypted using the GPG key, uncomment to get the password. */
/*
output "nimbus_team_passwords" {
value = {
for profile in aws_iam_user_login_profile.nimbus_team:
profile.user => profile.encrypted_password
}
}
*/

View File

@ -48,3 +48,11 @@ variable "log_stores_count" {
description = "Count of ElasticSearch cluster hosts."
default = 3
}
/* NIMBUS TEAM -----------------------------------*/
variable "nimbus_team_members" {
description = "List of Nimbus team members with Console access."
type = list(string)
default = [ "stefantalpalaru" ]
}