Skip to content

Commit

Permalink
fix: Shorten storage bucket name (#43)
Browse files Browse the repository at this point in the history
Co-authored-by: Balaji Subramaniam <[email protected]>
  • Loading branch information
yil532 and Balaji Subramaniam authored Jul 24, 2023
1 parent 7e15347 commit ce62b27
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Deployment: 10 mins

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| bucket\_name | The name of the bucket to create | `string` | `"genai-doc-summary-webhook"` | no |
| bucket\_name | The name of the bucket to create | `string` | `"genai-webhook"` | no |
| gcf\_timeout\_seconds | GCF execution timeout | `number` | `900` | no |
| project\_id | The Google Cloud project ID to deploy to | `string` | n/a | yes |
| region | Google Cloud region | `string` | `"us-central1"` | no |
Expand Down
7 changes: 4 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ resource "time_sleep" "wait_for_apis" {
create_duration = var.time_to_enable_apis
}

resource "random_uuid" "rand" {
resource "random_id" "rand" {
byte_length = 4
}

data "archive_file" "webhook" {
Expand Down Expand Up @@ -123,7 +124,7 @@ resource "google_cloudfunctions2_function" "webhook" {
entry_point = "entrypoint"
source {
storage_source {
bucket = "${var.bucket_name}-${random_uuid.rand.id}"
bucket = "${var.bucket_name}-${random_id.rand.hex}"
object = google_storage_bucket_object.webhook.name
}
}
Expand Down Expand Up @@ -226,7 +227,7 @@ resource "google_storage_bucket" "output" {

resource "google_storage_bucket" "main" {
project = var.project_id
name = "${var.bucket_name}-${random_uuid.rand.id}"
name = "${var.bucket_name}-${random_id.rand.hex}"
location = "US"
uniform_bucket_level_access = true
}
Expand Down
2 changes: 1 addition & 1 deletion metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ spec:
- name: bucket_name
description: The name of the bucket to create
varType: string
defaultValue: genai-doc-summary-webhook-1234
defaultValue: genai-webhook
- name: gcf_timeout_seconds
description: GCF execution timeout
varType: number
Expand Down
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ variable "project_id" {
variable "bucket_name" {
description = "The name of the bucket to create"
type = string
default = "genai-doc-summary-webhook"
default = "genai-webhook"
}

variable "region" {
Expand Down

0 comments on commit ce62b27

Please sign in to comment.