Skip to content
This repository was archived by the owner on Feb 21, 2025. It is now read-only.

Commit 3f423c8

Browse files
committed
Initial release
1 parent eb39acd commit 3f423c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+5223
-1
lines changed

.github/workflows/cicd_pipeline.yml

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: "Validation"
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- master
8+
pull_request_target:
9+
types:
10+
- opened
11+
- synchronize
12+
- reopened
13+
- ready_for_review
14+
branches:
15+
- master
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.pull_request.head.ref || github.ref_name }}
19+
cancel-in-progress: true
20+
21+
env:
22+
TFSEC_VERSION: "v1.28.1"
23+
TFLINT_VERSION: "v0.42.2"
24+
25+
jobs:
26+
27+
tfsec:
28+
strategy:
29+
matrix:
30+
provider: [ aws ]
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: hmarr/[email protected]
34+
35+
- name: Configure tfsec binary cache
36+
id: tfsec-cache
37+
uses: actions/cache@v3
38+
with:
39+
path: /usr/local/bin/tfsec
40+
key: tfsec-${{ env.TFSEC_VERSION }}
41+
42+
- name: Install tfsec
43+
if: steps.tfsec-cache.outputs.cache-hit != 'true'
44+
run: |
45+
download_path=$(mktemp -d -t tfsec.XXXXXXXXXX)
46+
download_executable="${download_path}/tfsec"
47+
wget -O "${download_executable}" \
48+
"https://github.com/aquasecurity/tfsec/releases/download/${{ env.TFSEC_VERSION }}/tfsec-linux-amd64"
49+
install "${download_executable}" "/usr/local/bin/tfsec"
50+
51+
- name: Check tfsec version
52+
run: tfsec -v
53+
54+
- uses: actions/checkout@v3
55+
56+
- name: TF Sec
57+
id: tfsec
58+
run: |
59+
result_file="$(mktemp -d)/tfsec_results.txt"
60+
echo "result_file=${result_file}" >> $GITHUB_OUTPUT
61+
tfsec --out="${result_file}" .
62+
63+
- name: Upload TF Sec results
64+
if: always()
65+
uses: actions/upload-artifact@v3
66+
with:
67+
name: TF Sec results
68+
path: ${{ steps.tfsec.outputs.result_file }}
69+
70+
71+
tflint:
72+
strategy:
73+
matrix:
74+
provider: [ aws ]
75+
runs-on: ubuntu-latest
76+
steps:
77+
- uses: hmarr/[email protected]
78+
79+
- name: Configure tflint binary cache
80+
id: tflint-cache
81+
uses: actions/cache@v3
82+
with:
83+
path: /usr/local/bin/tflint
84+
key: tflint-${{ env.TFLINT_VERSION }}
85+
86+
- name: Install tflint
87+
if: steps.tflint-cache.outputs.cache-hit != 'true'
88+
run: |
89+
set -euo pipefail ${ACTIONS_STEP_DEBUG:+-x}
90+
download_path=$(mktemp -d -t tflint.XXXXXXXXXX)
91+
download_zip="${download_path}/tflint.zip"
92+
download_executable="${download_path}/tflint"
93+
wget -O "${download_zip}" \
94+
"https://github.com/terraform-linters/tflint/releases/download/${{ env.TFLINT_VERSION }}/tflint_linux_amd64.zip"
95+
unzip -u "${download_zip}" -d "${download_path}"
96+
install "${download_executable}" "/usr/local/bin/tflint"
97+
98+
- name: Check tflint version
99+
run: tflint -v
100+
101+
- uses: actions/checkout@v3
102+
103+
- name: TF Lint
104+
id: tflint
105+
run: |
106+
set -euo pipefail ${ACTIONS_STEP_DEBUG:+-x}
107+
result_file="$(mktemp -d)/tflint_results.txt"
108+
echo "result_file=${result_file}" >> $GITHUB_OUTPUT
109+
cd "terraform/${{ matrix.provider }}/env"
110+
tflint | tee -a "${result_file}"
111+
112+
- name: Upload TF Lint results
113+
if: always()
114+
uses: actions/upload-artifact@v3
115+
with:
116+
name: TF Lint results
117+
path: ${{ steps.tflint.outputs.result_file }}

.gitignore

+28-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
### Intellij ###
2+
.idea/
3+
*.iws
4+
out/
5+
### macOS ###
6+
# General
7+
.DS_Store
8+
9+
# Thumbnails
10+
._*
11+
12+
### Terraform ###
113
# Local .terraform directories
214
**/.terraform/*
315

@@ -7,13 +19,16 @@
719

820
# Crash log files
921
crash.log
22+
crash.*.log
1023

1124
# Ignore any .tfvars files that are generated automatically for each Terraform run. Most
1225
# .tfvars files are managed as part of configuration and so should be included in
1326
# version control.
1427
#
1528
# example.tfvars
1629

30+
terraform.tfvars
31+
1732
# Ignore override files as they are usually used to override resources locally and so
1833
# are not checked in
1934
override.tf
@@ -22,8 +37,20 @@ override.tf.json
2237
*_override.tf.json
2338

2439
# Include override files you do wish to add to version control using negated pattern
25-
#
2640
# !example_override.tf
2741

2842
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
2943
# example: *tfplan*
44+
plan.json
45+
46+
# Ignore CLI configuration files
47+
.terraformrc
48+
terraform.rc
49+
50+
### Terragrunt ###
51+
# terragrunt cache directories
52+
**/.terragrunt-cache/*
53+
54+
# Terragrunt debug output file (when using `--terragrunt-debug` option)
55+
# See: https://terragrunt.gruntwork.io/docs/reference/cli-options/#terragrunt-debug
56+
terragrunt-debug.tfvars.json

Makefile

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
SHELL := /usr/bin/env bash
2+
ROOT := ${CURDIR}
3+
provider := ${}
4+
var_file := ${}
5+
6+
.PHONY: help
7+
help:
8+
@echo 'Usage:'
9+
@echo ' make init "provider=<REPLACE_ME>" "vars_file=<REPLACE_ME>" Initialize and configure Terraform Backend.'
10+
@echo ' make plan "provider=<REPLACE_ME>" "vars_file=<REPLACE_ME>" Plan all Terraform resources.'
11+
@echo ' make apply "provider=<REPLACE_ME>" "vars_file=<REPLACE_ME>" Create or update Terraform resources.'
12+
@echo ' make destroy "provider=<REPLACE_ME>" "vars_file=<REPLACE_ME>" Destroy all Terraform resources.'
13+
@echo ' make console "provider=<REPLACE_ME>" "vars_file=<REPLACE_ME>" Run terraform console to debug terraform resources.'
14+
@echo ' make lint Check syntax of all scripts.'
15+
@echo ' make docs Generate documentation for terraform modules.'
16+
@echo
17+
18+
# Before you run this command please export the required variables.
19+
# Initialize the environment variables
20+
.PHONY: init
21+
init:
22+
bash $(ROOT)/terraform/$(provider)/scripts/init.sh "$(var_file)"
23+
24+
# Plan the Terraform resources
25+
.PHONY: plan
26+
plan:
27+
bash $(ROOT)/terraform/$(provider)/scripts/plan.sh "$(var_file)"
28+
29+
# Run terraform console for debug
30+
.PHONY: console
31+
console:
32+
bash $(ROOT)/terraform/$(provider)/scripts/console.sh "$(var_file)"
33+
34+
# Apply the Terraform resources
35+
.PHONY: apply
36+
apply:
37+
bash $(ROOT)/terraform/$(provider)/scripts/apply.sh "$(var_file)"
38+
39+
# Destroy the terraform resources
40+
.PHONY: destroy
41+
destroy:
42+
bash $(ROOT)/terraform/$(provider)/scripts/destroy.sh "$(var_file)"
43+
44+
.PHONY: lint
45+
lint: check_shell check_terraform check_shebangs check_tflint check_tfsec
46+
47+
# Shell check
48+
.PHONY: check_shell
49+
check_shell:
50+
source ${ROOT}/test/lint.sh && check_shell
51+
52+
# Terraform check
53+
.PHONY: check_terraform
54+
check_terraform:
55+
source ${ROOT}/test/lint.sh && check_terraform
56+
57+
# Shebangs check
58+
.PHONY: check_shebangs
59+
check_shebangs:
60+
source ${ROOT}/test/lint.sh && check_bash
61+
62+
# TF Lint check
63+
.PHONY: check_tflint
64+
check_tflint:
65+
source ${ROOT}/test/lint.sh && check_tflint
66+
67+
# TF Sec check
68+
.PHONY: check_tfsec
69+
check_tfsec:
70+
source ${ROOT}/test/lint.sh && check_tfsec
71+
72+
# TF documentation
73+
.PHONY: docs
74+
docs:
75+
source ${ROOT}/terraform/common/scripts/docs.sh

README.md

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
## Label Studio Terraform
2+
The LabelStudio terraform module allows users to easily deploy a fully-featured instance of [Label Studio/Label Studio Enterprise](https://labelstud.io/) on multiple cloud providers, including AWS, Google Cloud(support in 2023) and Azure(support in late 2023).
3+
4+
With [Label Studio/Label Studio Enterprise](https://labelstud.io/), users can create custom labeling interfaces, manage the labeling process, and export labeled data for use in machine learning and other applications.
5+
6+
## Introduction
7+
The module provides a set of [pre-defined configuration examples](terraform/aws/examples) that can be easily customized to meet the needs of your project. It includes options for specifying the cloud provider, the region to deploy the Label Studio/Label Studio Enterprise instance, and various other parameters such as the number of replicas and 3rd party integrations.
8+
9+
Using the module, you can quickly set up a Label Studio/Label Studio Enterprise instance that is ready to use, without the need to manually configure and deploy the various components of the system. Whether you are a data scientist, machine learning engineer, or just someone who needs to create high-quality labeled data, the LabelStudio terraform module can help you get up and running quickly and easily on your preferred cloud provider.
10+
11+
## Common prerequisites
12+
13+
| NAME | Version |
14+
|-------------|---------|
15+
| MacOS/Linux | any |
16+
| Terraform | 1.3.6 |
17+
| Helm | 3.10.x |
18+
| kubectl | 1.24.x |
19+
20+
### How to install Terraform
21+
22+
Consult the [Terraform documentation](https://developer.hashicorp.com/terraform/downloads) for specific instructions for your system.
23+
24+
### How to install Helm
25+
26+
Consult the [Helm documentation](https://helm.sh/docs/intro/install/) for specific instructions for your system.
27+
28+
### How to install kubectl
29+
30+
Follow the step from official Kubernetes documentation:
31+
- [Install kubectl on Linux](https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/)
32+
- [Install kubectl on macOS](https://kubernetes.io/docs/tasks/tools/install-kubectl-macos/)
33+
34+
35+
## How to use Makefile
36+
* Terraform scripts stored in different folders. You have to specify your cloud provider to create resources.
37+
* List of supported providers: `aws`.
38+
39+
| Command | Description |
40+
|-----------------------------------------------------------------|----------------------------------------------|
41+
| `make help` | List all the available options to use |
42+
| `make init "provider=<REPLACE_ME>" "vars_file=<REPLACE_ME>"` | Initialize and configure Terraform backend |
43+
| `make plan "provider=<REPLACE_ME>" "vars_file=<REPLACE_ME>"` | Plan all Terraform resources |
44+
| `make apply "provider=<REPLACE_ME>" "vars_file=<REPLACE_ME>"` | Create or update Terraform resources |
45+
| `make destroy "provider=<REPLACE_ME>" "vars_file=<REPLACE_ME>"` | Destroy all Terraform resources |
46+
| `make lint` | Check syntax of all scripts |
47+
| `make docs` | Generate documentation for terraform modules |
48+
49+
50+
## Cloud Providers
51+
52+
### Provider AWS
53+
54+
Link to [AWS Provider Documentation](./terraform/aws/README.md)
55+
56+
## Seeking help
57+
58+
If you run into an issue, bug or have a question, please reach out to the Label Studio
59+
community via [Label Studio Slack Community](https://slack.labelstudio.heartex.com/).

0 commit comments

Comments
 (0)