diff --git a/01-cloud-and-iac/README.md b/01-cloud-and-iac/README.md index f51cd64..60c16ca 100644 --- a/01-cloud-and-iac/README.md +++ b/01-cloud-and-iac/README.md @@ -1 +1,3 @@ +# 01 - Evolution of Cloud + Infrastructure as Code + This module doesn't have any corresponding code. \ No newline at end of file diff --git a/02-overview/README.md b/02-overview/README.md index e79466b..9fc611b 100644 --- a/02-overview/README.md +++ b/02-overview/README.md @@ -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` diff --git a/03-basics/README.md b/03-basics/README.md index 4761e3f..5a74e69 100644 --- a/03-basics/README.md +++ b/03-basics/README.md @@ -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 +![](./web-app/architecture.png) \ No newline at end of file diff --git a/03-basics/aws-backend/README.md b/03-basics/aws-backend/README.md deleted file mode 100644 index 425ae5b..0000000 --- a/03-basics/aws-backend/README.md +++ /dev/null @@ -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! \ No newline at end of file diff --git a/03-basics/terraform-cloud-backend/README.md b/03-basics/terraform-cloud-backend/README.md deleted file mode 100644 index 63738e1..0000000 --- a/03-basics/terraform-cloud-backend/README.md +++ /dev/null @@ -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 -``` \ No newline at end of file diff --git a/README.md b/README.md index 8f030be..26707cf 100644 --- a/README.md +++ b/README.md @@ -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