feat: Add Terraform configuration for Google Cloud project
This commit is contained in:
21
.terraform.lock.hcl
generated
Normal file
21
.terraform.lock.hcl
generated
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# This file is maintained automatically by "terraform init".
|
||||||
|
# Manual edits may be lost in future updates.
|
||||||
|
|
||||||
|
provider "registry.terraform.io/hashicorp/google" {
|
||||||
|
version = "7.9.0"
|
||||||
|
hashes = [
|
||||||
|
"h1:xhzErMeJSU7hzQs7Z5MvnGG+cwZA3gxW1tGwRbGjsL8=",
|
||||||
|
"zh:09d6c241edc669a2d5a0ec20ebdc8489995e690ed7b94bb64048f23db589801b",
|
||||||
|
"zh:0aa72a11265db9201464829a31a3d834149cd0aad5bb184a46f08bef4cd56d83",
|
||||||
|
"zh:1bd349373d11ba77bcd6ba389ec94e5116ac6b1c83ea2db85e847af7948d553f",
|
||||||
|
"zh:3ca032646e2d332e48aa46be19b7c30cdadd09e066e2f7c9e0f2022fbc0e0e7a",
|
||||||
|
"zh:481a20133ad3de9ed8a5de5ade5a46fe8f9f9c9f740ad7ebb9c4d7ef914140db",
|
||||||
|
"zh:56f3b7b521fa09dacc94abca7451b075d39793a569b53ef7ebed83fb088f5035",
|
||||||
|
"zh:bde46790fb4e6bf106df0c404aa2f8361651ad9ac70f30faf4bcb55d65e7d38e",
|
||||||
|
"zh:cc8d931e1d45376a421cff84d1223571296724e263ae4ebc021e3bd76bc74b9a",
|
||||||
|
"zh:d6604e6bb61f695e631d8862490389d65895f34d0133c066a81601e5539f0fa7",
|
||||||
|
"zh:d999cf33e1dd8cb3b02a75d079e542d9f3d73bc5756b870e78dfe3bf89535bd9",
|
||||||
|
"zh:e4f38256d1f190f7e04d393ba3e247da7e12f4bcf22c2c3ce1f57b465b4ad8a3",
|
||||||
|
"zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c",
|
||||||
|
]
|
||||||
|
}
|
||||||
32
main.tf
Normal file
32
main.tf
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# Configure the Google Cloud provider
|
||||||
|
provider "google" {
|
||||||
|
project = var.project_id
|
||||||
|
region = var.region
|
||||||
|
}
|
||||||
|
|
||||||
|
# Create a new Google Cloud Project
|
||||||
|
resource "google_project" "main_project" {
|
||||||
|
name = var.project_name
|
||||||
|
project_id = var.project_id
|
||||||
|
|
||||||
|
# Enable deletion policy to allow project deletion
|
||||||
|
deletion_policy = "DELETE"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Enable required APIs for the project
|
||||||
|
resource "google_project_service" "project_services" {
|
||||||
|
project = google_project.main_project.project_id
|
||||||
|
service = "cloudresourcemanager.googleapis.com"
|
||||||
|
|
||||||
|
# Wait for the project to be created before enabling services
|
||||||
|
depends_on = [google_project.main_project]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Output the project ID and name
|
||||||
|
output "project_id" {
|
||||||
|
value = google_project.main_project.project_id
|
||||||
|
}
|
||||||
|
|
||||||
|
output "project_name" {
|
||||||
|
value = google_project.main_project.name
|
||||||
|
}
|
||||||
25
variables.tf
Normal file
25
variables.tf
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# Variables for Google Cloud Project creation
|
||||||
|
|
||||||
|
variable "project_name" {
|
||||||
|
description = "Name of the Google Cloud project"
|
||||||
|
type = string
|
||||||
|
default = "rothbard-project-staging"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "project_id" {
|
||||||
|
description = "ID of the Google Cloud project"
|
||||||
|
type = string
|
||||||
|
default = "rothbard-project-staging-12345"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "organization_id" {
|
||||||
|
description = "ID of the Google Cloud Organization"
|
||||||
|
type = string
|
||||||
|
default = "123456789012"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "region" {
|
||||||
|
description = "Default region for resources"
|
||||||
|
type = string
|
||||||
|
default = "us-central1"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user