Skip to content

Commit

Permalink
(iac) removed folder for the gcp project
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Alexandre35 committed Nov 2, 2024
1 parent 29f3ebc commit a7eae6b
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
19 changes: 19 additions & 0 deletions iac/main.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/* commented out: main reason is that terraform apply works locally but on the CI using service accounts cannot create projects without a parent (=organisation).
However in order to create an organisation, we must sign up for Sign up for Google Workspace. So we keep the GCP "static" atm.
resource "google_folder" "iac_project_folder" {
display_name = var.folder_name
}
output "folder_id" {
value = google_folder.iac_project_folder.id
}
# Generate a random suffix for the project ID
resource "random_id" "project_suffix" {
byte_length = 2 # 2 bytes = 4 hex characters (e.g., "abcd")
Expand All @@ -7,10 +18,18 @@ resource "random_id" "project_suffix" {
resource "google_project" "gcp_prod_project" {
name = "travian-prod-3919"
project_id = "travian-3919"
folder_id = var.folder_id
#name = "travian-prod-${random_id.project_suffix.hex}"
#project_id = "travian-${random_id.project_suffix.hex}"
billing_account = var.billing_account_id
}
*/

resource "google_project" "gcp_prod_project" {
name = "travian-prod-3919"
project_id = "travian-3919"
billing_account = var.billing_account_id
}

# Call the API module
module "api" {
Expand Down
7 changes: 7 additions & 0 deletions iac/modules/api/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ resource "google_project_service" "cloud_storage" {
service = "storage.googleapis.com"
disable_on_destroy = false
}

# Enable Cloud Billing API
resource "google_project_service" "cloud_billing" {
project = var.project_id
service = "cloudbilling.googleapis.com"
disable_on_destroy = false
}
12 changes: 12 additions & 0 deletions iac/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*
variable "folder_id" {
description = "The ID of the organization where the folder will be created."
type = string
}
variable "folder_name" {
description = "The name of the folder for organizing projects."
type = string
default = "my-projects-folder"
}
*/
variable "region" {}
variable "bucket_name" {}
variable "service_account_id" {}
Expand Down

0 comments on commit a7eae6b

Please sign in to comment.