1
0
mirror of synced 2025-12-23 21:04:40 -05:00

Better tests and outputs plus cleanup

This commit is contained in:
Petri Autero
2019-02-12 23:27:35 +02:00
parent 5ce44cee9b
commit 8b2386928f
6 changed files with 144 additions and 101 deletions

View File

@@ -52,9 +52,20 @@ module "mysql" {
master_zone = "a"
# To make it easier to test this example, we are giving the servers public IP addresses and allowing inbound
# connections from anywhere. In real-world usage, your servers should live in private subnets, only have private IP
# addresses, and only allow access from specific trusted networks, servers or applications in your VPC.
enable_public_internet_access = true
enable_failover_replica = true
failover_replica_zone = "b"
authorized_networks = [
{
name = "allow-all-inbound"
value = "0.0.0.0/0"
},
]
enable_failover_replica = true
failover_replica_zone = "b"
# These together will construct the master_user privileges, i.e.
# 'master_user_name'@'master_user_host' IDENTIFIED BY 'master_user_password'.

View File

@@ -1,3 +1,7 @@
# ------------------------------------------------------------------------------
# MASTER OUTPUTS
# ------------------------------------------------------------------------------
output "master_instance_name" {
description = "The name of the database instance"
value = "${module.mysql.master_instance_name}"
@@ -8,8 +12,8 @@ output "master_ip_addresses" {
value = "${module.mysql.master_ip_addresses}"
}
output "master_private_ip" {
description = "The first IPv4 address of the addresses assigned to the instance. As this instance has only private IP, it is the private IP address."
output "master_public_ip" {
description = "The first IPv4 address of the addresses assigned to the master instance. As this instance has only public IP, it is the public IP address."
value = "${module.mysql.master_first_ip_address}"
}
@@ -23,6 +27,10 @@ output "master_proxy_connection" {
value = "${module.mysql.master_proxy_connection}"
}
# ------------------------------------------------------------------------------
# DB OUTPUTS
# ------------------------------------------------------------------------------
output "db_name" {
description = "Name of the default database"
value = "${module.mysql.db_name}"
@@ -32,3 +40,27 @@ output "db" {
description = "Self link to the default database"
value = "${module.mysql.db}"
}
# ------------------------------------------------------------------------------
# FAILOVER REPLICA OUTPUTS
# ------------------------------------------------------------------------------
output "failover_instance" {
description = "Self link to the failover instance"
value = "${module.mysql.failover_instance}"
}
output "failover_instance_name" {
description = "The name of the failover database instance"
value = "${module.mysql.failover_instance_name}"
}
output "failover_public_ip" {
description = "The first IPv4 address of the addresses assigned to the failover instance. As this instance has only public IP, it is the public IP address."
value = "${module.mysql.failover_first_ip_address}"
}
output "failover_proxy_connection" {
description = "Failover instance path for connecting with Cloud SQL Proxy. Read more at https://cloud.google.com/sql/docs/mysql/sql-proxy"
value = "${module.mysql.failover_proxy_connection}"
}