1
0
mirror of synced 2025-12-19 18:05:44 -05:00

use nulls instead of empty strings

This commit is contained in:
Rob Morgan
2019-06-25 17:35:52 +02:00
parent 2a46a70ee8
commit 5dc807e2f3
12 changed files with 12 additions and 12 deletions

View File

@@ -28,7 +28,7 @@ resource "random_id" "name" {
locals { locals {
# If name_override is specified, use that - otherwise use the name_prefix with a random string # If name_override is specified, use that - otherwise use the name_prefix with a random string
instance_name = length(var.name_override) == 0 ? format("%s-%s", var.name_prefix, random_id.name.hex) : var.name_override instance_name = var.name_override == null ? format("%s-%s", var.name_prefix, random_id.name.hex) : var.name_override
private_network_name = "private-network-${random_id.name.hex}" private_network_name = "private-network-${random_id.name.hex}"
private_ip_name = "private-ip-${random_id.name.hex}" private_ip_name = "private-ip-${random_id.name.hex}"
} }

View File

@@ -55,5 +55,5 @@ variable "db_name" {
variable "name_override" { variable "name_override" {
description = "You may optionally override the name_prefix + random string by specifying an override" description = "You may optionally override the name_prefix + random string by specifying an override"
type = string type = string
default = "" default = null
} }

View File

@@ -28,7 +28,7 @@ resource "random_id" "name" {
locals { locals {
# If name_override is specified, use that - otherwise use the name_prefix with a random string # If name_override is specified, use that - otherwise use the name_prefix with a random string
instance_name = length(var.name_override) == 0 ? format("%s-%s", var.name_prefix, random_id.name.hex) : var.name_override instance_name = var.name_override == null ? format("%s-%s", var.name_prefix, random_id.name.hex) : var.name_override
} }
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------

View File

@@ -55,7 +55,7 @@ variable "db_name" {
variable "name_override" { variable "name_override" {
description = "You may optionally override the name_prefix + random string by specifying an override" description = "You may optionally override the name_prefix + random string by specifying an override"
type = string type = string
default = "" default = null
} }
# When configuring a public IP instance, you should only allow secure connections # When configuring a public IP instance, you should only allow secure connections

View File

@@ -28,7 +28,7 @@ resource "random_id" "name" {
locals { locals {
# If name_override is specified, use that - otherwise use the name_prefix with a random string # If name_override is specified, use that - otherwise use the name_prefix with a random string
instance_name = "${length(var.name_override) == 0 ? format("%s-%s", var.name_prefix, random_id.name.hex) : var.name_override}" instance_name = var.name_override == null ? format("%s-%s", var.name_prefix, random_id.name.hex) : var.name_override
private_network_name = "private-network-${random_id.name.hex}" private_network_name = "private-network-${random_id.name.hex}"
private_ip_name = "private-ip-${random_id.name.hex}" private_ip_name = "private-ip-${random_id.name.hex}"
} }

View File

@@ -78,5 +78,5 @@ variable "db_name" {
variable "name_override" { variable "name_override" {
description = "You may optionally override the name_prefix + random string by specifying an override" description = "You may optionally override the name_prefix + random string by specifying an override"
type = string type = string
default = "" default = null
} }

View File

@@ -28,7 +28,7 @@ resource "random_id" "name" {
locals { locals {
# If name_override is specified, use that - otherwise use the name_prefix with a random string # If name_override is specified, use that - otherwise use the name_prefix with a random string
instance_name = "${length(var.name_override) == 0 ? format("%s-%s", var.name_prefix, random_id.name.hex) : var.name_override}" instance_name = var.name_override == null ? format("%s-%s", var.name_prefix, random_id.name.hex) : var.name_override
private_network_name = "private-network-${random_id.name.hex}" private_network_name = "private-network-${random_id.name.hex}"
private_ip_name = "private-ip-${random_id.name.hex}" private_ip_name = "private-ip-${random_id.name.hex}"
} }

View File

@@ -55,5 +55,5 @@ variable "db_name" {
variable "name_override" { variable "name_override" {
description = "You may optionally override the name_prefix + random string by specifying an override" description = "You may optionally override the name_prefix + random string by specifying an override"
type = string type = string
default = "" default = null
} }

View File

@@ -28,7 +28,7 @@ resource "random_id" "name" {
locals { locals {
# If name_override is specified, use that - otherwise use the name_prefix with a random string # If name_override is specified, use that - otherwise use the name_prefix with a random string
instance_name = length(var.name_override) == 0 ? format("%s-%s", var.name_prefix, random_id.name.hex) : var.name_override instance_name = var.name_override == null ? format("%s-%s", var.name_prefix, random_id.name.hex) : var.name_override
} }
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------

View File

@@ -55,7 +55,7 @@ variable "db_name" {
variable "name_override" { variable "name_override" {
description = "You may optionally override the name_prefix + random string by specifying an override" description = "You may optionally override the name_prefix + random string by specifying an override"
type = string type = string
default = "" default = null
} }
# When configuring a public IP instance, you should only allow secure connections # When configuring a public IP instance, you should only allow secure connections

View File

@@ -28,7 +28,7 @@ resource "random_id" "name" {
locals { locals {
# If name_override is specified, use that - otherwise use the name_prefix with a random string # If name_override is specified, use that - otherwise use the name_prefix with a random string
instance_name = length(var.name_override) == 0 ? format("%s-%s", var.name_prefix, random_id.name.hex) : var.name_override instance_name = var.name_override == null ? format("%s-%s", var.name_prefix, random_id.name.hex) : var.name_override
private_network_name = "private-network-${random_id.name.hex}" private_network_name = "private-network-${random_id.name.hex}"
private_ip_name = "private-ip-${random_id.name.hex}" private_ip_name = "private-ip-${random_id.name.hex}"
} }

View File

@@ -78,5 +78,5 @@ variable "db_name" {
variable "name_override" { variable "name_override" {
description = "You may optionally override the name_prefix + random string by specifying an override" description = "You may optionally override the name_prefix + random string by specifying an override"
type = string type = string
default = "" default = null
} }