mirror of
https://github.com/sidpalas/devops-directive-terraform-course.git
synced 2025-12-10 04:41:14 +00:00
Update readmes for modules 1-3
This commit is contained in:
@@ -1 +1,3 @@
|
||||
# 01 - Evolution of Cloud + Infrastructure as Code
|
||||
|
||||
This module doesn't have any corresponding code.
|
||||
@@ -1,8 +1,22 @@
|
||||
## 02 - Overview + Setup
|
||||
|
||||
## Install Terraform
|
||||
1) install terraform
|
||||
|
||||
Official installation instructions from HashiCorp: https://learn.hashicorp.com/tutorials/terraform/install-cli
|
||||
|
||||
## AWS Account Setup
|
||||
2) create non-root AWS user
|
||||
3) Add AmazonEC2FullAccess
|
||||
4) Save Access key + secret key (or use AWS CLI `aws configure` -- https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html)
|
||||
|
||||
AWS Terraform provider documentation: https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication
|
||||
|
||||
1) create non-root AWS user
|
||||
2) Add the necessary IAM roles (e.g. AmazonEC2FullAccess)
|
||||
3) Save Access key + secret key (or use AWS CLI `aws configure` -- https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html)
|
||||
|
||||
## Hello World
|
||||
|
||||
`./main.tf` contains minimal configuration to provision an EC2 instance.
|
||||
|
||||
1) `aws configure`
|
||||
2) `terraform init`
|
||||
3) `terraform plan`
|
||||
4) `terraform apply`
|
||||
|
||||
@@ -1,4 +1,45 @@
|
||||
1) Create account credentials
|
||||
## 03 - Basics
|
||||
|
||||
## Remote Backends
|
||||
|
||||
Remote backends enable storage of TF state in a remote, location to enable secure collaboration.
|
||||
|
||||
### Terraform Cloud
|
||||
|
||||
https://www.terraform.io/cloud
|
||||
|
||||
`./terraform-cloud-backend/main.tf`
|
||||
|
||||
### AWS S3 + Dynamo DB
|
||||
|
||||
Steps to initialize backend in AWS and manage it with Terraform:
|
||||
|
||||
1) Use config from `./aws-backend/` (init, plan, apply) to provision s3 bucket and dynamoDB table with local state
|
||||
2) Uncomment the remote backend configuration
|
||||
3) Reinitialize with `terraform init`:
|
||||
|
||||
```
|
||||
Do you want to copy existing state to the new backend?
|
||||
Pre-existing state was found while migrating the previous "local" backend to the
|
||||
newly configured "s3" backend. No existing state was found in the newly
|
||||
configured "s3" backend. Do you want to copy this state to the new "s3"
|
||||
backend? Enter "yes" to copy and "no" to start with an empty state.
|
||||
|
||||
Enter a value: yes
|
||||
```
|
||||
|
||||
Now the S3 bucket and dynamoDB table are mam and are able to be used as the state backend!
|
||||
|
||||
## Web-App
|
||||
|
||||
Generic web application architecture including:
|
||||
- EC2 instances
|
||||
- S3 bucket
|
||||
- RDS instance
|
||||
- Load balancer
|
||||
- Route 53 DNS config
|
||||
|
||||
This example will be refined and improved in later modules.
|
||||
|
||||
## Architecture
|
||||

|
||||
@@ -1,27 +0,0 @@
|
||||
Steps to initialize backend in AWS and manage it with Terraform:
|
||||
|
||||
1) Use config from `bootstrap` (init, plan, apply) to provision s3 bucket and dynamoDB table with local state
|
||||
2) Uncomment the remote backend configuration
|
||||
```
|
||||
backend "s3" {
|
||||
bucket = "devops-directive-tf-state"
|
||||
key = "tf-infra/terraform.tfstate"
|
||||
region = "us-east-1"
|
||||
dynamodb_table = "terraform-state-locking"
|
||||
encrypt = true
|
||||
}
|
||||
```
|
||||
|
||||
1) Reinitialize with `terraform init`:
|
||||
|
||||
```
|
||||
Do you want to copy existing state to the new backend?
|
||||
Pre-existing state was found while migrating the previous "local" backend to the
|
||||
newly configured "s3" backend. No existing state was found in the newly
|
||||
configured "s3" backend. Do you want to copy this state to the new "s3"
|
||||
backend? Enter "yes" to copy and "no" to start with an empty state.
|
||||
|
||||
Enter a value: yes
|
||||
```
|
||||
|
||||
Now the S3 bucket and dynamoDB table are managed by Terraform and are able to be used as the state backend!
|
||||
@@ -1,8 +0,0 @@
|
||||
## Terraform Cloud Account Setup
|
||||
1) Create account at terraform.io
|
||||
2) Use terraform login
|
||||
3) Set any necessary credentials for whichever cloud services you are using because with terraform cloud backend, the plan/apply are actually run remotely.
|
||||
```
|
||||
# AWS_ACCESS_KEY_ID
|
||||
# AWS_SECRET_ACCESS_KEY
|
||||
```
|
||||
@@ -10,11 +10,11 @@ High level overview of the evolution of cloud computing and infrastructure as co
|
||||
|
||||
This module does not have any corresponding code.
|
||||
|
||||
## 02 - Overview
|
||||
## 02 - Overview + Setup
|
||||
|
||||
Terraform overview and setup instructions.
|
||||
|
||||
Includes super basic `hello world` terraform config to provision a single AWS EC2 instance.
|
||||
Includes basic `hello world` terraform config to provision a single AWS EC2 instance.
|
||||
|
||||
## 03 - Basics
|
||||
|
||||
|
||||
Reference in New Issue
Block a user