All Projects → drecom → terraform-onboarding

drecom / terraform-onboarding

Licence: other
A Terraform workshop for junior IT infrastructure engineer & DevOps engineer & SRE.

Programming Languages

HCL
1544 projects

Projects that are alternatives of or similar to terraform-onboarding

node-express-reddit-clone
Build a Node, Express and MySQL-based clone of Reddit for DecodeMTL web development bootcamp
Stars: ✭ 28 (+7.69%)
Mutual labels:  workshop
2017-summer-workshop
Exercises, data, and more for our 2017 summer workshop (funded by the Estes Fund and in partnership with Project Jupyter and Berkeley's D-Lab)
Stars: ✭ 33 (+26.92%)
Mutual labels:  workshop
ws-ldn-1
Clojure/Clojurescript workshop (2-4 Nov 2015, London)
Stars: ✭ 22 (-15.38%)
Mutual labels:  workshop
theia-workshop
Theia Workshop - Building Cloud and Desktop IDEs
Stars: ✭ 38 (+46.15%)
Mutual labels:  workshop
gis-for-geoscientists
Repository for "GIS for Geoscientists" workshop series. This repo contains data, protocols, outputs, lectures, and resources used the workshop. Course taught by Nicholas Barber. Available for future booking upon request! Contact me ([email protected]) for a quote.
Stars: ✭ 19 (-26.92%)
Mutual labels:  workshop
bioc 2020 tidytranscriptomics
Workshop on tidytranscriptomics: Performing tidy transcriptomics analyses with tidybulk, tidyverse and tidyheatmap
Stars: ✭ 25 (-3.85%)
Mutual labels:  workshop
pythonworkshops
Materials for Python workshops
Stars: ✭ 28 (+7.69%)
Mutual labels:  workshop
gansoi
👽 Awesome Infrastructure Monitoring and Alerting
Stars: ✭ 31 (+19.23%)
Mutual labels:  sre
react-portfolio
⚛️ A workshop for ReactJS.
Stars: ✭ 36 (+38.46%)
Mutual labels:  workshop
introduction-to-neural-networks
No description or website provided.
Stars: ✭ 23 (-11.54%)
Mutual labels:  workshop
workshop
React Workshop
Stars: ✭ 13 (-50%)
Mutual labels:  workshop
csharpworkshop
Workshop content on Learning C# on Linux using .NET Core
Stars: ✭ 33 (+26.92%)
Mutual labels:  workshop
jarvis-workshop
Amazon re:Invent workshop - "Alexa, Ask Jarvis to Create a Serverless App for Me" -
Stars: ✭ 14 (-46.15%)
Mutual labels:  workshop
touchdesigner-summit-2019-external-python
No description or website provided.
Stars: ✭ 35 (+34.62%)
Mutual labels:  workshop
workshop-php
Workshop inicialmente criado pela comunidade PHPWomenRJ
Stars: ✭ 28 (+7.69%)
Mutual labels:  workshop
lambdajam
Workshop on Program Transformations
Stars: ✭ 22 (-15.38%)
Mutual labels:  workshop
clojure-workshop
Basic Clojure training material for a one day workshop
Stars: ✭ 28 (+7.69%)
Mutual labels:  workshop
gtcdk8s
Courseware for a Docker + Kubernetes workshop
Stars: ✭ 15 (-42.31%)
Mutual labels:  workshop
ScribeBot
A highly scriptable automation system full of cool features. Automate everything with a little bit of Lua.
Stars: ✭ 72 (+176.92%)
Mutual labels:  workshop
tensorflow-k8s-azure
Train TensorFlow Models at Scale with Kubernetes and Kubeflow on Azure
Stars: ✭ 44 (+69.23%)
Mutual labels:  workshop

i18n

日本語版はこちらになります

What's Terraform

Terraform is an IaC(infrastructure as code) software tool, which created by HashiCorp.
Listed as a recommended tool for Infrastructure Provisioning at DevOps Roadmap,
Terraform is a perfect tool for those engaged in occupations such as IT infrastructure engineer, DevOps engineer, and SRE.

Getting Started

  • Based on the content for help junior SRE onboarding used in-house. -> Drecom
  • A practice repository for using terraform via hands-on to show you how terraform working and what's Drecom-style.
  • Please note that the Drecom-style terraform usage patterns are included, these may not be best practice but we use them for our daily work.
  • AWS Resources used:
    • IAM
    • S3
    • Api-gateway
    • Lambda function
    • ECR
    • App Runner

Who might be interested

  • Terraform beginners
  • Junior DevOps engineers
  • Junior SREs
  • etc.

Prerequisite

  • Terminal application(e.g. iTerm2, wsl2)
  • curl
  • AWS account(with access key & secret access key)
  • A modern browser
  • Terraform(0.12+)
    • Used Ver. 1.0.0 here
  • docker

Usage

  • Set your AWS Credentials into a example file
    • service_account_id = ""
    • aws_access_key = ""
    • aws_secret_key = ""
    • region = "ap-northeast-1"
$ mv terraform.tfvars.example terraform.tfvars
$ vi terraform.tfvars
  • To prevent the resources of each environment (staging, production, etc.) from being influenced by each other, Drecom use terraform workspace to get it done.
  • Firstly, make a workspace called 'common' to build IAM, S3 bucket resources to your AWS env, via terraform plan & apply
  • Secondly, make a workspace called 'system' to build lambda-function, api-gateway, ecr resources to your AWS env, via terraform plan & apply
  • Finally, make a workspace called 'production' to build apprunner resources to your AWS env, via terraform plan & apply
    • Be free to add other .tf files to see how to build others resources.
    • Discussion with your partner based on issues, and see what you can do togerther.
  • Don't forget to clear up all AWS resources after workshop, or you may recieve a surprise bill from AWS. :)

Workshop

You may found the tfstate files are stored here in the local environment,
but the truth is we do all that stuff via CI tool(gitlab-ci, in our case),
since it has some sensitive information that not suitable to be published, so let's do it locally here.

1)Build common resources

$ git clone [email protected]:drecom/terraform-onboarding.git
$ cd terraform-onboarding
$ mv terraform.tfvars.example terraform.tfvars
$ vi terraform.tfvars
# Several variables are defined by variables.tf   
# Before running other command, you may take a look at it.  
$ vi variables.tf
$ terraform init
# show all existing workspaces
$ terraform workspace list
$ terraform workspace select common
$ terraform plan
$ terraform apply

2)Build system resources

2-1)Upload lambda function to S3 bucket

See drecom/demo-box's README for more details.

2-2)Build resources

$ terraform workspace select system
$ terraform plan
$ terraform apply

2-3)Say hello to lambda function

# on workspace system
$ terraform output | grep deployment-invoke-url | awk '{print $3}' | xargs curl
{"drecom": "with entertainment <TIME_NOW+0900>"}

3)Build production resources

3-1) Push application image to AWS ECR

See sample-app's README for more details.

3-2) Build resources

$ terraform workspace select production
$ terraform plan
# It usually takes several minutes
$ terraform apply

3-3) Access the output's URL via browser

  • apprunner-url

3-option) Create an EC2 instance and install nginx

$ terraform workspace select production
# switch “production = false” to “production = true”
$ vi ec2_variables.tf
$ terraform plan
# It usually takes several minutes
$ terraform apply
# until instance healthy(about 3min)
# check it via AWS console
$ terraform output | grep practice-ec2-public-dns | awk '{print $3}' | xargs curl

Don't forget to clear up resources after workshop

$ terraform workspace select production
$ terraform destroy
$ terraform workspace select system
$ terraform destroy
$ terraform workspace select common
$ terraform destroy

Tips

  • We use some runtime manager to help us handling different versions of terraform. (e.g.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].