Skip to content

Commit

Permalink
Version 1.3.0
Browse files Browse the repository at this point in the history
Move terraform generated files: (.tfstate, .tfplan) into a separate `statefiles` directory.
  • Loading branch information
vulturm authored and Mihai Vultur committed Oct 13, 2017
1 parent eef1c12 commit 9dc7f69
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ CHANGELOG

This file is used to list changes made in each version of the `en_infra_aws` project.

### Version 1.3.0
Move terraform generated files: (.tfstate, .tfplan) into a separate `statefiles` directory.

### Version 1.2.1
Fixed outputing NATInstance public_ip by separating the creation and assignement phases.
Fixed remote-exec provisioning retry sequence - now is triggered by the assignement
Expand Down
9 changes: 5 additions & 4 deletions DevOpsVPC/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ info:
done

plan:
terraform plan -var-file infrastructure.conf -out terraform.tfplan | tee -a logs/plan.log
terraform plan -var-file infrastructure.conf -out=statefiles/plan.tfplan -state=statefiles/terraform.tfstate | tee -a logs/plan.log

apply:
terraform apply -var-file infrastructure.conf -backup terraform.backup | tee -a logs/apply.log
terraform apply -var-file infrastructure.conf -backup=statefiles/beforeapply_$$(date +"%s").backup -state=statefiles/terraform.tfstate | tee -a logs/apply.log

destroy:
terraform plan -destroy -var-file infrastructure.conf -out terraform.tfplan | tee -a logs/destroy.log
terraform apply terraform.tfplan | tee -a logs/destroy.log
terraform plan -destroy -var-file infrastructure.conf -out=statefiles/destroy.tfplan -state=statefiles/terraform.tfstate | tee -a logs/destroy.log
terraform apply statefiles/destroy.tfplan | tee -a logs/destroy.log
mv -f terraform.tfstate statefiles/destroy.tfstate
2 changes: 1 addition & 1 deletion DevOpsVPC/infrastructure.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#-- Version of our infrastructure
#-- It has no effect, just to help versioning.
en_infra_aws_version = "1.2.1"
en_infra_aws_version = "1.3.0"

#-- AWS region
aws_region = "us-east-1"
Expand Down
1 change: 1 addition & 0 deletions DevOpsVPC/statefiles/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Directory to store `.tfstate`, `.tfplan`, `.tfbackup` files for terraform actions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ Will read our custom `infrastructure.conf`, process the tf files then compare th

### make apply
Will read our custom `infrastructure.conf`, will process the tf filse and send the commands to `AWS API` to provision the infrastructure.
Will save a copy of the previous statefile in the `statefiles/beforeapply_$$(date +"%s").backup` location.

### make destroy
Will read our custom `infrastructure.conf`, do a `terraform plan` then `terraform destroy`.<br />
`**WARNING!**` This command destroys the entire `terraform controlled` infrastructure without any notice! Don't use it in production.
Will read our custom `infrastructure.conf`, do a `terraform plan -destroy`, which creates a planfile in `statefiles/destroy.tfplan` then will `apply that destroy plan`.<br />
`**WARNING!**` This command destroys the entire `terraform controlled` infrastructure without any notice! Use it with care in production.

### make info
Will parse the list of the `terraform state` and show a detailed human readable output so that we could inspect our infrastructure.
Expand Down

0 comments on commit 9dc7f69

Please sign in to comment.