-
Notifications
You must be signed in to change notification settings - Fork 43
GitLab Account factory docs #2677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
oredavids
wants to merge
8
commits into
main
Choose a base branch
from
ore/dev-1033-update-docs-for-gitlab
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bae8535
Initial docs for GitLab devops-foundations template
oredavids 67545c5
Additional gitlab account factory update
oredavids f9ff008
Rest of account-factory setup
oredavids bec91c9
Fix build
oredavids 95816ec
Update sidebar and page titles
oredavids e46c856
Review suggestions
oredavids c90ad13
Update account vending instructions
oredavids 2047192
Merge branch 'main' into ore/dev-1033-update-docs-for-gitlab
oredavids File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
133 changes: 133 additions & 0 deletions
133
docs/2.0/docs/pipelines/installation/addingnewgitlabrepo.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
# Initial Setup | ||
|
||
To configure Gruntwork Pipelines in a **new** GitLab repository, complete the following steps: | ||
|
||
:::info | ||
To use Gruntwork Pipelines in an **existing** GitLab repository, see this [guide](/2.0/docs/pipelines/installation/addinggitlabrepo). | ||
::: | ||
|
||
oredavids marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
https://github.com/gruntwork-io/terraform-aws-architecture-catalog/tree/main/templates/devops-foundations-infrastructure-live-root | ||
|
||
1. Create a new GitLab project for your `infrastructure-live-root` repository. | ||
1. Install Boilerplate; a CLI tool for generating files from templates. | ||
1. Configure the variables required to run the infrastructure-live-root boilerplate template. | ||
1. Create your `infrastructure-live-root` repository contents using Gruntwork's architecture-catalog template. | ||
1. Apply the account baselines to your AWS accounts. | ||
|
||
## Create a new infrastructure-live-root GitLab project | ||
|
||
1. Navigate to the GitLab group you want to create the project in. | ||
1. Click the **New Project** button. | ||
1. Enter a name for the project. e.g. infrastructure-live-root | ||
1. Click **Create Project**. | ||
1. Clone the project to your local machine. | ||
1. Navigate to the project directory. | ||
|
||
## Install Boilerplate | ||
|
||
If you have already [mise](https://mise.jdx.dev/getting-started.html) installed on your machine, you can simply run `mise use boilerplate`, alternatively you can download it from the [release page](https://github.com/gruntwork-io/boilerplate/releases/). | ||
|
||
|
||
## Configure the variables required to run the boilerplate template | ||
|
||
Copy the following variables to a `vars.yaml` file in the root of your project and update the `<REPLACE>` values with your own. | ||
|
||
```yaml title="vars.yaml" | ||
SCMProvider: GitLab | ||
|
||
# The GitLab group to use for the infrastructure repositories. This should include any additional sub-groups in the name | ||
# Example: acme/prod | ||
SCMProviderGroup: <REPLACE> | ||
|
||
oredavids marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# The GitLab project to use for the infrastructure-live repository. | ||
SCMProviderRepo: infrastructure-live-root | ||
|
||
# The name of the branch to deploy to. | ||
DeployBranchName: main | ||
|
||
# The AWS account ID for the management account | ||
# Example: "123456789012" | ||
AwsManagementAccountId: <REPLACE> | ||
|
||
# The AWS account ID for the security account | ||
# Example: "123456789013" | ||
AwsSecurityAccountId: <REPLACE> | ||
|
||
# The AWS account ID for the logs account | ||
# Example: "123456789014" | ||
AwsLogsAccountId: <REPLACE> | ||
|
||
# The AWS account ID for the shared account | ||
# Example: "123456789015" | ||
AwsSharedAccountId: <REPLACE> | ||
|
||
# The AWS account Email for the logs account | ||
# Example: [email protected] | ||
AwsLogsAccountEmail: <REPLACE> | ||
|
||
# The AWS account Email for the management account | ||
# Example: [email protected] | ||
AwsManagementAccountEmail: <REPLACE> | ||
|
||
# The AWS account Email for the security account | ||
# Example: [email protected] | ||
AwsSecurityAccountEmail: <REPLACE> | ||
|
||
# The AWS account Email for the shared account | ||
# Example: [email protected] | ||
AwsSharedAccountEmail: <REPLACE> | ||
|
||
# The name prefix to use for creating resources e.g S3 bucket for OpenTofu state files | ||
# Example: acme | ||
OrgNamePrefix: <REPLACE> | ||
|
||
# The default region for AWS Resources | ||
# Example: us-east-1 | ||
DefaultRegion: <REPLACE> | ||
|
||
################################################################################ | ||
# OPTIONAL VARIABLES WITH THEIR DEFAULT VALUES. UNCOMMENT AND MODIFY IF NEEDED. | ||
################################################################################ | ||
|
||
# List of the git repositories to populate for the catalog | ||
# CatalogRepositories: | ||
# - github.com/gruntwork-io/terraform-aws-service-catalog | ||
|
||
# The AWS partition to use. | ||
# AWSPartition: aws | ||
|
||
# The name of the IAM role to use for the plan job. | ||
# PlanIAMRoleName: root-pipelines-plan | ||
|
||
# The name of the IAM role to use for the apply job. | ||
# ApplyIAMRoleName: root-pipelines-apply | ||
|
||
# The default tags to apply to all resources. | ||
# DefaultTags: | ||
# "{{ .OrgNamePrefix }}:Team": "DevOps" | ||
|
||
# The version for terraform-aws-security module to use for OIDC provider and roles provisioning | ||
# SecurityModulesVersion: v0.75.18 | ||
|
||
# The URL of the custom SCM provider instance. Set this if you are using a custom instance of GitLab or GitHub. | ||
# CustomSCMProviderInstanceURL: https://gitlab.example.io | ||
|
||
# The relative path from the host server to the custom pipelines workflow repository. Set this if you are using a custom/forked instance of the pipelines workflow. | ||
# CustomWorkflowHostRelativePath: pipelines-workflows | ||
``` | ||
|
||
## Creating the infrastructure-live-root repository | ||
|
||
Gruntwork provides a boilerplate [template](https://github.com/gruntwork-io/terraform-aws-architecture-catalog/tree/main/templates/devops-foundations-infrastructure-live-root) that incorporates best practices while allowing for customization. The template is designed to scaffold a best-practices Terragrunt configurations. It includes patterns for module defaults, global variables, and account baselines. Additionally, it integrates Gruntwork Pipelines | ||
|
||
Run the following command, from the root of your project, to generate the `infrastructure-live-root` repository contents: | ||
|
||
<!-- TODO: Update template version before merging --> | ||
```bash | ||
boilerplate --template-url "[email protected]:gruntwork-io/terraform-aws-architecture-catalog.git//templates/devops-foundations-infrastructure-live-root/?ref=ore/dev-1024-extend-account-factory-templates-for-gitlab" --output-folder . --var-file vars.yaml --non-interactive | ||
``` | ||
|
||
## Apply the account baselines to your AWS accounts | ||
|
||
<!-- TODO: Best way to port/reuse this information: https://github.com/gruntwork-io/infrastructure-live-root-template/blob/main/.github/workflows/templates/infra-root-pr/infra-root-pr.md --> | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,7 @@ This section covers the Pipelines configuration required to deploy an AWS S3 buc | |
``` | ||
2. Create a `vars.yaml` file on your local machine with the following content: | ||
|
||
<Tabs> | ||
<Tabs groupId="platform"> | ||
<TabItem value="GitHub" label="GitHub" default> | ||
```yaml title="vars.yaml" | ||
AccountName: "$$ACCOUNT_NAME$$" | ||
|
@@ -84,7 +84,7 @@ This section covers the Pipelines configuration required to deploy an AWS S3 buc | |
|
||
3. We'll now use that `vars.yaml` file as input to [boilerplate](https://github.com/gruntwork-io/boilerplate) to generate the Terragrunt code for the OIDC Provider and IAM roles. From the root of your repository, run the following command: | ||
|
||
<Tabs> | ||
<Tabs groupId="platform"> | ||
<TabItem value="GitHub" label="GitHub"> | ||
```bash | ||
boilerplate --template-url "[email protected]:gruntwork-io/terraform-aws-architecture-catalog.git//templates/github-actions-single-account-setup?ref=main" --output-folder . --var-file vars.yaml --non-interactive | ||
|
@@ -130,7 +130,7 @@ aws sts get-caller-identity | |
|
||
In the event you already have an OIDC provider for your SCM in the AWS account you can import the existing one: | ||
|
||
<Tabs> | ||
<Tabs groupId="platform"> | ||
<TabItem value="GitHub" label="GitHub"> | ||
``` | ||
cd _global/$$ACCOUNT_NAME$$/github-actions-openid-connect-provider/ | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.