Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/GlennChia/terraform-gitlab-aws
IAC to automate GitLab Omnibus installations with Praefect, Gitaly, and runners on AWS
https://github.com/GlennChia/terraform-gitlab-aws
aws eks gitaly gitaly-cluster gitlab gitlab-runner high-availability iac kubernetes praefect terraform
Last synced: 3 months ago
JSON representation
IAC to automate GitLab Omnibus installations with Praefect, Gitaly, and runners on AWS
- Host: GitHub
- URL: https://github.com/GlennChia/terraform-gitlab-aws
- Owner: GlennChia
- License: mit
- Created: 2020-07-15T09:09:10.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-12-03T23:11:03.000Z (almost 4 years ago)
- Last Synced: 2024-06-12T11:27:00.929Z (5 months ago)
- Topics: aws, eks, gitaly, gitaly-cluster, gitlab, gitlab-runner, high-availability, iac, kubernetes, praefect, terraform
- Language: HCL
- Homepage:
- Size: 181 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Terraform GitLab on AWS
# 1. Installations
## 1.1 Windows
Terraform Guide
- [Installation Link](https://learn.hashicorp.com/terraform/getting-started/install)
- Click the "Chocolatey on Windows" tab. Manual installation did not work for me
- Make sure to run as Administrator using Command PromptChocolaty install
- [Installation link](https://chocolatey.org/install#install-step1)
- Install in PowerShell. Run as AdministratorInstall terraform-docs
- Use Chocolaty to install. Run on Command Prompt. [Link](https://github.com/terraform-docs/terraform-docs)
```bash
choco install terraform-docs
```# 2. Instructions
1. Run `terraform init` in each environment's folder
2. Run `terraform get` in the environment's folder to register the local modules
3. Run `terraform validate` to check for syntax errors. Run `terraform fmt` to format code
4. Run `terraform plan` to understand the changes made
5. Run `terraform apply -var-file="terraform.tfvars"` to run with the variables file (Create this file based on `terraform.template.tfvars` provided)
Note: If we want to skip the prompt do `terraform apply -var-file="terraform.tfvars" -auto-approve`
Note: If we want to target only certain resources, we can do `terraform apply -var-file="terraform.tfvars" -target module.eks`
6. Run `terraform destroy` after deployment if used for testing# 3. Directory Structure and best practices
The following links were used to provide guidance on the Directory Structure
- [Medium: Using Terraform at a Production Level](https://medium.com/@njfix6/using-terraform-at-a-production-level-ec1705a19d82)
- [Terraform docs: Creating Modules](https://www.terraform.io/docs/modules/index.html)
- [GitHub repo: Large-size infrastructure using Terraform](https://github.com/antonbabenko/terraform-best-practices/tree/master/examples/large-terraform)Best practices for naming conventions
- [Terraform docs: Naming conventions](https://www.terraform-best-practices.com/naming)
Code Styling
- [Terraform docs: Code styling](https://www.terraform-best-practices.com/code-styling)
- [GitHub: terraform-docs](https://github.com/terraform-docs/terraform-docs)
- [Article: Automatic Terraform documentation with terraform-docs](https://www.unixdaemon.net/cloud/automatic-terraform-documentation-with-terraform-docs/)
- Run `terraform-docs markdown . > README.md` to generate documentation
- For the main file I use `terraform-docs markdown . --no-providers > README.md` because somehow my provider was showing up in requirements instead
- For modules I use `terraform-docs markdown . --no-providers --no-requirements > README.md`Using modules
- [How to create reusable infrastructure with Terraform modules](https://blog.gruntwork.io/@brikis98?source=post_page-----25526d65f73d----------------------)
# 4. Interesting bash tips
**Getting part of the output of a command in bash**
Refer to this [link](https://stackoverflow.com/questions/25116521/how-do-i-get-a-part-of-the-output-of-a-command-in-linux-bash)
Example: This command refers to the first output of the second line
```bash
kubectl get secrets | awk 'NR==2{print $1}'
```**Storing the output of a command in bash in a variable to be referenced elsewhere in a bash file**
Refer to this [link](https://www.tecmint.com/assign-linux-command-output-to-variable/#:~:text=shell%20scripting%20purpose.-,To%20store%20the%20output%20of%20a%20command%20in%20a%20variable,command%20%5Boption%20...%5D)
Example
```bash
token_name=$(kubectl get secrets | awk 'NR==2{print $1}')
```