Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions opsless_system/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
terraform {
required_version = ">= 1.0.0"

required_providers {
google = {
source = "hashicorp/google"
version = "~> 4.0"
}
}
}

provider "google" {
# You can also specify credentials if needed, e.g.:
# credentials = file("path/to/service_account_key.json")

# Replace these with your actual project/region or pass them via variables
project = var.project_id
region = var.region
}

# Ensure the Cloud Storage API is enabled
resource "google_project_service" "storage_api" {
project = var.project_id
service = "storage.googleapis.com"
}

resource "google_storage_bucket" "terraform_state" {
name = var.bucket_name
location = var.region
uniform_bucket_level_access = true

versioning {
enabled = true
}

# If you want Terraform to be able to delete a non-empty bucket,
# set force_destroy to true. Otherwise, it must be empty before deletion.
force_destroy = false
}

output "bucket_name" {
description = "Name of the GCS bucket for Terraform remote state."
value = google_storage_bucket.terraform_state.name
}
15 changes: 15 additions & 0 deletions opsless_system/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
variable "project_id" {
type = string
description = "The GCP project ID where resources will be created."
}

variable "region" {
type = string
description = "The region in which to create the bucket (e.g., 'us-central1')."
default = "us-central1"
}

variable "bucket_name" {
type = string
description = "Name of the GCS bucket to store Terraform state."
}
Loading