{"id":15065540,"url":"https://github.com/rimubytes/terraform-practice","last_synced_at":"2026-01-28T12:08:45.713Z","repository":{"id":236265485,"uuid":"792260884","full_name":"rimubytes/terraform-practice","owner":"rimubytes","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-30T09:02:11.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-03T17:13:30.435Z","etag":null,"topics":["aws","gitpod-workspace","terraform-modules"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rimubytes.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-26T09:55:13.000Z","updated_at":"2024-05-08T09:23:39.000Z","dependencies_parsed_at":"2024-09-11T17:55:51.060Z","dependency_job_id":"7a8de1c3-d32d-42de-a1f8-382a2cbd7b51","html_url":"https://github.com/rimubytes/terraform-practice","commit_stats":null,"previous_names":["m-murithi/terraform-beginner-bootcamp-2023","rimubytes/terraform-practice"],"tags_count":5,"template":false,"template_full_name":"ExamProCo/terraform-beginner-bootcamp-2023","purl":"pkg:github/rimubytes/terraform-practice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rimubytes%2Fterraform-practice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rimubytes%2Fterraform-practice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rimubytes%2Fterraform-practice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rimubytes%2Fterraform-practice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rimubytes","download_url":"https://codeload.github.com/rimubytes/terraform-practice/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rimubytes%2Fterraform-practice/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28845107,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T10:53:21.605Z","status":"ssl_error","status_checked_at":"2026-01-28T10:53:20.789Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","gitpod-workspace","terraform-modules"],"created_at":"2024-09-25T00:40:44.907Z","updated_at":"2026-01-28T12:08:45.690Z","avatar_url":"https://github.com/rimubytes.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terraform Bootcamp \n\n### Semantic Versioning :mage:\n\nThis Project is going to utilize semantic versioning for its tagging.\n[semver.org](https://semver.org)\nGiven a version number **MAJOR.MINOR.PATCH**, increment the:\n\n- **MAJOR** version when you make incompatible API changes\n- **MINOR** version when you add functionality in a backward compatible manner\n- **PATCH** version when you make backward compatible bug fixes\n\n### Install the Terraform CLI\n\n#### Considerations with the Terraform CLI changes\n- The Terraform CLU installation instructions have changed due to gpg keyring changes. Referred to the latest install CLI instructions via Terraform Documentation and change the scripting for install.\n    [Install Terraform CLI](https://developer.hashicorp.com/terraform/tutorials/aws-get-started/install-cli)\n\n#### Considerations for Linux Distributions\n- Run the command:\n    `cat /etc/*release`\n\n```yml\nDISTRIB_ID=Ubuntu\nDISTRIB_RELEASE=22.04\nDISTRIB_CODENAME=jammy\nDISTRIB_DESCRIPTION=\"Ubuntu 22.04.4 LTS\"\nPRETTY_NAME=\"Ubuntu 22.04.4 LTS\"\nNAME=\"Ubuntu\"\nVERSION_ID=\"22.04\"\nVERSION=\"22.04.4 LTS (Jammy Jellyfish)\"\nVERSION_CODENAME=jammy\nID=ubuntu\nID_LIKE=debian\nHOME_URL=\"https://www.ubuntu.com/\"\nSUPPORT_URL=\"https://help.ubuntu.com/\"\nBUG_REPORT_URL=\"https://bugs.launchpad.net/ubuntu/\"\nPRIVACY_POLICY_URL=\"https://www.ubuntu.com/legal/terms-and-policies/privacy-policy\"\nUBUNTU_CODENAME=jammy\n```\n\n#### Refactoring into Bash Scripts\n- While fixing the Terraform CLI gpg depreciation issues we noice that bash scripts steps were a considerable amount of more code. So we decided to create a bash script to install the Terraform CLI.\n    - This will keep the Gitpod Task File tidy\n    - This allows us an easier time to debug and execute manually Terraform CLI install\n    - This will allow better portability for other projects that need to install Terraform CLI\n\n#### Shebang\n- A Shebang (pronounced Sha-bang) tells the bash script what program that the script will interpret. eg. `#!/bin/bash`\n    [Shebang Docs](https://en.wikipedia.org/wiki/Shebang_(Unix))\n- ChatGPT recommended this format for bash: `#!/usr/bin/env bash`\n    - for portability for different OS distributions\n    - will search the user's PATH for the bash executable\n\n#### Execution Considerations    \n- When executing the bash script we can use the `./` shorthand notation to execute the bash script.\n- e.g `./bin/install_terraform_cli`\n- If we are using a script in .gitpod.yml we need to point the script to a program to interpret it.\ne.g `source ./bin/install_terraform_cli`\n\n#### Linux Permissions Considerations\n- Inorder to make our bash scripts executable we need to change linux permission for the fix to be executable at the user mode.\n```sh\nchmod u+x ./bin/install_terraform_cli\n```\n[Linux permisions](https://en.wikipedia.org/wiki/Chmod)\n\n#### Gitpod Lifecycle (Before, Init Command)\n- Need to be careful when using the init because it will not return if we restart an existing workspace\n[GitPod Docs](https://www.gitpod.io/docs/configure/workspaces/tasks)\n\n#### Working with env vars\n**env command**\n- We can list out all Environment Variables (Env vars) using the 'env' command\n- We can filter specific env vars using grep e.g `env | grep AWS_`\n\n#### Setting and Unsetting env vars\n- In the terminal we can set using `export HELLO='world'`\n- We can unset using `unset HELLO`\n- We can set an env var temporarily when running the command:\n```sh\nHELLO='world' ./bin/print_message\n```\n- Within a bash script we can set env without writing export e.g\n```sh\n#!/usr/bin/env bash\n\nHELLO='world'\necho $HELLO\n```\n\n#### Printing vars\n- We can print an env var using echo e.g `echo $HELLO`\n\n#### Scoping of env vars\n- When you open bash terminals in VSCode it will not be aware of env vars that you have set in another window\n- If you want env vars to persist across all future bash terminals that are open you need to set env vars in your bash profile. e.g `.bash_profile`\n\n#### Persisting env vars in Gitpod\n- We can persist env vars into gitpod by storing them in Gitpod Secrets Storage.\n\n```\ngp env HELLO='world'\n```\n- All future workspaces launched will set the env vars for all bash terminals opened in those workspaces.\n- You can also set env vars in the `.gitpod.yml` but this can only contain non-sensitive env vars\n\n#### AWS CLI Installation\n- AWS CLI is installed for the project via the bash script [`./bin/install_aws_cli`](./bin/install_aws_cli)\n\n[Getting started install (AWS CLI)](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html)\n\n- We can check if our aws credentials is configured correctly by running the following AWS CLI coomand:\n```\naws sts get-caller-identity\n```\n[AWS CLI env vars](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html)\n\n- Need to generate AWS CLI credits from IAM user inorder to use AWS CLI\n\n### Terraform Basics\n#### Terraform Registry\n- Terraform sorces their providers and modules from the Terraform registry which is located at [registry.terraform.io](https://registry.terraform.io/)\n\n- **Providers** is an interface to APIs that will allow you to create resources in terraform\n- **Modules** are a way to make large amounts of terraform code modular, portable and easily shared.\n\n[Random Terraform Provider](https://registry.terraform.io/providers/hashicorp/random)\n\n#### Terraform Console\n- We can see a list of all the Terraform commands by simply typing `terraform`\n\n#### Terraform Init \n- At the start of a new terraform project we will run `terraform init` to download the binaries for the terraform providers that we'll use in this project\n`terraform init`\n\n#### Terraform Plan\n- This will generate out a changeset, about the state of our infrastructure and what will be changed\n- We can output this changeset i.e. \"plan\" to be passed to an apply, but often you can ignore outputting.\n`terraform plan`\n\n#### Terraform Apply\n- This will run a plan and pass the changes to be executed by terraform. Apply shoul prompt us yes or no.\n`terraform apply`\n- If we want to automatically approve an apply we can provide the auto approve flag eg. `terraform apply --auto-approve`\n\n#### Terraform Lock Files\n`.terraform.lock.hcl`\n- Contains the locked versioning for the providers or modules that should be used with this project\n- The Terraform Lock File **should be committed to your Version Control System (VCS) eg. Github**\n\n#### Terraform State Files\n`.terraform.tfstate`\n- Contains infromation about the current state of your infrastructure\n- This file **should not be committed to your Version Control System (VCS) eg. Github**\n- This file can contain sensitive data. If you lose this file, you lose knowing the state of your infrastructure\n\n`.terraform.tfstate.backup`\n- This is the previous state file state.\n\n### Terraform Directory\n- `.terraform` directory contains binaries terraform providers.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frimubytes%2Fterraform-practice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frimubytes%2Fterraform-practice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frimubytes%2Fterraform-practice/lists"}