-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dave Arnold
committed
Jul 16, 2018
1 parent
4dd794a
commit dc4e73f
Showing
7 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# AWS Account Management through Terraform and Vault AWS/AppRole | ||
First we're gonna go through creating a brand new Terraform Enterprise Organization. In this organization, we will manage all of our AWS Accounts and any other global infrastructure. All the rest of our infrastructure will be delegated to our individual AWS Accounts. | ||
![TFE Org Create](./images/tfe_org_create.png) | ||
|
||
## Connect TFE Organization to GitHub | ||
We're going to create a new GitHub Oauth App. | ||
![GitHub Oauth App](./images/github_oauth_create.png) | ||
|
||
## Repository Creation for AWSSubAccounts | ||
We're going to manage all of our sub-accounts from one GitHub repository. We do not want to ever store our Terraform State files in GitHub as there could be unintended secrets that are checked in as well. Since we're going to be mostly managing Terraform code from this repository, we will go ahead and specify the Terraform template for our .gitignore file. | ||
![GitHub Repo Create](./images/github_repo_create.png) | ||
|
||
## Workspace Creation for AWS SubAccounts | ||
We're going to manage all of our sub-accounts from one workspace. In this workspace we will need to upload our Root Account IAM Credentials. *This should not be confused with root user credentials. Here we are only providing credentials that are tied to IAM accounts that are able to create sub-accounts. | ||
![TFE Workspace Create](./images/tfe_workspace_create.png) | ||
|
||
### Workspace Variable Setup | ||
push_vault_env Darnold-AWS-Global AWSSubAccounts | ||
[push_vault code ](https://gist.github.com/djaboxx/f6d7c6adac9b18028e9ef347c14eb89d) | ||
|
||
push_aws Darnold-AWS-Global AWSSubAccounts | ||
[push_aws code ](https://gist.github.com/djaboxx/a6ef280f16495b7c533a7b9ddd807acc) | ||
|
||
source ~/.tfe/Darnold-AWS-Global | ||
tfe pushvars -name ${TFE_ORG}/AWSSubAccounts -var "aws_account_email=${AWS_ACCOUNT_EMAIL}" -var "aws_account_name=${AWS_ACCOUNT_NAME}" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
//-------------------------------------------------------------------- | ||
// Variables | ||
variable "aws_account_email" {} | ||
|
||
variable "aws_account_name" {} | ||
|
||
//-------------------------------------------------------------------- | ||
// Modules | ||
module "accounts" { | ||
source = "app.terraform.io/Darnold-AWS-Global/accounts/aws" | ||
version = "2.0.0" | ||
|
||
aws_account_email = "${var.aws_account_email}" | ||
aws_account_name = "${var.aws_account_name}" | ||
} | ||
|
||
output "role_name" { | ||
value = "${module.accounts.role_name}" | ||
} | ||
|
||
output "account_id" { | ||
value = "${module.accounts.account_id}" | ||
} | ||
|
||
output "account_arn" { | ||
value = "${module.accounts.account_arn}" | ||
} | ||
|
||
output "vault_ec2_ro_path" { | ||
value = "aws-${var.aws_account_name}/creds/ec2_ro" | ||
} | ||
|
||
output "vault_ec2_admin_path" { | ||
value = "aws-${var.aws_account_name}/creds/ec2_admin" | ||
} | ||
|
||
output "vault_ec2_admin_policy" { | ||
value = "aws-${var.aws_account_name}-admin" | ||
} | ||
|
||
output "vault_ec2_ro_policy" { | ||
value = "aws-${var.aws_account_name}-ro" | ||
} | ||
|