This repository has been archived by the owner on Jul 24, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
manage state remotely, allow totally separate infra per project
- Loading branch information
Tyler Kellen
committed
Mar 8, 2017
1 parent
65ad192
commit ac1f690
Showing
16 changed files
with
158 additions
and
669 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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.terraform | ||
*.tfstate.backup | ||
*.plan |
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,19 @@ | ||
.PHONY: init plan apply push | ||
|
||
init: | ||
cd terraform/states/$(state) && terraform get | ||
cd terraform/states/$(state) && terraform remote config \ | ||
-backend=s3 \ | ||
-backend-config="bucket=foundation-terraform" \ | ||
-backend-config="key=$(state).tfstate" \ | ||
-backend-config="profile=foundation" \ | ||
-backend-config="region=us-east-1" | ||
|
||
plan: | ||
cd terraform/states/$(state) && terraform plan -out $(state).plan -var-file ../../variables.tfvars | ||
|
||
apply: | ||
cd terraform/states/$(state) && terraform apply $(state).plan | ||
|
||
push: | ||
cd terraform/states/$(state) && terraform remote push |
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 |
---|---|---|
@@ -1,13 +1,29 @@ | ||
# Bocoup Foundation Inc | ||
> our infrastructure, as code | ||
## Setup | ||
## Bootstrapping | ||
1. Install [AWSCLI] & [Terraform] | ||
2. Log into AWS EC2 console, create a key pair titled "default". | ||
Download the key and add to your ssh-agent: `ssh-add /path/to/key.pem` | ||
3. Ensure `~/.aws/credentials` has a profile with administrative | ||
access keys that match `name` in `terraform.tfvars` | ||
4. Provision your infrastructure: `terraform apply` | ||
access keys that match `profile` in `terraform/variables.tfvars` | ||
|
||
## Managing Infrastructure | ||
|
||
#### init | ||
Running `state=<name> make init` configures your local environment to access | ||
the terraform state as stored in S3. This is a prequisite before managing any | ||
of our states. | ||
|
||
### plan | ||
Running `state=<name> make plan` compares your local configuration to the | ||
actual deployed infrastructure and prepares a plan to reconcile any | ||
differences. | ||
|
||
### apply | ||
After verifying your plan, running `state=<name> make apply` will execute | ||
the changes from your last plan. | ||
|
||
|
||
[AWSCLI]: http://docs.aws.amazon.com/cli/latest/userguide/installing.html | ||
[Terraform]: https://www.terraform.io/downloads.html |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.