Skip to content

Commit

Permalink
add initial files and README
Browse files Browse the repository at this point in the history
  • Loading branch information
OkayItsMikael committed Nov 1, 2024
1 parent a16b513 commit 05a050a
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 0 deletions.
61 changes: 61 additions & 0 deletions {{cookiecutter.project_slug}}/terraform/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Local .terraform directories
**/.terraform/*

# .tfstate files
*.tfstate
*.tfstate.*

# Crash log files
crash.log
crash.*.log

# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json

# Include override files you do wish to add to version control using negated pattern
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

# Ignore CLI configuration files
.terraformrc
terraform.rc

# Ignore Mac/OSX system files
.DS_Store

# Ignore any compiled binaries
*.exe
*.exe~
*.dll
*.so
*.dylib

# Ignore any log files
*.log

# Ignore the dist folder which might contain built artifacts
dist/

# Ignore any local environment files
.env

# Ignore any temporary files
*.tmp
*.bak
*.swp

# Ignore .pem files
*.pem
59 changes: 59 additions & 0 deletions {{cookiecutter.project_slug}}/terraform/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Terraform AWS Configuration

This folder contains the files necessary to deploy a front-end app, server, and database to AWS.

## Quickstart

`cd` into to this folder, then run:

```
terraform init
terraform plan
terraform apply
```

## Prerequisites

### 1. [Install AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html#getting-started-install-instructions)

### 2. Configure AWS Profile

Log in to the [console](https://aws.amazon.com/console), and [generate an access key](https://docs.aws.amazon.com/IAM/latest/UserGuide/access-key-self-managed.html). Then set up a profile for this account locally by running the following command:

```
aws configure --profile <profile_name>
```

### 3. Initialize Terraform

If it's your first time deploying from this directory, run `terraform init`. This will download

### 4. Deploy

`terraform plan`

## Reference

### Terraform

- [Terraform Docs](https://developer.hashicorp.com/terraform/intro) - _On this page there's a helpful 18 minute video on what Terraform is and how it works, worth watching_
- [Terraform AWS Tutorial](https://developer.hashicorp.com/terraform/tutorials/aws-get-started) - _You can start from the top and go through everything, or just pick a section you'd like to understand better_
- [Terraform AWS Provider Docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) - _This is where you'll find all the details for configuring each of the resources in these configuration files_

### AWS

#### Networking

- [VPC User Guide](https://docs.aws.amazon.com/vpc/latest/userguide/what-is-amazon-vpc.html) - _For understanding `Subnets`, `Route Tables`, and `Internet Gateways`. Also explains `Security Groups`, a fundamental concept_
- [ELB User Guide](https://docs.aws.amazon.com/elasticloadbalancing/latest/userguide/what-is-load-balancing.html) - _For understanding `Load Balancers`, `Listeners`, and `Target Groups`_

#### Access Management

- [IAM User Guide](https://docs.aws.amazon.com/IAM/latest/UserGuide/getting-started.html) - _For understanding IAM `Identities`, `Roles`, and `Policies`_

#### Database

- [RDS User Guide](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Welcome.html) - _For understanding database deployment details_

#### Application Deployment
- [ECS Docs](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/Welcome.html) - _For understanding how to run Dockerized applications_
13 changes: 13 additions & 0 deletions {{cookiecutter.project_slug}}/terraform/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}

provider "aws" {
region = "us-east-1"
profile = var.aws_profile
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file is where you can store values for variables that are declared in your configuration
# If you provide a value here, you won't be prompted for each value when running `terraform apply`
profile="tn-staging"
6 changes: 6 additions & 0 deletions {{cookiecutter.project_slug}}/terraform/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# This file is where you'll store any variables used in your configuration
variable "aws_profile" {
type = string
description = "The AWS profile to use for deployment"
default = "default"
}

0 comments on commit 05a050a

Please sign in to comment.