Skip to content

Commit d2b68fc

Browse files
DarkWandererg-awmalikbharathkkb
authored
feat: add create_bucket flag (#147)
Co-authored-by: Awais Malik <[email protected]> Co-authored-by: Bharath KKB <[email protected]>
1 parent 0dea083 commit d2b68fc

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Then perform the following commands on the root folder:
4040
|------|-------------|------|---------|:--------:|
4141
| bucket\_force\_destroy | When deleting the GCS bucket containing the cloud function, delete all objects in the bucket first. | `bool` | `true` | no |
4242
| bucket\_name | The name to apply to the bucket. Will default to a string of <project-id>-scheduled-function-XXXX> with XXXX being random characters. | `string` | `""` | no |
43+
| create\_bucket | Create bucket (default). Set to `false` to use existing one | `bool` | `true` | no |
4344
| function\_available\_memory\_mb | The amount of memory in megabytes allotted for the function to use. | `number` | `256` | no |
4445
| function\_description | The description of the function. | `string` | `"Processes log export events provided through a Pub/Sub topic subscription."` | no |
4546
| function\_docker\_registry | Docker Registry to use for storing the function's Docker images. Allowed values are CONTAINER\_REGISTRY (default) and ARTIFACT\_REGISTRY. | `string` | `null` | no |

main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ module "main" {
7979
bucket_force_destroy = var.bucket_force_destroy
8080
bucket_labels = var.function_source_archive_bucket_labels
8181
bucket_name = var.bucket_name == "" ? "${var.project_id}-scheduled-function-${random_id.suffix.hex}" : var.bucket_name
82+
create_bucket = var.create_bucket
8283
description = var.function_description
8384
environment_variables = var.function_environment_variables
8485
secret_environment_variables = var.function_secret_environment_variables

variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ variable "bucket_force_destroy" {
170170
description = "When deleting the GCS bucket containing the cloud function, delete all objects in the bucket first."
171171
}
172172

173+
variable "create_bucket" {
174+
type = bool
175+
default = true
176+
description = "Create bucket (default). Set to `false` to use existing one"
177+
}
178+
173179
variable "function_name" {
174180
type = string
175181
description = "The name to apply to the function"

0 commit comments

Comments
 (0)