Skip to content

shehzadashiq/terraform-beginner-bootcamp-2023

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform Beginner Bootcamp 2023

Semantic Versioning 🧙

This project is going to utilise semantic tagging for its versioning. semver.org

The general format:

MAJOR.MINOR.PATCH, e.g. 1.0.1

  • MAJOR version when you make incompatible API changes
  • MINOR version when you add functionality in a backward compatible manner
  • PATCH version when you make backward compatible bug fixes

Install the Terraform CLI

Considerations with the Terraform CLI changes

The previous instructions in the .gitpod.yml file had deprecated instructions which caused keyring issues. Referred to the Terraform installation instructions and updated accordingly.

Install Terraform CLI

Refactoring into Bash Scripts

While fixing the Terraform CLI gpg depreciation issues we notice that bash scripts steps were a considerable amount more code. So we decided to create a bash script to install the Terraform CLI.

The updated instructions were more detailed. To simplify this and reduce the amount of code in gitpod.yml the steps were placed in a bash script file and referenced via the gitpod.yml file.

The bash script is located here: ./bin/install_terraform_cli

  • This will keep the Gitpod Task File (.gitpod.yml) tidy.
  • This allow us an easier to debug and execute manually Terraform CLI install
  • This will allow better portablity for other projects that need to install Terraform CLI.

Considerations for Linux Distribution

This project is built against Ubunutu. Please consider checking your Linux Distrubtion and change accordingly to distrubtion needs.

How To Check OS Version in Linux

Example of checking OS Version:

$ cat /etc/os-release
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

Shebang Considerations

A Shebang (prounced Sha-bang) tells the bash script what program that will interpet the script. eg. #!/bin/bash

ChatGPT recommended this format for bash: #!/usr/bin/env bash

  • For portability for different OS distributions
  • Will search the user's PATH for the bash executable

(Shebang)[https://en.wikipedia.org/wiki/Shebang_(Unix)]

Execution Considerations

When executing the bash script we can use the ./ shorthand notiation to execute the bash script.

eg. ./bin/install_terraform_cli

If we are using a script in .gitpod.yml we need to point the script to a program to interpret it.

eg. source ./bin/install_terraform_cli

Linux Permissions Considerations

In order to make our bash scripts executable we need to change linux permission for the fix to be executable at the user mode.

chmod u+x /bin/install_terraform_cli

alternatively:

chmod 744 /bin/install_terraform_cli

(CHMOD) [https://en.wikipedia.org/wiki/Chmod]

Github Lifecycle (Before, Init, Command)

We need to be careful when using the Init because it will not rerun if we restart an existing workspace.

Gitpod Tasks

About

Terraform Beginner Bootcamp

Resources

License

Stars

Watchers

Forks

Packages

No packages published