Skip to content

Commit 1038c4d

Browse files
yliaoggtsorbo
andauthored
feat: added appfactory for other 5 apps (#79)
Co-authored-by: Grant Sorbo <[email protected]>
1 parent a34e751 commit 1038c4d

35 files changed

+1326
-20
lines changed
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2+
## Inputs
3+
4+
| Name | Description | Type | Default | Required |
5+
|------|-------------|------|---------|:--------:|
6+
| billing\_account | Billing Account ID for application admin project resources. | `string` | n/a | yes |
7+
| bucket\_force\_destroy | When deleting a bucket, this boolean option will delete all contained objects. If false, Terraform will fail to delete buckets which contain objects. | `bool` | `false` | no |
8+
| bucket\_prefix | Name prefix to use for buckets created. | `string` | `"bkt"` | no |
9+
| common\_folder\_id | Folder ID in which to create all application admin projects | `string` | n/a | yes |
10+
| envs | n/a | `map(any)` | n/a | yes |
11+
| location | Location for build buckets. | `string` | `"us-central1"` | no |
12+
| org\_id | Google Cloud Organization ID. | `string` | n/a | yes |
13+
| tf\_apply\_branches | List of git branches configured to run terraform apply Cloud Build trigger. All other branches will run plan by default. | `list(string)` | <pre>[<br> "development",<br> "non\\-production",<br> "production"<br>]</pre> | no |
14+
| trigger\_location | Location of for Cloud Build triggers created in the workspace. If using private pools should be the same location as the pool. | `string` | `"global"` | no |
15+
16+
## Outputs
17+
18+
| Name | Description |
19+
|------|-------------|
20+
| app\_admin\_project\_id | Project ID of the application admin project. |
21+
| app\_cloudbuild\_workspace\_apply\_trigger\_id | ID of the apply cloud build trigger. |
22+
| app\_cloudbuild\_workspace\_artifacts\_bucket\_name | Artifacts bucket name for the application workspace. |
23+
| app\_cloudbuild\_workspace\_logs\_bucket\_name | Logs bucket name for the application workspace. |
24+
| app\_cloudbuild\_workspace\_plan\_trigger\_id | ID of the plan cloud build trigger. |
25+
| app\_cloudbuild\_workspace\_state\_bucket\_name | Terraform state bucket name for the application workspace. |
26+
| app\_env\_project\_ids | Application environment projects IDs. |
27+
| app\_infra\_repository\_name | Name of the application infrastructure repository. |
28+
| app\_infra\_repository\_url | URL of the application infrastructure repository. |
29+
30+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* Copyright 2024 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
module "balancereader" {
18+
source = "../../../modules/app-group-baseline"
19+
20+
application_name = "balancereader"
21+
create_env_projects = true
22+
23+
org_id = var.org_id
24+
billing_account = var.billing_account
25+
folder_id = var.common_folder_id
26+
envs = var.envs
27+
bucket_prefix = var.bucket_prefix
28+
location = var.location
29+
trigger_location = var.trigger_location
30+
bucket_force_destroy = var.bucket_force_destroy
31+
tf_apply_branches = var.tf_apply_branches
32+
33+
cloudbuild_sa_roles = {
34+
development = {
35+
roles = ["roles/owner"]
36+
}
37+
non-production = {
38+
roles = ["roles/owner"]
39+
}
40+
production = {
41+
roles = ["roles/owner"]
42+
}
43+
}
44+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* Copyright 2024 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
output "app_admin_project_id" {
18+
description = "Project ID of the application admin project."
19+
value = module.balancereader.app_admin_project_id
20+
}
21+
22+
output "app_infra_repository_name" {
23+
description = "Name of the application infrastructure repository."
24+
value = module.balancereader.app_infra_repository_name
25+
}
26+
27+
output "app_infra_repository_url" {
28+
description = "URL of the application infrastructure repository."
29+
value = module.balancereader.app_infra_repository_url
30+
}
31+
32+
output "app_cloudbuild_workspace_apply_trigger_id" {
33+
description = "ID of the apply cloud build trigger."
34+
value = module.balancereader.app_cloudbuild_workspace_apply_trigger_id
35+
}
36+
37+
output "app_cloudbuild_workspace_plan_trigger_id" {
38+
description = "ID of the plan cloud build trigger."
39+
value = module.balancereader.app_cloudbuild_workspace_plan_trigger_id
40+
}
41+
42+
output "app_cloudbuild_workspace_artifacts_bucket_name" {
43+
description = "Artifacts bucket name for the application workspace."
44+
value = module.balancereader.app_cloudbuild_workspace_artifacts_bucket_name
45+
}
46+
47+
output "app_cloudbuild_workspace_logs_bucket_name" {
48+
description = "Logs bucket name for the application workspace."
49+
value = module.balancereader.app_cloudbuild_workspace_logs_bucket_name
50+
}
51+
52+
output "app_cloudbuild_workspace_state_bucket_name" {
53+
description = "Terraform state bucket name for the application workspace."
54+
value = module.balancereader.app_cloudbuild_workspace_state_bucket_name
55+
}
56+
57+
output "app_env_project_ids" {
58+
description = "Application environment projects IDs."
59+
value = module.balancereader.app_env_project_ids
60+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2+
## Inputs
3+
4+
| Name | Description | Type | Default | Required |
5+
|------|-------------|------|---------|:--------:|
6+
| billing\_account | Billing Account ID for application admin project resources. | `string` | n/a | yes |
7+
| bucket\_force\_destroy | When deleting a bucket, this boolean option will delete all contained objects. If false, Terraform will fail to delete buckets which contain objects. | `bool` | `false` | no |
8+
| bucket\_prefix | Name prefix to use for buckets created. | `string` | `"bkt"` | no |
9+
| common\_folder\_id | Folder ID in which to create all application admin projects | `string` | n/a | yes |
10+
| envs | n/a | `map(any)` | n/a | yes |
11+
| location | Location for build buckets. | `string` | `"us-central1"` | no |
12+
| org\_id | Google Cloud Organization ID. | `string` | n/a | yes |
13+
| tf\_apply\_branches | List of git branches configured to run terraform apply Cloud Build trigger. All other branches will run plan by default. | `list(string)` | <pre>[<br> "development",<br> "non\\-production",<br> "production"<br>]</pre> | no |
14+
| trigger\_location | Location of for Cloud Build triggers created in the workspace. If using private pools should be the same location as the pool. | `string` | `"global"` | no |
15+
16+
## Outputs
17+
18+
| Name | Description |
19+
|------|-------------|
20+
| app\_admin\_project\_id | Project ID of the application admin project. |
21+
| app\_cloudbuild\_workspace\_apply\_trigger\_id | ID of the apply cloud build trigger. |
22+
| app\_cloudbuild\_workspace\_artifacts\_bucket\_name | Artifacts bucket name for the application workspace. |
23+
| app\_cloudbuild\_workspace\_logs\_bucket\_name | Logs bucket name for the application workspace. |
24+
| app\_cloudbuild\_workspace\_plan\_trigger\_id | ID of the plan cloud build trigger. |
25+
| app\_cloudbuild\_workspace\_state\_bucket\_name | Terraform state bucket name for the application workspace. |
26+
| app\_env\_project\_ids | Application environment projects IDs. |
27+
| app\_infra\_repository\_name | Name of the application infrastructure repository. |
28+
| app\_infra\_repository\_url | URL of the application infrastructure repository. |
29+
30+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

3-appfactory/apps/main.tf renamed to 3-appfactory/apps/cymbal-bank/contacts/main.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
* limitations under the License.
1515
*/
1616

17-
module "app1" {
18-
source = "../modules/app-group-baseline"
17+
module "contacts" {
18+
source = "../../../modules/app-group-baseline"
1919

20-
application_name = "app1"
20+
application_name = "contacts"
2121
create_env_projects = true
2222

2323
org_id = var.org_id

3-appfactory/apps/outputs.tf renamed to 3-appfactory/apps/cymbal-bank/contacts/outputs.tf

+9-9
Original file line numberDiff line numberDiff line change
@@ -16,45 +16,45 @@
1616

1717
output "app_admin_project_id" {
1818
description = "Project ID of the application admin project."
19-
value = module.app1.app_admin_project_id
19+
value = module.contacts.app_admin_project_id
2020
}
2121

2222
output "app_infra_repository_name" {
2323
description = "Name of the application infrastructure repository."
24-
value = module.app1.app_infra_repository_name
24+
value = module.contacts.app_infra_repository_name
2525
}
2626

2727
output "app_infra_repository_url" {
2828
description = "URL of the application infrastructure repository."
29-
value = module.app1.app_infra_repository_url
29+
value = module.contacts.app_infra_repository_url
3030
}
3131

3232
output "app_cloudbuild_workspace_apply_trigger_id" {
3333
description = "ID of the apply cloud build trigger."
34-
value = module.app1.app_cloudbuild_workspace_apply_trigger_id
34+
value = module.contacts.app_cloudbuild_workspace_apply_trigger_id
3535
}
3636

3737
output "app_cloudbuild_workspace_plan_trigger_id" {
3838
description = "ID of the plan cloud build trigger."
39-
value = module.app1.app_cloudbuild_workspace_plan_trigger_id
39+
value = module.contacts.app_cloudbuild_workspace_plan_trigger_id
4040
}
4141

4242
output "app_cloudbuild_workspace_artifacts_bucket_name" {
4343
description = "Artifacts bucket name for the application workspace."
44-
value = module.app1.app_cloudbuild_workspace_artifacts_bucket_name
44+
value = module.contacts.app_cloudbuild_workspace_artifacts_bucket_name
4545
}
4646

4747
output "app_cloudbuild_workspace_logs_bucket_name" {
4848
description = "Logs bucket name for the application workspace."
49-
value = module.app1.app_cloudbuild_workspace_logs_bucket_name
49+
value = module.contacts.app_cloudbuild_workspace_logs_bucket_name
5050
}
5151

5252
output "app_cloudbuild_workspace_state_bucket_name" {
5353
description = "Terraform state bucket name for the application workspace."
54-
value = module.app1.app_cloudbuild_workspace_state_bucket_name
54+
value = module.contacts.app_cloudbuild_workspace_state_bucket_name
5555
}
5656

5757
output "app_env_project_ids" {
5858
description = "Application environment projects IDs."
59-
value = module.app1.app_env_project_ids
59+
value = module.contacts.app_env_project_ids
6060
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/**
2+
* Copyright 2024 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
variable "common_folder_id" {
18+
type = string
19+
description = "Folder ID in which to create all application admin projects"
20+
}
21+
22+
variable "org_id" {
23+
type = string
24+
description = "Google Cloud Organization ID."
25+
}
26+
27+
variable "billing_account" {
28+
type = string
29+
description = "Billing Account ID for application admin project resources."
30+
}
31+
32+
variable "envs" {
33+
type = map(any)
34+
}
35+
36+
variable "bucket_prefix" {
37+
description = "Name prefix to use for buckets created."
38+
type = string
39+
default = "bkt"
40+
}
41+
42+
variable "bucket_force_destroy" {
43+
description = "When deleting a bucket, this boolean option will delete all contained objects. If false, Terraform will fail to delete buckets which contain objects."
44+
type = bool
45+
default = false
46+
}
47+
48+
variable "location" {
49+
description = "Location for build buckets."
50+
type = string
51+
default = "us-central1"
52+
}
53+
54+
variable "trigger_location" {
55+
description = "Location of for Cloud Build triggers created in the workspace. If using private pools should be the same location as the pool."
56+
type = string
57+
default = "global"
58+
}
59+
60+
variable "tf_apply_branches" {
61+
description = "List of git branches configured to run terraform apply Cloud Build trigger. All other branches will run plan by default."
62+
type = list(string)
63+
default = ["development", "non\\-production", "production"]
64+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2+
## Inputs
3+
4+
| Name | Description | Type | Default | Required |
5+
|------|-------------|------|---------|:--------:|
6+
| billing\_account | Billing Account ID for application admin project resources. | `string` | n/a | yes |
7+
| bucket\_force\_destroy | When deleting a bucket, this boolean option will delete all contained objects. If false, Terraform will fail to delete buckets which contain objects. | `bool` | `false` | no |
8+
| bucket\_prefix | Name prefix to use for buckets created. | `string` | `"bkt"` | no |
9+
| common\_folder\_id | Folder ID in which to create all application admin projects | `string` | n/a | yes |
10+
| envs | n/a | `map(any)` | n/a | yes |
11+
| location | Location for build buckets. | `string` | `"us-central1"` | no |
12+
| org\_id | Google Cloud Organization ID. | `string` | n/a | yes |
13+
| tf\_apply\_branches | List of git branches configured to run terraform apply Cloud Build trigger. All other branches will run plan by default. | `list(string)` | <pre>[<br> "development",<br> "non\\-production",<br> "production"<br>]</pre> | no |
14+
| trigger\_location | Location of for Cloud Build triggers created in the workspace. If using private pools should be the same location as the pool. | `string` | `"global"` | no |
15+
16+
## Outputs
17+
18+
| Name | Description |
19+
|------|-------------|
20+
| app\_admin\_project\_id | Project ID of the application admin project. |
21+
| app\_cloudbuild\_workspace\_apply\_trigger\_id | ID of the apply cloud build trigger. |
22+
| app\_cloudbuild\_workspace\_artifacts\_bucket\_name | Artifacts bucket name for the application workspace. |
23+
| app\_cloudbuild\_workspace\_logs\_bucket\_name | Logs bucket name for the application workspace. |
24+
| app\_cloudbuild\_workspace\_plan\_trigger\_id | ID of the plan cloud build trigger. |
25+
| app\_cloudbuild\_workspace\_state\_bucket\_name | Terraform state bucket name for the application workspace. |
26+
| app\_env\_project\_ids | Application environment projects IDs. |
27+
| app\_infra\_repository\_name | Name of the application infrastructure repository. |
28+
| app\_infra\_repository\_url | URL of the application infrastructure repository. |
29+
30+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* Copyright 2024 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
module "frontend" {
18+
source = "../../../modules/app-group-baseline"
19+
20+
application_name = "frontend"
21+
create_env_projects = true
22+
23+
org_id = var.org_id
24+
billing_account = var.billing_account
25+
folder_id = var.common_folder_id
26+
envs = var.envs
27+
bucket_prefix = var.bucket_prefix
28+
location = var.location
29+
trigger_location = var.trigger_location
30+
bucket_force_destroy = var.bucket_force_destroy
31+
tf_apply_branches = var.tf_apply_branches
32+
33+
cloudbuild_sa_roles = {
34+
development = {
35+
roles = ["roles/owner"]
36+
}
37+
non-production = {
38+
roles = ["roles/owner"]
39+
}
40+
production = {
41+
roles = ["roles/owner"]
42+
}
43+
}
44+
}

0 commit comments

Comments
 (0)