Hey guys! I wanted to do a quick tutorial on how I created an EC2 module for Terraform. If you want to see the repository it is located in check it out here. This module will do a few things:
The folder structure looks like this:
The top reasons I decided to switch to VS Code as my editor of choice.
To give some additional context, my previous text editor of choice was Sublime Text 3. I swore by it (mostly due to ignorance) and used it for all of my code editing. If I ever found a feature missing I was always just another package away from finding what I needed. However, over time Sublime Text 3 became less and less stable the more packages I added.
Eventually, it became tiring to use an unstable text editor that missed many of the features I wanted…
A quick guide for first timers trying to deploy from your local machine to elastic beanstalk.
First, you need to install the eb cli.
pip install awsebcli --upgrade --user
or
bre install awsebcli
Next, you need to modify your PATH.
Linux:
export PATH=~/.local/bin:$PATH
Mac OS:
export PATH=~/Library/Python/3.7/bin:$PATH
You may want to close and reopen your CLI at this point to source.
Now you will want to run the below command in the directory that your code is in.
eb init
You will want to input your region and if you do not have access keys you will want to create…
If you missed the first 3 workshops, find them here. Here are 3 more AWS Workshops you didn’t know existed.
These are workshops that I have discovered, but have not yet taken the time to complete. I would love to hear about your experiences with them. My hope is that by spreading some awareness of their existence you can learn a ton… for free!
Don’t forget to always clean up your environments to avoid a high bill!
AWS has a ton of documentation, labs, examples, etc. So much so that it is difficult to find the best material to follow. Here are some exceptional workshops catered to helping you learn.
Sometimes your AWS resources predate your Terraform code. Let’s talk about how to import those pre-existing resources into Terraform.
The first thing we are going to want to do is identify what resources need to be imported. In this case, let’s import an S3 bucket.
Before we get started make sure your AWS CLI is configured correctly. You can do this by quickly running aws s3 ls to list any buckets.
My experience with Terraform upgrades from version 0.11 to 0.12 have been really frustrating, until now.
Upgrading Terraform from version 0.11 to 0.12 has been a pain in the butt every time I have done it. (and I have done it many times)
Every time that I go through the process I learn a little something more that makes it a little easier.
Before you even get started there is something you need to fix with module naming. …
Ready to automate your CDN deployment for an S3 website bucket? Let’s build a module to do it for you!
If you want to skip all of the fun the repo with the code we are using is located here. Also, before you get started here go check out my article on creating an S3 website bucket module. This article will be building on the groundwork set there and will assume you have an S3 bucket module.
For this article, I am going to assume that you already have an S3 website created and just want to get it deployed…
Alrighty peeps, let’s create an S3 website module for Terraform! Want to see my code? Find it here!
First we are going to need to create the provider code block in our main.tf.
provider "aws" {
version = "~> 2.0"
region = var.region
}
Here we made sure to set region to var.region so that we can specify the region in our child modules.
Now we need to add in the code block for our S3 Bucket.
resource "aws_s3_bucket" "prod_website" {
bucket_prefix = var.bucket_prefix
acl = "public-read" website {
index_document = "index.html"
error_document = "error.html"
}
}
Now in this…
So, today I discovered how to automate running a terraform fmt and committing it using Github actions!
If you are not aware, GitHub actions are actions that GitHub can run for you automatically to perform various…. actions. These actions will be computed on some virtual machine far far away for just the amount of time needed to perform your action.
If you already know how to setup GitHub actions, you can go find my YAML file here. Find terraform-fmt-commit.yml in that folder.
Terraform is a great human-readable language for creating infrastructure, but it’s still not easy to read if it…
Terraform | DevOps | AWS