Skip to content

Commit e23f95e

Browse files
authored
fix: update project-factory version in CI/CD projects (#1255)
1 parent 2ca1683 commit e23f95e

File tree

9 files changed

+41
-34
lines changed

9 files changed

+41
-34
lines changed

0-bootstrap/github.tf.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ locals {
4242
"PROJECT_ID" : module.gh_cicd.project_id,
4343
"WIF_PROVIDER_NAME" : module.gh_oidc.provider_name,
4444
"TF_BACKEND" : module.seed_bootstrap.gcs_bucket_tfstate,
45-
"TF_VAR_gh_token": var.gh_token,
45+
"TF_VAR_gh_token" : var.gh_token,
4646
}
4747

4848
secrets_list = flatten([
@@ -70,7 +70,7 @@ locals {
7070

7171
module "gh_cicd" {
7272
source = "terraform-google-modules/project-factory/google"
73-
version = "~> 12.0"
73+
version = "~> 15.0"
7474

7575
name = "${var.project_prefix}-b-cicd-wif-gh"
7676
random_project_id = true
@@ -90,7 +90,7 @@ module "gh_cicd" {
9090
}
9191

9292
module "gh_oidc" {
93-
source = "terraform-google-modules/github-actions-runners/google//modules/gh-oidc"
93+
source = "terraform-google-modules/github-actions-runners/google//modules/gh-oidc"
9494
version = "~> 3.1"
9595

9696
project_id = module.gh_cicd.project_id

0-bootstrap/gitlab.tf.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ provider "gitlab" {
8181

8282
module "gitlab_cicd" {
8383
source = "terraform-google-modules/project-factory/google"
84-
version = "~> 12.0"
84+
version = "~> 15.0"
8585

8686
name = "${var.project_prefix}-b-cicd-wif-gl"
8787
random_project_id = true

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ module "cicd_project" {
4646
Jenkins Agent GCE instance
4747
*******************************************/
4848
resource "google_service_account" "jenkins_agent_gce_sa" {
49-
project = module.cicd_project.project_id
50-
account_id = format("%s-%s", var.service_account_prefix, var.jenkins_agent_sa_email)
51-
display_name = "Jenkins Agent (GCE instance) custom Service Account"
49+
project = module.cicd_project.project_id
50+
account_id = format("%s-%s", var.service_account_prefix, var.jenkins_agent_sa_email)
51+
display_name = "Jenkins Agent (GCE instance) custom Service Account"
52+
create_ignore_already_exists = true
5253
}
5354

5455
data "template_file" "jenkins_agent_gce_startup_script" {

0-bootstrap/modules/tfc-agent-gke/main.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,12 @@ module "network" {
8282
*****************************************/
8383

8484
resource "google_service_account" "tfc_agent_service_account" {
85-
count = var.create_service_account ? 1 : 0
86-
project = var.project_id
87-
account_id = "tfc-agent-gke"
88-
display_name = "Terraform Cloud agent GKE Service Account"
85+
count = var.create_service_account ? 1 : 0
86+
87+
project = var.project_id
88+
account_id = "tfc-agent-gke"
89+
display_name = "Terraform Cloud agent GKE Service Account"
90+
create_ignore_already_exists = true
8991
}
9092

9193
/*****************************************

0-bootstrap/sa.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,10 @@ locals {
140140
resource "google_service_account" "terraform-env-sa" {
141141
for_each = local.granular_sa
142142

143-
project = module.seed_bootstrap.seed_project_id
144-
account_id = "sa-terraform-${each.key}"
145-
display_name = each.value
143+
project = module.seed_bootstrap.seed_project_id
144+
account_id = "sa-terraform-${each.key}"
145+
display_name = each.value
146+
create_ignore_already_exists = true
146147
}
147148

148149
module "org_iam_member" {

0-bootstrap/terraform_cloud.tf.example

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,25 +52,25 @@ locals {
5252
"1-shared" = { vcs_branch = "production", directory = "/envs/shared" }
5353
},
5454
"env" = {
55-
"2-production" = { vcs_branch = "production", directory = "/envs/production" },
55+
"2-production" = { vcs_branch = "production", directory = "/envs/production" },
5656
"2-nonproduction" = { vcs_branch = "nonproduction", directory = "/envs/nonproduction" },
57-
"2-development" = { vcs_branch = "development", directory = "/envs/development" },
57+
"2-development" = { vcs_branch = "development", directory = "/envs/development" },
5858
},
5959
"net" = {
60-
"3-production" = { vcs_branch = "production", directory = "/envs/production" },
60+
"3-production" = { vcs_branch = "production", directory = "/envs/production" },
6161
"3-nonproduction" = { vcs_branch = "nonproduction", directory = "/envs/nonproduction" },
62-
"3-development" = { vcs_branch = "development", directory = "/envs/development" },
63-
"3-shared" = { vcs_branch = "production", directory = "/envs/shared" },
62+
"3-development" = { vcs_branch = "development", directory = "/envs/development" },
63+
"3-shared" = { vcs_branch = "production", directory = "/envs/shared" },
6464
},
6565
"proj" = {
66-
"4-bu1-production" = { vcs_branch = "production", directory = "/business_unit_1/production" },
66+
"4-bu1-production" = { vcs_branch = "production", directory = "/business_unit_1/production" },
6767
"4-bu1-nonproduction" = { vcs_branch = "nonproduction", directory = "/business_unit_1/nonproduction" },
68-
"4-bu1-development" = { vcs_branch = "development", directory = "/business_unit_1/development" },
69-
"4-bu1-shared" = { vcs_branch = "production", directory = "/business_unit_1/shared" },
70-
"4-bu2-production" = { vcs_branch = "production", directory = "/business_unit_2/production" },
68+
"4-bu1-development" = { vcs_branch = "development", directory = "/business_unit_1/development" },
69+
"4-bu1-shared" = { vcs_branch = "production", directory = "/business_unit_1/shared" },
70+
"4-bu2-production" = { vcs_branch = "production", directory = "/business_unit_2/production" },
7171
"4-bu2-nonproduction" = { vcs_branch = "nonproduction", directory = "/business_unit_2/nonproduction" },
72-
"4-bu2-development" = { vcs_branch = "development", directory = "/business_unit_2/development" },
73-
"4-bu2-shared" = { vcs_branch = "production", directory = "/business_unit_2/shared" },
72+
"4-bu2-development" = { vcs_branch = "development", directory = "/business_unit_2/development" },
73+
"4-bu2-shared" = { vcs_branch = "production", directory = "/business_unit_2/shared" },
7474

7575
},
7676
}
@@ -230,7 +230,7 @@ resource "tfe_run_trigger" "projects_bu2_shared_production" {
230230

231231
module "tfc_cicd" {
232232
source = "terraform-google-modules/project-factory/google"
233-
version = "~> 12.0"
233+
version = "~> 15.0"
234234

235235
name = "${var.project_prefix}-b-cicd-wif-tfc"
236236
random_project_id = true

1-org/modules/cai-monitoring/iam.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ resource "google_kms_crypto_key_iam_member" "encrypter_decrypter" {
5757

5858
// Cloud Function SA
5959
resource "google_service_account" "cloudfunction" {
60-
account_id = "cai-monitoring"
61-
project = var.project_id
60+
account_id = "cai-monitoring"
61+
project = var.project_id
62+
create_ignore_already_exists = true
6263
}
6364

6465
resource "google_organization_iam_member" "cloudfunction_findings_editor" {

5-app-infra/modules/env_base/main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ data "terraform_remote_state" "projects_env" {
5353
}
5454

5555
resource "google_service_account" "compute_engine_service_account" {
56-
project = local.env_project_id
57-
account_id = "sa-example-app"
58-
display_name = "Example app service Account"
56+
project = local.env_project_id
57+
account_id = "sa-example-app"
58+
display_name = "Example app service Account"
59+
create_ignore_already_exists = true
5960
}
6061

6162
module "instance_template" {

test/setup/iam.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ resource "google_billing_account_iam_member" "billing_account_log_config" {
5656
}
5757

5858
resource "google_service_account" "int_test" {
59-
project = module.project.project_id
60-
account_id = "ci-account"
61-
display_name = "ci-account"
59+
project = module.project.project_id
60+
account_id = "ci-account"
61+
display_name = "ci-account"
62+
create_ignore_already_exists = true
6263
}
6364

6465
resource "google_project_iam_member" "int_test" {

0 commit comments

Comments
 (0)