Skip to content

Commit 756ee59

Browse files
committed
feat(terraform): add GCP Terraform config to create demo-gcp bucket with lifecycle rule
1 parent 041debb commit 756ee59

4 files changed

Lines changed: 43 additions & 0 deletions

File tree

infra/gcp-terraform/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# GCP Terraform Bucket Setup
2+
3+
## Deploy
4+
5+
```bash
6+
terraform init
7+
terraform apply
8+
9+
10+
11+
12+
---
13+
```

infra/gcp-terraform/main.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
resource "google_storage_bucket" "demo_bucket" {
2+
name = var.bucket_name
3+
location = var.location
4+
force_destroy = true
5+
6+
labels = {
7+
project = "cloud-storage-lens"
8+
env = "dev"
9+
}
10+
11+
lifecycle_rule {
12+
condition {
13+
age = 3
14+
}
15+
action {
16+
type = "Delete"
17+
}
18+
}
19+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bucket_name = "demo-gcp"
2+
location = "AUSTRALIAEAST"

infra/gcp-terraform/variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
variable "bucket_name" {
2+
type = string
3+
default = "demo-gcp"
4+
}
5+
6+
variable "location" {
7+
type = string
8+
default = "AUSTRALIAEAST"
9+
}

0 commit comments

Comments
 (0)