Skip to content

Commit d1f29c3

Browse files
authored
fix: Update readme files (terraform-google-modules#399)
* fix seed and cloudbuild project prefix * add network hub projects to base README * change introduction of each project explanation section * fix environment secrets project explanation * add win activation FW rule and add links to explanation pages for the existing rules * add minor detail for groups in the prerequesites section. * update instuctions in 1-org READMEs * update instructions in 2-environments READMEs * add README link in manual step na fix envs folder name * update instructions in 3-networks README * additional instructions for finding the service perimeter names * markdown linting fixes * replace YOUR-ORGANIZATION_ID with YOUR_ORGANIZATION_ID * replace terraform_sa_email with terraform_service_account * fix typos * fix app_infra_pipeline_cloudbuild_sa example
1 parent ca67ba9 commit d1f29c3

Some content is hidden

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

59 files changed

+189
-166
lines changed

0-bootstrap/README-Jenkins.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ Another CICD option is to use Cloud Build & Cloud Source Repos. If you don't hav
66

77
## Overview
88

9-
The objective of the instructions below is to configure the infrastructure that allows you to run CICD deployments for the next stages (`1-org, 2-environments, 3-networks, 4-projects`) using Jenkins. The infrastructure consists in two Google Cloud Platform projects (`cft-seed` and `prj-cicd`) and VPN configuration to connect to your on-prem environment.
9+
The objective of the instructions below is to configure the infrastructure that allows you to run CICD deployments for the next stages (`1-org, 2-environments, 3-networks, 4-projects`) using Jenkins. The infrastructure consists in two Google Cloud Platform projects (`prj-seed` and `prj-cicd`) and VPN configuration to connect to your on-prem environment.
1010

11-
It is a best practice to have two separate projects here (`cft-seed` and `prj-cicd`) for separation of concerns. On one hand, `cft-seed` stores terraform state and has the Service Account able to create / modify infrastructure. On the other hand, the deployment of that infrastructure is coordinated by Jenkins, which is implemented in `prj-cicd` and connected to your Master on-prem.
11+
It is a best practice to have two separate projects here (`prj-seed` and `prj-cicd`) for separation of concerns. On one hand, `prj-seed` stores terraform state and has the Service Account able to create / modify infrastructure. On the other hand, the deployment of that infrastructure is coordinated by Jenkins, which is implemented in `prj-cicd` and connected to your Master on-prem.
1212

1313
**After following the instructions below, you will have:**
14-
- The `cft-seed` project, which contains:
14+
- The `prj-seed` project, which contains:
1515
- Terraform state bucket
1616
- Custom Service Account used by Terraform to create new resources in GCP
1717
- The `prj-cicd` project, which contains:
@@ -20,7 +20,7 @@ It is a best practice to have two separate projects here (`cft-seed` and `prj-ci
2020
- FW rules to allow communication over port 22
2121
- VPN connection with on-prem (or where ever your Jenkins Master is located)
2222
- Custom service account `[email protected]` for the GCE instance.
23-
- This service account is granted the access to generate tokens on the Terraform custom service account in the `cft-seed` project
23+
- This service account is granted the access to generate tokens on the Terraform custom service account in the `prj-seed` project
2424

2525
- **Note: these instructions do not indicate how to create a Jenkins Master.** To deploy a Jenkins Master, you should follow [Jenkins Architecture](https://www.jenkins.io/doc/book/architecting-for-scale/) recommendations.
2626

@@ -135,7 +135,7 @@ You arrived to these instructions because you are using the `jenkins_bootstrap`
135135
1. Open the link in your browser and accept.
136136
137137
1. Run terraform commands.
138-
- After the credentials are configured, we will create the `cft-seed` project (which contains the GCS state bucket and Terraform custom service account) and the `prj-cicd` project (which contains the Jenkins Agent, its custom service account and where we will add VPN configuration)
138+
- After the credentials are configured, we will create the `prj-seed` project (which contains the GCS state bucket and Terraform custom service account) and the `prj-cicd` project (which contains the Jenkins Agent, its custom service account and where we will add VPN configuration)
139139
- **WARNING: Make sure you have commented-out the `cloudbuild_bootstrap` module and enabled the `jenkins_bootstrap` module in the `./main.tf` file**
140140
- **Use Terraform 0.13.6** to run the terraform script with the commands below
141141
```

0-bootstrap/README.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,25 @@ The purpose of this step is to bootstrap a GCP organization, creating all the re
88
1. A GCP [Billing Account](https://cloud.google.com/billing/docs/how-to/manage-billing-account)
99
1. Cloud Identity / Google Workspace (former G Suite) groups for organization and billing admins
1010
1. User account should be used for running this step, service accounts are not supported.
11-
1. Membership in the `group_org_admins` group for user running terraform.
12-
1. Grant the roles mentioned in bootstrap [README.md](https://github.com/terraform-google-modules/terraform-google-bootstrap#permissions), as well as `roles/resourcemanager.folderCreator` for the user running the step.
11+
1. Membership in the `group_org_admins` group for the user running terraform.
12+
1. Grant the roles mentioned in bootstrap module [README.md](https://github.com/terraform-google-modules/terraform-google-bootstrap#permissions), as well as `roles/resourcemanager.folderCreator` for the user running the step.
1313

14-
Further details of permissions required and resources created, can be found in the bootstrap module [documentation.](https://github.com/terraform-google-modules/terraform-google-bootstrap)
14+
Further details of groups, permissions required and resources created, can be found in the bootstrap module [documentation.](https://github.com/terraform-google-modules/terraform-google-bootstrap)
1515

1616
**Note:** when running the examples in this repository, you may receive various errors when applying terraform:
17-
- `Error code 8, message: The project cannot be created because you have exceeded your allotted project quota.`. That means you have reached your [Project creation quota](https://support.google.com/cloud/answer/6330231). In this case you can use this [Request Project Quota Increase](https://support.google.com/code/contact/project_quota_increase) form to request a quota increase. The `terraform_sa_email` created in `0-bootstrap` should also be listed in "Email addresses that will be used to create projects" in that support form. If you face others quota errors, check the [Quota documentation](https://cloud.google.com/docs/quota) for guidence.
17+
18+
- `Error code 8, message: The project cannot be created because you have exceeded your allotted project quota.`. That means you have reached your [Project creation quota](https://support.google.com/cloud/answer/6330231). In this case you can use this [Request Project Quota Increase](https://support.google.com/code/contact/project_quota_increase) form to request a quota increase. The `terraform_service_account` created in `0-bootstrap` should also be listed in "Email addresses that will be used to create projects" in that support form. If you face others quota errors, check the [Quota documentation](https://cloud.google.com/docs/quota) for guidance.
1819
- `Error: Error when reading or editing Organization Not Found : <organization-id>: googleapi: Error 403: The caller does not have permission, forbidden`.
19-
- Check that your user have [Organization Admin](https://cloud.google.com/iam/docs/understanding-roles#resource-manager-roles) predefined role at the Organization level.
20-
- If this is the case, try the following:
21-
```
22-
gcloud auth application-default login
23-
gcloud auth list # <- confirm that correct account has a star next to it
24-
```
25-
- Re-run `terraform` after.
20+
- Check that your user have [Organization Admin](https://cloud.google.com/iam/docs/understanding-roles#resource-manager-roles) predefined role at the Organization level.
21+
- If this is the case, try the following:
22+
```
23+
gcloud auth application-default login
24+
gcloud auth list # <- confirm that correct account has a star next to it
25+
```
26+
- Re-run `terraform` after.
2627
- `Error: Error setting billing account "XXXXXX-XXXXXX-XXXXXX" for project "projects/some-project": googleapi: Error 400: Precondition check failed., failedPrecondition`. Most likely this is related to billing quota issue.
27-
- To confirm this, try `gcloud alpha billing projects link projects/some-project --billing-account XXXXXX-XXXXXX-XXXXXX`.
28-
- If output states `Cloud billing quota exceeded`, please request increase via [https://support.google.com/code/contact/billing_quota_increase](https://support.google.com/code/contact/billing_quota_increase).
28+
- To confirm this, try `gcloud alpha billing projects link projects/some-project --billing-account XXXXXX-XXXXXX-XXXXXX`.
29+
- If output states `Cloud billing quota exceeded`, please request increase via [https://support.google.com/code/contact/billing_quota_increase](https://support.google.com/code/contact/billing_quota_increase).
2930
3031
## 0-bootstrap usage to deploy Jenkins
3132
@@ -77,13 +78,13 @@ Currently, the bucket information is replaced in the state backends as a part of
7778
|------|-------------|
7879
| cloudbuild\_project\_id | Project where CloudBuild configuration and terraform container image will reside. |
7980
| csr\_repos | List of Cloud Source Repos created by the module, linked to Cloud Build triggers. |
80-
| gcs\_bucket\_cloudbuild\_artifacts | Bucket used to store Cloud/Build artefacts in CloudBuild project. |
81+
| gcs\_bucket\_cloudbuild\_artifacts | Bucket used to store Cloud/Build artifacts in CloudBuild project. |
8182
| gcs\_bucket\_tfstate | Bucket used for storing terraform state for foundations pipelines in seed project. |
8283
| kms\_crypto\_key | KMS key created by the module. |
8384
| kms\_keyring | KMS Keyring created by the module. |
8485
| seed\_project\_id | Project where service accounts and core APIs will be enabled. |
85-
| terraform\_sa\_email | Email for privileged service account for Terraform. |
8686
| terraform\_sa\_name | Fully qualified name for privileged service account for Terraform. |
87+
| terraform\_service\_account | Email for privileged service account for Terraform. |
8788
8889
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
8990
@@ -93,4 +94,4 @@ Currently, the bucket information is replaced in the state backends as a part of
9394
9495
- [gcloud sdk](https://cloud.google.com/sdk/install) >= 206.0.0
9596
- [Terraform](https://www.terraform.io/downloads.html) >= 0.13.6
96-
- You should use the same version in the manual steps during 0-bootstrap to avoid possible [Terraform State Snapshot Lock](https://github.com/hashicorp/terraform/issues/23290) errors caused by differences in terraform versions. This can usually be resolved with a version upgrade.
97+
- You should use the same version in the manual steps during 0-bootstrap to avoid possible [Terraform State Snapshot Lock](https://github.com/hashicorp/terraform/issues/23290) errors caused by differences in terraform versions. This can usually be resolved with a version upgrade.

0-bootstrap/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ resource "google_folder_iam_member" "folder_tf_compute_security_resource_admin"
214214
# billing_account = var.billing_account
215215
# group_org_admins = var.group_org_admins
216216
# default_region = var.default_region
217-
# terraform_sa_email = module.seed_bootstrap.terraform_sa_email
217+
# terraform_service_account = module.seed_bootstrap.terraform_sa_email
218218
# terraform_sa_name = module.seed_bootstrap.terraform_sa_name
219219
# terraform_state_bucket = module.seed_bootstrap.gcs_bucket_tfstate
220220
# sa_enable_impersonation = true

0-bootstrap/modules/jenkins-agent/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module "jenkins_bootstrap" {
2323
billing_account = "<BILLING_ACCOUNT_ID>"
2424
group_org_admins = "[email protected]"
2525
default_region = "us-central1"
26-
terraform_sa_email = "<SERVICE_ACCOUNT_EMAIL>" # normally module.seed_bootstrap.terraform_sa_email
26+
terraform_service_account = "<SERVICE_ACCOUNT_EMAIL>" # normally module.seed_bootstrap.terraform_sa_email
2727
terraform_sa_name = "<SERVICE_ACCOUNT_NAME>" # normally module.seed_bootstrap.terraform_sa_name
2828
terraform_state_bucket = "<GCS_STATE_BUCKET_NAME>" # normally module.seed_bootstrap.gcs_bucket_tfstate
2929
sa_enable_impersonation = true
@@ -76,8 +76,8 @@ module "jenkins_bootstrap" {
7676
| service\_account\_prefix | Name prefix to use for service accounts. | `string` | `"sa"` | no |
7777
| storage\_bucket\_labels | Labels to apply to the storage bucket. | `map(string)` | `{}` | no |
7878
| storage\_bucket\_prefix | Name prefix to use for storage buckets. | `string` | `"bkt"` | no |
79-
| terraform\_sa\_email | Email for terraform service account. It must be supplied by the seed project | `string` | n/a | yes |
8079
| terraform\_sa\_name | Fully-qualified name of the terraform service account. It must be supplied by the seed project | `string` | n/a | yes |
80+
| terraform\_service\_account | Email for terraform service account. It must be supplied by the seed project | `string` | n/a | yes |
8181
| terraform\_state\_bucket | Default state bucket, used in Cloud Build substitutions. It must be supplied by the seed project | `string` | n/a | yes |
8282
| terraform\_version | Default terraform version. | `string` | `"0.13.6"` | no |
8383
| terraform\_version\_sha256sum | sha256sum for default terraform version. | `string` | `"55f2db00b05675026be9c898bdd3e8230ff0c5c78dd12d743ca38032092abfc9"` | no |
@@ -135,7 +135,7 @@ Error: google: could not find default credentials. See https://developers.google
135135
```
136136

137137
```
138-
Error: Error setting billing account "aaaaaa-bbbbbb-cccccc" for project "projects/cft-jenkins-dc3a": googleapi: Error 400: Precondition check failed., failedPrecondition
138+
Error: Error setting billing account "aaaaaa-bbbbbb-cccccc" for project "projects/prj-jenkins-dc3a": googleapi: Error 400: Precondition check failed., failedPrecondition
139139
on .terraform/modules/jenkins/terraform-google-project-factory-7.1.0/modules/core_project_factory/main.tf line 96, in resource "google_project" "main":
140140
96: resource "google_project" "main" {
141141
```

0-bootstrap/modules/jenkins-agent/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ variable "tunnel1_bgp_session_range" {
141141
/* ----------------------------------------
142142
Specific to Seed Project
143143
---------------------------------------- */
144-
variable "terraform_sa_email" {
144+
variable "terraform_service_account" {
145145
description = "Email for terraform service account. It must be supplied by the seed project"
146146
type = string
147147
}

0-bootstrap/outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ output "seed_project_id" {
1919
value = module.seed_bootstrap.seed_project_id
2020
}
2121

22-
output "terraform_sa_email" {
22+
output "terraform_service_account" {
2323
description = "Email for privileged service account for Terraform."
2424
value = module.seed_bootstrap.terraform_sa_email
2525
}
@@ -44,7 +44,7 @@ output "cloudbuild_project_id" {
4444
}
4545

4646
output "gcs_bucket_cloudbuild_artifacts" {
47-
description = "Bucket used to store Cloud/Build artefacts in CloudBuild project."
47+
description = "Bucket used to store Cloud/Build artifacts in CloudBuild project."
4848
value = module.cloudbuild_bootstrap.gcs_bucket_cloudbuild_artifacts
4949
}
5050

0 commit comments

Comments
 (0)