|
3 | 3 | import Tabs from '@theme/Tabs'; |
4 | 4 | import TabItem from '@theme/TabItem'; |
5 | 5 | import PersistentCheckbox from '/src/components/PersistentCheckbox'; |
| 6 | +import CustomizableValue from '/src/components/CustomizableValue'; |
6 | 7 |
|
7 | 8 | This guide provides comprehensive instructions for integrating [Gruntwork Pipelines](https://gruntwork.io/products/pipelines/) into an existing GitLab project with Infrastructure as Code (IaC). This is designed for Gruntwork customers who want to add Pipelines to their current infrastructure projects for streamlined CI/CD management. |
8 | 9 |
|
9 | 10 | To configure Gruntwork Pipelines in an existing GitLab project, complete the following steps (which are explained in detail below): |
10 | 11 |
|
11 | | -1. **Plan your Pipelines setup** by identifying all environments and cloud accounts/subscriptions you need to manage. |
12 | | -2. **Bootstrap core infrastructure** in accounts/subscriptions that don't already have the required OIDC and state management resources. |
13 | | -3. **Configure SCM access** using [machine users](/2.0/docs/pipelines/installation/viamachineusers) with appropriate Personal Access Tokens (PATs). |
14 | | -4. **Create `.gruntwork` HCL configurations** to tell Pipelines how to authenticate and organize your environments. |
15 | | -5. **Create `.gitlab-ci.yml`** to configure your GitLab CI/CD pipeline. |
16 | | -6. **Commit and push** your changes to activate Pipelines. |
| 12 | +1. **(If using a self-hosted GitLab instance) Ensure OIDC configuration and JWKS are publicly accessible.** |
| 13 | +2. **Plan your Pipelines setup** by identifying all environments and cloud accounts/subscriptions you need to manage. |
| 14 | +3. **Bootstrap core infrastructure** in accounts/subscriptions that don't already have the required OIDC and state management resources. |
| 15 | +4. **Configure SCM access** using [machine users](/2.0/docs/pipelines/installation/viamachineusers) with appropriate Personal Access Tokens (PATs). |
| 16 | +5. **Create `.gruntwork` HCL configurations** to tell Pipelines how to authenticate and organize your environments. |
| 17 | +6. **Create `.gitlab-ci.yml`** to configure your GitLab CI/CD pipeline. |
| 18 | +7. **Commit and push** your changes to activate Pipelines. |
| 19 | + |
| 20 | +## Ensure OIDC configuration and JWKS are publicly accessible |
| 21 | + |
| 22 | +This step only applies if you are using a self-hosted GitLab instance that is not accessible from the public internet. If you are using GitLab.com or a self-hosted instance that is publicly accessible, you can skip this step. |
| 23 | + |
| 24 | +1. [Follow GitLab's instructions](https://docs.gitlab.com/ci/cloud_services/aws/#configure-a-non-public-gitlab-instance) for hosting your OIDC configuration and JWKS in a public location (e.g. S3 Bucket). This is necessary for both Gruntwork and the AWS OIDC provider to access the GitLab OIDC configuration and JWKS when authenticating JWT's generated by your custom instance. |
| 25 | +2. Note the <CustomizableValue id="ISSUER_URL" /> (stored as `ci_id_tokens_issuer_url` in your `gitlab.rb` file per GitLab's instructions) generated above for reuse in the next steps. |
| 26 | + |
| 27 | +:::note Progress Checklist |
| 28 | + |
| 29 | +<PersistentCheckbox id="configure-oidc-jwks" label="(If using a self-hosted GitLab instance) Configure OIDC and JWKS to be publicly accessible." /> |
| 30 | + |
| 31 | +::: |
17 | 32 |
|
18 | 33 | ## Prerequisites |
19 | 34 |
|
@@ -268,6 +283,23 @@ boilerplate \ |
268 | 283 | --non-interactive |
269 | 284 | ``` |
270 | 285 |
|
| 286 | +If you're using a self-hosted GitLab instance, you'll want to make sure the issuer is set correctly when calling Boilerplate. |
| 287 | + |
| 288 | +```bash |
| 289 | +boilerplate \ |
| 290 | + --template-url 'github.com/gruntwork-io/terragrunt-scale-catalog//templates/boilerplate/aws/gitlab/account?ref=v1.0.0' \ |
| 291 | + --output-folder . \ |
| 292 | + --var 'AccountName=dev' \ |
| 293 | + --var 'GitLabGroupName=acme' \ |
| 294 | + --var 'GitLabRepoName=infrastructure-live' \ |
| 295 | + --var 'GitLabInstanceURL=https://gitlab.com' \ |
| 296 | + --var 'AWSAccountID=123456789012' \ |
| 297 | + --var 'AWSRegion=us-east-1' \ |
| 298 | + --var 'StateBucketName=my-state-bucket' \ |
| 299 | + --var 'Issuer=$$ISSUER_URL$$' \ |
| 300 | + --non-interactive |
| 301 | +``` |
| 302 | + |
271 | 303 | You can also choose to store these values in a YAML file and pass it to Boilerplate using the `--var-file` flag. |
272 | 304 |
|
273 | 305 | ```yaml title="vars.yml" |
|
0 commit comments