Skip to content

Commit

Permalink
Fix/mysql user and mysql grant resources dont support empty string fo…
Browse files Browse the repository at this point in the history
…r tls option and table (#20)

* Add a new variable to determine if we want to create a user and grant with the tls options or not. Also update the files header

* Use NONE as default tls_option after discovering this is what terraform use as default value. Simplify code and remove useless if and count parameter.
  • Loading branch information
jmorissette authored Jan 29, 2019
1 parent 671294d commit 9713615
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions mysql_schema_configuration/mysql_schema_configuration.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2011 - 2017, Coveo Solutions Inc.
* Copyright (c) 2011 - 2019, Coveo Solutions Inc.
*/

resource "mysql_database" "schema" {
Expand All @@ -12,7 +12,7 @@ resource "mysql_user" "user" {

host = "%"
plaintext_password = "${var.password}"
tls_option = "${lookup(var.optional_parameters, "tls_option", "")}"
tls_option = "${lookup(var.optional_parameters, "tls_option", "NONE")}"
}

resource "mysql_grant" "grants" {
Expand All @@ -21,8 +21,8 @@ resource "mysql_grant" "grants" {
user = "${mysql_user.user.user}"
host = "${mysql_user.user.host}"
privileges = "${var.user_privileges}"
table = "${lookup(var.optional_parameters, "grants_table", "")}"
tls_option = "${lookup(var.optional_parameters, "tls_option", "")}"
table = "${lookup(var.optional_parameters, "grants_table", "*")}"
tls_option = "${lookup(var.optional_parameters, "tls_option", "NONE")}"
}

resource "aws_ssm_parameter" "username" {
Expand All @@ -39,4 +39,4 @@ resource "aws_ssm_parameter" "password" {
value = "${var.password}"

key_id = "${var.password_kms_key_id}"
}
}
2 changes: 1 addition & 1 deletion mysql_schema_configuration/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2011 - 2017, Coveo Solutions Inc.
* Copyright (c) 2011 - 2019, Coveo Solutions Inc.
*/

output "user" {
Expand Down
2 changes: 1 addition & 1 deletion mysql_schema_configuration/variables.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2011 - 2017, Coveo Solutions Inc.
* Copyright (c) 2011 - 2019, Coveo Solutions Inc.
*/

variable "parameter_store_path" {}
Expand Down
2 changes: 1 addition & 1 deletion rds_database_cluster/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2011 - 2017, Coveo Solutions Inc.
* Copyright (c) 2011 - 2019, Coveo Solutions Inc.
*/

output "endpoint" {
Expand Down
2 changes: 1 addition & 1 deletion rds_database_cluster/rds_database_cluster.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2011 - 2017, Coveo Solutions Inc.
* Copyright (c) 2011 - 2019, Coveo Solutions Inc.
*/

resource "aws_db_subnet_group" "db_subnet_group" {
Expand Down
2 changes: 1 addition & 1 deletion rds_database_cluster/variables.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2011 - 2017, Coveo Solutions Inc.
* Copyright (c) 2011 - 2019, Coveo Solutions Inc.
*/

// Required variables :
Expand Down
2 changes: 1 addition & 1 deletion rds_database_instance/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2011 - 2017, Coveo Solutions Inc.
* Copyright (c) 2011 - 2019, Coveo Solutions Inc.
*/

output "endpoint" {
Expand Down
2 changes: 1 addition & 1 deletion rds_database_instance/rds_database_instance.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2011 - 2017, Coveo Solutions Inc.
* Copyright (c) 2011 - 2019, Coveo Solutions Inc.
*/

resource "aws_db_subnet_group" "db_subnet_group" {
Expand Down
2 changes: 1 addition & 1 deletion rds_database_instance/variables.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2011 - 2017, Coveo Solutions Inc.
* Copyright (c) 2011 - 2019, Coveo Solutions Inc.
*/

// Required variables :
Expand Down

0 comments on commit 9713615

Please sign in to comment.