# tf-cf-aws-3tier-dev (WIP NOT COMPLETE) ## Abstract In this project we attempt to automate infrastructure provisioning in Amazon Web Services. The infrastructure includes the services essential for a customer managed three-tier-app. An attempt is made to convert as many services or resources into Terraform plans as possible. The project is intended as a MVP and to be tested in a non-production AWS account. ### Architecture ![Three Tier AWS Architecture](images/tf-cf-aws-3tier-arch.png) ## Requirements The author(s) assumes the reader has access to Amazon Web Services with sufficient IAM permissions. Access to provisioned GNU+Linux compute requires a personal SSH key. Access to Windows Server compute requires a local or domain account. ### IaC Experience handling infrastructure as code and Terraform is very helpful as well. Consider reading [Terraform Up and Running](https://www.terraformupandrunning.com/) for the fundamentals. ## Tooling * `Terraform >= 1.4.XYZ` * Provider: `hashicorp/aws >= v5.3.0` ## Usage 1. Install requirements 1. [Configure AWS Account Credentials]() 1. Clone repository 1. Generate a `.tfvars` file using the template `tfvars.skel` 1. `terraform init` 1. `terraform plan` 1. `terraform apply` 1. Confirm SSH and RDP access is available 1. Apply desired application tests **DO NOT STORE SSH KEYS, API KEYS, OR TERRAFORM STATE FILES REMOTELY. PLEASE KEEP THEM SECURE ON YOUR LOCAL MACHINE** ## Testing and Debugging Terraform provides simple linting and validation functionality. Keep in mind validation or linting does not guarantee a successful deployment. ### Terraform Quickly check your plans: `terraform fmt && terraform validate` ## Bugs The current IaC implementation will fail to provision. There improvements in use of the `for_each` meta-argument to be made. Lastly, the implementation is not resilient to failures and requires an overhaul. Future plans will consider serverless and auto-scaling cloud services to bolster resiliency. ## Attribution * [Terraform AWS VPC Module](https://github.com/terraform-aws-modules/terraform-aws-vpc) * [Terraform AWS SG Module](https://github.com/terraform-aws-modules/terraform-aws-security-group) * [Terraform AWS EC2 Module](https://github.com/terraform-aws-modules/terraform-aws-ec2-instance) * [Terraform AWS ALB Module](https://github.com/terraform-aws-modules/terraform-aws-alb) * [Terraform AWS RDS Module](https://github.com/terraform-aws-modules/terraform-aws-rds) ## Warning THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. `TL;DR: Not my problem` ## License The `GPL V2` license applies to this project. All copyrights belong to their respective copyright holders and all trademarks belong to their trademark holders. ``` This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.) ```