Use hungarian notation.
As per: https://cloud.google.com/apis/design/naming_convention#quantities
This commit is contained in:
parent
de2bea16a4
commit
97c6a25b90
|
@ -151,7 +151,7 @@ module "cloud-function" {
|
|||
entry_point = "main"
|
||||
runtime = "python39"
|
||||
instances = 1
|
||||
memory = 256 # Memory in MB
|
||||
memory_mb = 256
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -114,8 +114,8 @@ module "cffile" {
|
|||
name = var.name_cffile
|
||||
bucket_name = "${var.name_cffile}-${random_pet.random.id}"
|
||||
bucket_config = {
|
||||
location = var.region
|
||||
lifecycle_delete_age = null
|
||||
location = var.region
|
||||
lifecycle_delete_age_days = null
|
||||
}
|
||||
bundle_config = {
|
||||
source_dir = "cffile"
|
||||
|
|
|
@ -125,8 +125,8 @@ module "cf-restarter" {
|
|||
function_config = {
|
||||
entry_point = "RestartInstance"
|
||||
ingress_settings = null
|
||||
instances = 1
|
||||
memory = 256
|
||||
instance_count = 1
|
||||
memory_mb = 256
|
||||
runtime = "go116"
|
||||
timeout = 300
|
||||
}
|
||||
|
@ -156,8 +156,8 @@ module "cf-healthchecker" {
|
|||
function_config = {
|
||||
entry_point = "HealthCheck"
|
||||
ingress_settings = null
|
||||
instances = 1
|
||||
memory = 256
|
||||
instance_count = 1
|
||||
memory_mb = 256
|
||||
runtime = "go116"
|
||||
timeout = 300
|
||||
}
|
||||
|
|
|
@ -70,8 +70,8 @@ module "functions" {
|
|||
region = each.value
|
||||
ingress_settings = "ALLOW_ALL"
|
||||
bucket_config = {
|
||||
location = null
|
||||
lifecycle_delete_age = 1
|
||||
location = null
|
||||
lifecycle_delete_age_days = 1
|
||||
}
|
||||
bundle_config = {
|
||||
source_dir = "${path.module}/function"
|
||||
|
|
|
@ -137,7 +137,7 @@ module "cf-http" {
|
|||
name = "test-cf-http"
|
||||
bucket_name = "test-cf-bundles"
|
||||
bucket_config = {
|
||||
lifecycle_delete_age = 1
|
||||
lifecycle_delete_age_days = 1
|
||||
}
|
||||
bundle_config = {
|
||||
source_dir = "fabric/assets/"
|
||||
|
|
|
@ -76,9 +76,9 @@ resource "google_cloudfunctions_function" "function" {
|
|||
name = "${local.prefix}${var.name}"
|
||||
description = var.description
|
||||
runtime = var.function_config.runtime
|
||||
available_memory_mb = var.function_config.memory
|
||||
max_instances = var.function_config.instances
|
||||
timeout = var.function_config.timeout
|
||||
available_memory_mb = var.function_config.memory_mb
|
||||
max_instances = var.function_config.instance_count
|
||||
timeout = var.function_config.timeout_seconds
|
||||
entry_point = var.function_config.entry_point
|
||||
environment_variables = var.environment_variables
|
||||
service_account_email = local.service_account_email
|
||||
|
@ -178,10 +178,10 @@ resource "google_cloudfunctions2_function" "function" {
|
|||
}
|
||||
}
|
||||
service_config {
|
||||
max_instance_count = var.function_config.instances
|
||||
max_instance_count = var.function_config.instance_count
|
||||
min_instance_count = 0
|
||||
available_memory = "${var.function_config.memory}M"
|
||||
timeout_seconds = var.function_config.timeout
|
||||
available_memory = "${var.function_config.memory_mb}M"
|
||||
timeout_seconds = var.function_config.timeout_seconds
|
||||
environment_variables = var.environment_variables
|
||||
ingress_settings = var.ingress_settings
|
||||
all_traffic_on_latest_revision = true
|
||||
|
@ -253,18 +253,18 @@ resource "google_storage_bucket" "bucket" {
|
|||
labels = var.labels
|
||||
|
||||
dynamic "lifecycle_rule" {
|
||||
for_each = var.bucket_config.lifecycle_delete_age == null ? [] : [""]
|
||||
for_each = var.bucket_config.lifecycle_delete_age_days == null ? [] : [""]
|
||||
content {
|
||||
action { type = "Delete" }
|
||||
condition {
|
||||
age = var.bucket_config.lifecycle_delete_age
|
||||
age = var.bucket_config.lifecycle_delete_age_days
|
||||
with_state = "ARCHIVED"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dynamic "versioning" {
|
||||
for_each = var.bucket_config.lifecycle_delete_age == null ? [] : [""]
|
||||
for_each = var.bucket_config.lifecycle_delete_age_days == null ? [] : [""]
|
||||
content {
|
||||
enabled = true
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
variable "bucket_config" {
|
||||
description = "Enable and configure auto-created bucket. Set fields to null to use defaults."
|
||||
type = object({
|
||||
location = optional(string)
|
||||
lifecycle_delete_age = optional(number)
|
||||
location = optional(string)
|
||||
lifecycle_delete_age_days = optional(number)
|
||||
})
|
||||
default = null
|
||||
}
|
||||
|
@ -58,18 +58,18 @@ variable "environment_variables" {
|
|||
variable "function_config" {
|
||||
description = "Cloud function configuration. Defaults to using main as entrypoint, 1 instance with 256MiB of memory, and 180 second timeout"
|
||||
type = object({
|
||||
entry_point = optional(string, "main")
|
||||
instances = optional(number, 1)
|
||||
memory = optional(number, 256) # Memory in MB
|
||||
runtime = optional(string, "python310")
|
||||
timeout = optional(number, 180)
|
||||
entry_point = optional(string, "main")
|
||||
instance_count = optional(number, 1)
|
||||
memory_mb = optional(number, 256) # Memory in MB
|
||||
runtime = optional(string, "python310")
|
||||
timeout_seconds = optional(number, 180)
|
||||
})
|
||||
default = {
|
||||
entry_point = "main"
|
||||
instances = 1
|
||||
memory = 256
|
||||
runtime = "python310"
|
||||
timeout = 180
|
||||
entry_point = "main"
|
||||
instance_count = 1
|
||||
memory_mb = 256
|
||||
runtime = "python310"
|
||||
timeout_seconds = 180
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue