Skip to content

Instantly share code, notes, and snippets.

@maguec
Last active September 12, 2018 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maguec/c17fdb0eb306b9746c9aa157236fab99 to your computer and use it in GitHub Desktop.
Save maguec/c17fdb0eb306b9746c9aa157236fab99 to your computer and use it in GitHub Desktop.
variable "region" {}
variable "profile" {}
provider "aws" {
region = "${var.region}"
profile = "${var.profile}"
version = "~> 1.0"
}
resource "aws_iam_group" "tf-admins" {
name = "tf-admins"
path = "/tf-admins/"
}
resource "aws_iam_user" "tf-chris" {
name = "tf-chris"
path = "/tf-admins/"
}
resource "aws_iam_access_key" "tf-chris" {
user = "${aws_iam_user.tf-chris.name}"
pgp_key = "keybase:maguec"
}
resource "aws_iam_group_membership" "tf-admins" {
name = "tf-admins-group-membership"
users = [
"${aws_iam_user.tf-chris.name}",
]
group = "${aws_iam_group.tf-admins.name}"
}
resource "aws_iam_group_policy" "tf-admins-policy" {
name = "tf-admins-policy"
group = "${aws_iam_group.tf-admins.id}"
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "*",
"Resource": "*"
}
]
}
EOF
}
output tf-chris-id {
value = "${aws_iam_access_key.tf-chris.id}"
}
output tf-chris-secret {
value = "\n-----BEGIN PGP MESSAGE-----\n\n${aws_iam_access_key.tf-chris.encrypted_secret}\n-----END PGP MESSAGE-----\n"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment