- Why Terraform
Learning Terraform is crucial for ☁️ cloud engineers because it empowers them to provision and manage cloud resources as code.
This Infrastructure as Code (IaC) approach ensures consistency, scalability, and efficiency in cloud deployments.
Terraform's versatility and support for multiple cloud providers make it a valuable skill for automating infrastructure and orchestrating complex cloud environments, ultimately streamlining operations and reducing manual errors.
. Codeblocks
This code is written in HashiCorp Configuration Language (HCL) and is used to define AWS resources that will be created or managed by Terraform [1]
provider "aws" {
region = "us-east-1" # Change to your preferred AWS region
}
resource "aws_s3_bucket" "my_bucket" {
bucket = "my-unique-bucket-name" # Choose a unique name
acl = "private" # Access control settings
}
Task 1 | Create Github Repo & write up some documentation using Github Flavored Markdown |
---|---|
Task 2 | Set up Gitlab |
Task 3 | Set up Terraform Cloud |
- Finish Task 1
- Finish Task 2
- Finish Task 3
The Terraform CLI installations instructions have changed due to gpg keyring changes. So we need to refer to the new terraform CLI installations instructions via terraform documentation. And change the scripting for install.
While fixing the terraform depreciation issues. We realised the install instructions had to many steps. So we decided to create a bash script to install the terraform CLI. Bash scripit is located at (./bin/install_terraform_cli.sh)
- This will keep the gitpod task file tidy(.gitpod.yml).
- This wil allow better portability for other projects that need terraform CLI.
This project is built against Ubuntu Please consider check your linux distrubution and change according to your distrubution needs. (Check your linux distribution) Example of checking OS version
$ cat /etc/*-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS"
PRETTY_NAME="Ubuntu 22.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.3 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
We need to be careful when using the Init in our .yml file because it will not rerun if we restart an existing workspace.
We can list out all our envirnomnent varaibles .(Env.Vars) using the env
command.
We filter specific env vars using grep eg. env | grep AWS
In the terminal we set using export HELLO= world
In the terminal we unset using unset HELLO
We can set an env var temporarily when just running a command
HELLO='world' ./bin/print_message
Within a bash script we can set env without writing export
#!/usr/bin/env .bash
HELLO='world'
echo $HELLO
We can print an env var using echo eg. echo $HELLO
When you open up new bash terminals in VSCode it will not be awae of env vars that you have set in another window.
If you want to Env Vars to persist all future bash terminals that are open you need to set env vars in your bash profile eg. .bash_profile
We can persist env vars into gitpod by storing them in Gitpod Secrets Storage
gp env HELLO='world'
All future workspaces launched will set the env vars for all bash terminals opened in those workspaces.
You can also set en vars in the .gitpod.yml
but this can only contain non-sensitive env vars.
Task 4 | Create Terrahouse Module |
---|---|
Task 5 | Static Website Hosting |
-
Finish Task 4
-
Finish Task 5
-
State management
-
Changesets
-
Launching and Stop a Gitpod Workspace
-
Configuration launch scripts eg. .Gitpod.yml files
Task 6 | Setting up Terratowns |
---|---|
Task 7 | Terraform cloud and Multi Home Refactor |
- Finish Task 6
- Finish Task 7
Use Control + Shift + m to toggle the tab key moving focus. Alternatively, use esc then tab to move to the next interactive element on the page. No file chosen Attach files by dragging & dropping, selecting or pasting them. Editing terraform-beginner-bootcamp-2023/README.md at main · NickGoko/terraform-beginner-bootcamp-2023