Skip to content

Instantly share code, notes, and snippets.

@100daysofdevops
Last active March 16, 2019 18:09
Show Gist options
  • Select an option

  • Save 100daysofdevops/7e028de60ad2bec7492c0bfc6761f976 to your computer and use it in GitHub Desktop.

Select an option

Save 100daysofdevops/7e028de60ad2bec7492c0bfc6761f976 to your computer and use it in GitHub Desktop.
# This is going to overwrite our exisiting credentials file, make sure take a backup of that
provider "aws" {
region = "us-west-2"
}
resource "aws_iam_user" "mytestuser" {
name = "mytestuser"
}
resource "aws_iam_access_key" "myaccesskey" {
user = "${aws_iam_user.mytestuser.name}"
}
resource "local_file" "aws_keys" {
content = <<EOF
[mytestuser]
aws_access_key_id = ${aws_iam_access_key.myaccesskey.id}
aws_secret_access_key = ${aws_iam_access_key.myaccesskey.secret}
EOF
filename = "${var.user_home_path}/.aws/credentials"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment