You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository contains a GitHub Actions workflow to automate Terraform and Terragrunt operations for different environments. The workflow requires certain GitHub secrets to be configured.
44
+
45
+
## Setting Up GitHub Secrets
46
+
47
+
To use this workflow, you'll need to configure the following secrets in your GitHub repository:
48
+
49
+
### 1. Terraform and Terragrunt Versions
50
+
51
+
-**`THE_TG_VERSION`**: The version of Terragrunt to use (e.g., `0.57.0`).
52
+
-**`THE_TF_VERSION`**: The version of Terraform to use (e.g., `1.8.0`).
53
+
54
+
### 2. Terraform Cloud API Token
55
+
56
+
-**`TF_API_TOKEN`**: A Terraform Cloud API token used for authentication.
57
+
58
+
### 3. Environment-Specific Secrets
59
+
60
+
These secrets should be named according to the branch they correspond to (`main`, `stage`, or `dev`):
61
+
62
+
-**`MAIN_TF_WORKSPACE`**: The Terraform workspace for the `main` branch.
63
+
-**`MAIN_TG_WORKDIR`**: The Terragrunt working directory for the `main` branch.
64
+
65
+
-**`STAGE_TF_WORKSPACE`**: The Terraform workspace for the `stage` branch.
66
+
-**`STAGE_TG_WORKDIR`**: The Terragrunt working directory for the `stage` branch.
67
+
68
+
-**`DEV_TF_WORKSPACE`**: The Terraform workspace for the `dev` branch.
69
+
-**`DEV_TG_WORKDIR`**: The Terragrunt working directory for the `dev` branch.
70
+
71
+
### How to Set Up Secrets in GitHub
72
+
73
+
1. Navigate to your repository on GitHub.
74
+
2. Click on the **Settings** tab.
75
+
3. In the left sidebar, click on **Secrets and variables** > **Actions**.
76
+
4. Click the **New repository secret** button.
77
+
5. Add each secret by specifying its name and value, then click **Add secret**.
78
+
79
+
### Example Secret Configuration
80
+
81
+
For a repository that uses Terraform and Terragrunt, you would configure secrets as follows:
82
+
83
+
-**Secret Name**: `THE_TG_VERSION`
84
+
-**Value**: `0.57.0`
85
+
86
+
-**Secret Name**: `THE_TF_VERSION`
87
+
-**Value**: `1.8.0`
88
+
89
+
-**Secret Name**: `TF_API_TOKEN`
90
+
-**Value**: `<your-terraform-cloud-api-token>`
91
+
92
+
-**Secret Name**: `MAIN_TF_WORKSPACE`
93
+
-**Value**: `prod-project`
94
+
95
+
-**Secret Name**: `MAIN_TG_WORKDIR`
96
+
-**Value**: `environment/prod`
97
+
98
+
-**Secret Name**: `STAGE_TF_WORKSPACE`
99
+
-**Value**: `stage-project`
100
+
101
+
-**Secret Name**: `STAGE_TG_WORKDIR`
102
+
-**Value**: `environment/stage`
103
+
104
+
-**Secret Name**: `DEV_TF_WORKSPACE`
105
+
-**Value**: `dev-project`
106
+
107
+
-**Secret Name**: `DEV_TG_WORKDIR`
108
+
-**Value**: `environment/dev`
109
+
110
+
## Usage
111
+
112
+
Once the secrets are configured, the workflow will automatically pick them up and run Terraform and Terragrunt operations when changes are pushed to the `main`, `stage`, or `dev` branches.
113
+
114
+
## License
115
+
116
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
0 commit comments