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

more tf12 changes

This commit is contained in:
Rob Morgan
2019-06-25 12:15:46 +02:00
parent 213f6e2e3a
commit 1364203502
18 changed files with 211 additions and 110 deletions

View File

@@ -4,22 +4,22 @@
output "master_instance_name" {
description = "The name of the database instance"
value = "${module.postgres.master_instance_name}"
value = module.postgres.master_instance_name
}
output "master_public_ip" {
description = "The public IPv4 address of the master instance"
value = "${module.postgres.master_public_ip_address}"
value = module.postgres.master_public_ip_address
}
output "master_instance" {
description = "Self link to the master instance"
value = "${module.postgres.master_instance}"
value = module.postgres.master_instance
}
output "master_proxy_connection" {
description = "Instance path for connecting with Cloud SQL Proxy. Read more at https://cloud.google.com/sql/docs/mysql/sql-proxy"
value = "${module.postgres.master_proxy_connection}"
value = module.postgres.master_proxy_connection
}
# ------------------------------------------------------------------------------
@@ -28,12 +28,12 @@ output "master_proxy_connection" {
output "db_name" {
description = "Name of the default database"
value = "${module.postgres.db_name}"
value = module.postgres.db_name
}
output "db" {
description = "Self link to the default database"
value = "${module.postgres.db}"
value = module.postgres.db
}
# ------------------------------------------------------------------------------
@@ -42,22 +42,22 @@ output "db" {
output "read_replica_instance_names" {
description = "List of names for the read replica instances"
value = ["${module.postgres.read_replica_instance_names}"]
value = module.postgres.read_replica_instance_names
}
output "read_replica_public_ips" {
description = "List of public IPv4 addresses of the read replica instances"
value = ["${module.postgres.read_replica_public_ip_addresses}"]
value = module.postgres.read_replica_public_ip_addresses
}
output "read_replica_instances" {
description = "List of self links to the read replica instances"
value = ["${module.postgres.read_replica_instances}"]
value = module.postgres.read_replica_instances
}
output "read_replica_proxy_connections" {
description = "List of read replica instance paths for connecting with Cloud SQL Proxy. Read more at https://cloud.google.com/sql/docs/mysql/sql-proxy"
value = ["${module.postgres.read_replica_proxy_connections}"]
value = module.postgres.read_replica_proxy_connections
}
# Although we don't use the values, this output highlights the JSON encoded output we use in certain
@@ -65,5 +65,5 @@ output "read_replica_proxy_connections" {
# See https://github.com/hashicorp/terraform/issues/17048
output "read_replica_server_ca_certs" {
description = "JSON encoded list of CA Certificates used to connect to the read replica instances via SSL"
value = "${module.postgres.read_replica_server_ca_certs}"
value = module.postgres.read_replica_server_ca_certs
}

View File

@@ -5,27 +5,32 @@
variable "project" {
description = "The project ID to host the database in."
type = string
}
variable "region" {
description = "The region to host the database in (e.g. 'us-central1')."
type = string
}
variable "master_zone" {
description = "The preferred zone for the master instance (e.g. 'us-central1-a'). Must be different than 'failover_replica_zone'."
type = string
}
variable "failover_replica_zone" {
description = "The preferred zone for the failover instance (e.g. 'us-central1-b'). Must be different than 'master_zone'."
type = string
}
variable "num_read_replicas" {
description = "The number of read replicas to create. Cloud SQL will replicate all data from the master to these replicas, which you can use to horizontally scale read traffic."
type = number
}
variable "read_replica_zones" {
description = "A list of compute zones where read replicas should be created. List size should match 'num_read_replicas'"
type = "list"
type = list(string)
# Example:
# default = ["us-central1-b", "us-central1-c"]
@@ -34,36 +39,44 @@ variable "read_replica_zones" {
# Note, after a name db instance is used, it cannot be reused for up to one week.
variable "name_prefix" {
description = "The name prefix for the database instance. Will be appended with a random string. Use lowercase letters, numbers, and hyphens. Start with a letter."
type = string
}
variable "master_user_name" {
description = "The username part for the default user credentials, i.e. 'master_user_name'@'master_user_host' IDENTIFIED BY 'master_user_password'. This should typically be set as the environment variable TF_VAR_master_user_name so you don't check it into source control."
type = string
}
variable "master_user_password" {
description = "The password part for the default user credentials, i.e. 'master_user_name'@'master_user_host' IDENTIFIED BY 'master_user_password'. This should typically be set as the environment variable TF_VAR_master_user_password so you don't check it into source control."
type = string
}
# ---------------------------------------------------------------------------------------------------------------------
# OPTIONAL PARAMETERS
# Generally, these values won't need to be changed.
# ---------------------------------------------------------------------------------------------------------------------
variable "postgres_version" {
description = "The engine version of the database, e.g. `POSTGRES_9_6`. See https://cloud.google.com/sql/docs/features for supported versions."
type = string
default = "POSTGRES_9_6"
}
variable "machine_type" {
description = "The machine type to use, see https://cloud.google.com/sql/pricing for more details"
type = string
default = "db-f1-micro"
}
variable "db_name" {
description = "Name for the db"
type = string
default = "default"
}
variable "name_override" {
description = "You may optionally override the name_prefix + random string by specifying an override"
type = string
default = ""
}