1
0
mirror of synced 2025-12-22 19:28:03 -05:00

fix a few issues from the tests. bump version in docs

This commit is contained in:
Rob Morgan
2019-06-25 16:42:31 +02:00
parent 7713a67db3
commit bb152b218d
6 changed files with 52 additions and 52 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 = length(var.name_override) == 0 ? 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}"
} }
@@ -40,23 +40,23 @@ locals {
# Simple network, auto-creates subnetworks # Simple network, auto-creates subnetworks
resource "google_compute_network" "private_network" { resource "google_compute_network" "private_network" {
provider = "google-beta" provider = "google-beta"
name = "${local.private_network_name}" name = local.private_network_name
} }
# Reserve global internal address range for the peering # Reserve global internal address range for the peering
resource "google_compute_global_address" "private_ip_address" { resource "google_compute_global_address" "private_ip_address" {
provider = "google-beta" provider = "google-beta"
name = "${local.private_ip_name}" name = local.private_ip_name
purpose = "VPC_PEERING" purpose = "VPC_PEERING"
address_type = "INTERNAL" address_type = "INTERNAL"
prefix_length = 16 prefix_length = 16
network = "${google_compute_network.private_network.self_link}" network = google_compute_network.private_network.self_link
} }
# Establish VPC network peering connection using the reserved address range # Establish VPC network peering connection using the reserved address range
resource "google_service_networking_connection" "private_vpc_connection" { resource "google_service_networking_connection" "private_vpc_connection" {
provider = "google-beta" provider = "google-beta"
network = "${google_compute_network.private_network.self_link}" network = google_compute_network.private_network.self_link
service = "servicenetworking.googleapis.com" service = "servicenetworking.googleapis.com"
reserved_peering_ranges = ["${google_compute_global_address.private_ip_address.name}"] reserved_peering_ranges = ["${google_compute_global_address.private_ip_address.name}"]
} }
@@ -68,31 +68,31 @@ resource "google_service_networking_connection" "private_vpc_connection" {
module "mysql" { module "mysql" {
# When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you # When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you
# to a specific version of the modules, such as the following example: # to a specific version of the modules, such as the following example:
# source = "github.com/gruntwork-io/terraform-google-sql.git//modules/cloud-sql?ref=v0.1.1" # source = "github.com/gruntwork-io/terraform-google-sql.git//modules/cloud-sql?ref=v0.2.0"
source = "../../modules/cloud-sql" source = "../../modules/cloud-sql"
project = "${var.project}" project = var.project
region = "${var.region}" region = var.region
name = "${local.instance_name}" name = local.instance_name
db_name = "${var.db_name}" db_name = var.db_name
engine = "${var.mysql_version}" engine = var.mysql_version
machine_type = "${var.machine_type}" machine_type = var.machine_type
# These together will construct the master_user privileges, i.e. # These together will construct the master_user privileges, i.e.
# 'master_user_name'@'master_user_host' IDENTIFIED BY 'master_user_password'. # 'master_user_name'@'master_user_host' IDENTIFIED BY 'master_user_password'.
# These should typically be set as the environment variable TF_VAR_master_user_password, etc. # These should typically be set as the environment variable TF_VAR_master_user_password, etc.
# so you don't check these into source control." # so you don't check these into source control."
master_user_password = "${var.master_user_password}" master_user_password = var.master_user_password
master_user_name = "${var.master_user_name}" master_user_name = var.master_user_name
master_user_host = "%" master_user_host = "%"
# Pass the private network link to the module # Pass the private network link to the module
private_network = "${google_compute_network.private_network.self_link}" private_network = google_compute_network.private_network.self_link
# Wait for the vpc connection to complete # Wait for the vpc connection to complete
dependencies = ["${google_service_networking_connection.private_vpc_connection.network}"] dependencies = [google_service_networking_connection.private_vpc_connection.network]
# Set auto-increment flags to test the # Set auto-increment flags to test the
# feature during automated testing # feature during automated testing

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 = length(var.name_override) == 0 ? format("%s-%s", var.name_prefix, random_id.name.hex) : var.name_override
} }
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@@ -38,24 +38,24 @@ locals {
module "mysql" { module "mysql" {
# When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you # When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you
# to a specific version of the modules, such as the following example: # to a specific version of the modules, such as the following example:
# source = "github.com/gruntwork-io/terraform-google-sql.git//modules/cloud-sql?ref=v0.1.1" # source = "github.com/gruntwork-io/terraform-google-sql.git//modules/cloud-sql?ref=v0.2.0"
source = "../../modules/cloud-sql" source = "../../modules/cloud-sql"
project = "${var.project}" project = var.project
region = "${var.region}" region = var.region
name = "${local.instance_name}" name = local.instance_name
db_name = "${var.db_name}" db_name = var.db_name
engine = "${var.mysql_version}" engine = var.mysql_version
machine_type = "${var.machine_type}" machine_type = var.machine_type
# These together will construct the master_user privileges, i.e. # These together will construct the master_user privileges, i.e.
# 'master_user_name'@'master_user_host' IDENTIFIED BY 'master_user_password'. # 'master_user_name'@'master_user_host' IDENTIFIED BY 'master_user_password'.
# These should typically be set as the environment variable TF_VAR_master_user_password, etc. # These should typically be set as the environment variable TF_VAR_master_user_password, etc.
# so you don't check these into source control." # so you don't check these into source control."
master_user_password = "${var.master_user_password}" master_user_password = var.master_user_password
master_user_name = "${var.master_user_name}" master_user_name = var.master_user_name
master_user_host = "%" master_user_host = "%"
# To make it easier to test this example, we are giving the servers public IP addresses and allowing inbound # To make it easier to test this example, we are giving the servers public IP addresses and allowing inbound

View File

@@ -40,7 +40,7 @@ locals {
module "mysql" { module "mysql" {
# When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you # When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you
# to a specific version of the modules, such as the following example: # to a specific version of the modules, such as the following example:
# source = "github.com/gruntwork-io/terraform-google-sql.git//modules/cloud-sql?ref=v0.1.1" # source = "github.com/gruntwork-io/terraform-google-sql.git//modules/cloud-sql?ref=v0.2.0"
source = "../../modules/cloud-sql" source = "../../modules/cloud-sql"
project = var.project project = var.project

View File

@@ -68,7 +68,7 @@ resource "google_service_networking_connection" "private_vpc_connection" {
module "postgres" { module "postgres" {
# When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you # When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you
# to a specific version of the modules, such as the following example: # to a specific version of the modules, such as the following example:
# source = "github.com/gruntwork-io/terraform-google-sql.git//modules/cloud-sql?ref=v0.1.1" # source = "github.com/gruntwork-io/terraform-google-sql.git//modules/cloud-sql?ref=v0.2.0"
source = "../../modules/cloud-sql" source = "../../modules/cloud-sql"
project = "${var.project}" project = "${var.project}"

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 = length(var.name_override) == 0 ? format("%s-%s", var.name_prefix, random_id.name.hex) : var.name_override
} }
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@@ -38,24 +38,24 @@ locals {
module "postgres" { module "postgres" {
# When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you # When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you
# to a specific version of the modules, such as the following example: # to a specific version of the modules, such as the following example:
# source = "github.com/gruntwork-io/terraform-google-sql.git//modules/cloud-sql?ref=v0.1.1" # source = "github.com/gruntwork-io/terraform-google-sql.git//modules/cloud-sql?ref=v0.2.0"
source = "../../modules/cloud-sql" source = "../../modules/cloud-sql"
project = "${var.project}" project = var.project
region = "${var.region}" region = var.region
name = "${local.instance_name}" name = local.instance_name
db_name = "${var.db_name}" db_name = var.db_name
engine = "${var.postgres_version}" engine = var.postgres_version
machine_type = "${var.machine_type}" machine_type = var.machine_type
# These together will construct the master_user privileges, i.e. # These together will construct the master_user privileges, i.e.
# 'master_user_name'@'master_user_host' IDENTIFIED BY 'master_user_password'. # 'master_user_name'@'master_user_host' IDENTIFIED BY 'master_user_password'.
# These should typically be set as the environment variable TF_VAR_master_user_password, etc. # These should typically be set as the environment variable TF_VAR_master_user_password, etc.
# so you don't check these into source control." # so you don't check these into source control."
master_user_password = "${var.master_user_password}" master_user_password = var.master_user_password
master_user_name = "${var.master_user_name}" master_user_name = var.master_user_name
master_user_host = "%" master_user_host = "%"
# To make it easier to test this example, we are giving the servers public IP addresses and allowing inbound # To make it easier to test this example, we are giving the servers public IP addresses and allowing inbound
@@ -65,7 +65,7 @@ module "postgres" {
# Default setting for this is 'false' in 'variables.tf' # Default setting for this is 'false' in 'variables.tf'
# In the test cases, we're setting this to true, to test forced SSL. # In the test cases, we're setting this to true, to test forced SSL.
require_ssl = "${var.require_ssl}" require_ssl = var.require_ssl
authorized_networks = [ authorized_networks = [
{ {

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 = length(var.name_override) == 0 ? 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}"
} }
@@ -40,18 +40,18 @@ locals {
module "postgres" { module "postgres" {
# When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you # When using these modules in your own templates, you will need to use a Git URL with a ref attribute that pins you
# to a specific version of the modules, such as the following example: # to a specific version of the modules, such as the following example:
# source = "github.com/gruntwork-io/terraform-google-sql.git//modules/cloud-sql?ref=v0.1.1" # source = "github.com/gruntwork-io/terraform-google-sql.git//modules/cloud-sql?ref=v0.2.0"
source = "../../modules/cloud-sql" source = "../../modules/cloud-sql"
project = "${var.project}" project = var.project
region = "${var.region}" region = var.region
name = "${local.instance_name}" name = local.instance_name
db_name = "${var.db_name}" db_name = var.db_name
engine = "${var.postgres_version}" engine = var.postgres_version
machine_type = "${var.machine_type}" machine_type = var.machine_type
master_zone = "${var.master_zone}" master_zone = var.master_zone
# To make it easier to test this example, we are giving the servers public IP addresses and allowing inbound # 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 # connections from anywhere. In real-world usage, your servers should live in private subnets, only have private IP
@@ -69,16 +69,16 @@ module "postgres" {
enable_failover_replica = true enable_failover_replica = true
# Indicate we want read replicas to be created # Indicate we want read replicas to be created
num_read_replicas = "${var.num_read_replicas}" num_read_replicas = var.num_read_replicas
read_replica_zones = ["${var.read_replica_zones}"] read_replica_zones = var.read_replica_zones
# These together will construct the master_user privileges, i.e. # These together will construct the master_user privileges, i.e.
# 'master_user_name'@'master_user_host' IDENTIFIED BY 'master_user_password'. # 'master_user_name'@'master_user_host' IDENTIFIED BY 'master_user_password'.
# These should typically be set as the environment variable TF_VAR_master_user_password, etc. # These should typically be set as the environment variable TF_VAR_master_user_password, etc.
# so you don't check these into source control." # so you don't check these into source control."
master_user_password = "${var.master_user_password}" master_user_password = var.master_user_password
master_user_name = "${var.master_user_name}" master_user_name = var.master_user_name
master_user_host = "%" master_user_host = "%"
custom_labels = { custom_labels = {