Skip to content

Commit

Permalink
update variables description and add notes to 4-projects readme
Browse files Browse the repository at this point in the history
  • Loading branch information
caetano-colin committed Aug 23, 2024
1 parent 814caa2 commit 36aff26
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 9 deletions.
16 changes: 15 additions & 1 deletion 0-bootstrap/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,21 @@ variable "initial_group_config" {
}

variable "cloudbuildv2_repository_config" {
description = "Object structure to bring your own repositories to Foundation."
description = <<-EOT
Configuration for integrating repositories with Cloud Build v2:
- repo_type: Specifies the type of repository. Supported types are 'GITHUBv2', 'GITLABv2', and 'CSR'.
- repositories: A map of repositories to be created. The key must match the exact name of the repository. Each repository is defined by:
- repository_name: The name of the repository.
- repository_url: The URL of the repository.
- github_pat: (Optional) The personal access token for GitHub authentication.
- github_app_id: (Optional) The application ID for a GitHub App used for authentication.
- gitlab_read_authorizer_credential: (Optional) The read authorizer credential for GitLab access.
- gitlab_authorizer_credential: (Optional) The authorizer credential for GitLab access.
Note: When using GITLABv2, specify `gitlab_read_authorizer_credential` and `gitlab_authorizer_credential`.
Note: When using GITHUBv2, specify `github_pat` and `github_app_id`.
Note: If 'cloudbuildv2' is not configured, CSR (Cloud Source Repositories) will be used by default.
EOT
type = object({
repo_type = string # Supported values are: GITHUBv2, GITLABv2 and CSR
# repositories to be created
Expand Down
6 changes: 4 additions & 2 deletions 4-projects/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ To proceed with gitlab as your git provider you will need:
```

> **IMPORTANT**: Take note that on your environment, you will need to update the URL's, github_pat and github_app_id variables.
> **IMPORTANT**: The key name must be exactly the same as the repository_name
1. (Gitlab Only) When bringing your own Gitlab Repositories to Cloud Build you will need to create a variable under `shared.auto.tfvars` with the following format:
Expand All @@ -206,8 +207,9 @@ To proceed with gitlab as your git provider you will need:
}
```
> **IMPORTANT**: Take note that on your environment, you will need to update the URL's, and the gitlab_ prefixed variables.

> **IMPORTANT**: Take note that on your environment, you will need to update the URL's, and the gitlab_prefixed variables.
> **IMPORTANT**: The key name must be exactly the same as the repository_name

1. See any of the envs folder [README.md](./business_unit_1/production/README.md) files for additional information on the values in the `common.auto.tfvars`, `development.auto.tfvars`, `nonproduction.auto.tfvars`, and `production.auto.tfvars` files.
1. See any of the shared folder [README.md](./business_unit_1/shared/README.md) files for additional information on the values in the `shared.auto.tfvars` file.

Expand Down
18 changes: 15 additions & 3 deletions 4-projects/business_unit_1/shared/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,22 @@ variable "tfc_org_name" {
}

variable "cloudbuildv2_repository_config" {
description = "Object structure to bring your own repositories to Foundation."
description = <<-EOT
Configuration for integrating repositories with Cloud Build v2:
- repo_type: Specifies the type of repository. Supported types are 'GITHUBv2', 'GITLABv2', and 'CSR'.
- repositories: A map of repositories to be created. The key must match the exact name of the repository. Each repository is defined by:
- repository_name: The name of the repository.
- repository_url: The HTTPS clone URL of the repository ending in `.git`.
- github_pat: (Optional) The personal access token for GitHub authentication.
- github_app_id: (Optional) The application ID for a GitHub App used for authentication.
- gitlab_read_authorizer_credential: (Optional) The read authorizer credential for GitLab access.
- gitlab_authorizer_credential: (Optional) The authorizer credential for GitLab access.
Note: If 'cloudbuildv2' is not configured, CSR (Cloud Source Repositories) will be used by default.
EOT
type = object({
repo_type = string # Supported values are: GITHUBv2, GITLABv2 and CSR
# repositories to be created
# repositories to be created, the key name must be exactly the same as the repository name
repositories = map(object({
repository_name = string,
repository_url = string,
Expand All @@ -66,7 +78,7 @@ variable "cloudbuildv2_repository_config" {

# If cloudbuildv2 is not configured, then auto-creation with CSR will be used
default = {
repo_type = "CSR"
repo_type = "CSR"
repositories = {}
}
validation {
Expand Down
19 changes: 16 additions & 3 deletions 4-projects/modules/infra_pipelines/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,22 @@ variable "vpc_service_control_attach_dry_run" {
}

variable "cloudbuildv2_repository_config" {
description = "Object structure to bring your own repositories to Foundation."
description = <<-EOT
Configuration for integrating repositories with Cloud Build v2:
- repo_type: Specifies the type of repository. Supported types are 'GITHUBv2', 'GITLABv2', and 'CSR'.
- repositories: A map of repositories to be created. The key must match the exact name of the repository. Each repository is defined by:
- repository_name: The name of the repository.
- repository_url: The HTTPS clone URL of the repository ending in `.git`.
- github_pat: (Optional) The personal access token for GitHub authentication.
- github_app_id: (Optional) The application ID for a GitHub App used for authentication.
- gitlab_read_authorizer_credential: (Optional) The read authorizer credential for GitLab access.
- gitlab_authorizer_credential: (Optional) The authorizer credential for GitLab access.
Note: If 'cloudbuildv2' is not configured, CSR (Cloud Source Repositories) will be used by default.
EOT
type = object({
repo_type = string # Supported values are: GITHUBv2, GITLABv2 and CSR
# repositories to be created
# repositories to be created, the key name must be exactly the same as the repository name
repositories = map(object({
repository_name = string,
repository_url = string,
Expand All @@ -93,7 +105,7 @@ variable "cloudbuildv2_repository_config" {

# If cloudbuildv2 is not configured, then auto-creation with CSR will be used
default = {
repo_type = "CSR"
repo_type = "CSR"
repositories = {}
}
validation {
Expand All @@ -113,3 +125,4 @@ variable "cloudbuildv2_repository_config" {
error_message = "You must specify a valid repo_type ('GITHUBv2', 'GITLABv2', or 'CSR'). For 'GITHUBv2', all 'github_' prefixed variables must be defined and no 'gitlab_' prefixed variables should be defined. For 'GITLABv2', all 'gitlab_' prefixed variables must be defined and no 'github_' prefixed variables should be defined."
}
}

0 comments on commit 36aff26

Please sign in to comment.