Added readme and updated lab 4-5

This commit is contained in:
Ric Harvey 2024-04-16 23:49:18 +01:00
parent 287016d9e1
commit 9a90ca93e8
Signed by: ric
GPG key ID: CD63CE502B962F16
4 changed files with 48 additions and 7 deletions

View file

@ -1,6 +1,6 @@
## Introduction ## Introduction
First off this lab is entirely optional and also not for the faint hearted. Gitlab CI is currently introducing components to replace the current templates and openTofu will be updated to that as soon as they are supported in self managed runners. If you're not comfortable experimenting and cleaning things up in AWS manually **don't do this lab**. For this I recommend using the terraform template. First off this lab is entirely optional and also not for the faint hearted. Gitlab CI is currently introducing components to replace the current templates and openTofu will be updated to that as soon as they are supported in self managed runners. If you're not comfortable experimenting and cleaning things up in AWS manually **don't do this lab**. For this lab I recommend using the terraform template, I'll update this once the tofu templates are ready.
First things first lets get some things setup. Make sure you have a free account on [https://gitlab.com](https://gitlab.com) First things first lets get some things setup. Make sure you have a free account on [https://gitlab.com](https://gitlab.com)
@ -106,6 +106,15 @@ deploy:
action: start action: start
``` ```
6. Click commit and your build _should_ begin 6. You'll need to manually click deploy in the pipeline view
7. Click commit and your build _should_ begin
![Build Pipeline](./img/build.png) ![Build Pipeline](./img/build.png)
#### Clean Up
You should be able to run the following from your local directory as the state file is configured to be remote.
```bash
tofu destroy
```

View file

@ -1,3 +0,0 @@
https://www.infracost.io/docs/

View file

@ -1 +1,36 @@
Terraform and Tofu Labs for AWS ![Terraform/OpenTofu Labs](./img/terraform-tofu-labs.png)
## Terraform and OpenTofu Labs for AWS
Welcome to the Terraform/Tofu labs for AWS. This set of labs aims to teach you the basics of terraform/tofu, to get you started on your journey. It focuses on deploying resources to AWS (Amazon Web Services) and keeps costs at a minimum.
> [!Note]
> Don't forget to do the clean up steps after the labs to shut down the infrastructure.
#### Requirements
- You'll need an AWS account from [https://aws.amazon.com](https://aws.amazon.com)
- If you want to do lab 4 you'll need an account at [https://gitlab.com](https://gitlab.com)
It's recommended that you are familiar with the linux command line and bash, however you can just copy and past from the tutorials
### Labs
- [Lab 1](./1-getting-started/README.md) - Will get you setup with the tooling and show you the basic commands
- [Lab 2](./2-simple-example/README.md) - Will introduce you to variables
- [Lab 3](./3-remote-states/README.md) - Will help you create and setup remote states using dynamoDB and S3
- [Lab 4](./4-gitlab-ci/README.md) - Will walk you through setting up a Gitlab CI/CD pipeline with Terraform (tofu coming soon)
### Links
- [Terraform](https://terraform.io)
- [OpenTofu](https://opentofu.org/)
### Trouble Shooting
#### No Space left on device
If you experience and issue like below on your CloudShell you'll need to delete any **unused** ```terraform.tfstate``` and ```terraform.tfstate.backup``` in previous directories.
![no space left on disk](./img/no-space.png)
> [!Note]
> Make sure you have run terraform destroy before deleting on-disk state files, otherwise you'll need to manually delete resources in the AWS console to avoid charges!

BIN
img/terraform-tofu-labs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB