From f66658a688a3382eec5af7a2d216c6dfe5f1950a Mon Sep 17 00:00:00 2001 From: rob salmond Date: Tue, 9 Apr 2019 17:02:40 -0600 Subject: [PATCH 1/2] replace hazardous tf patterns with better patterns --- website/docs/d/google_kms_secret.html.markdown | 6 +++++- website/docs/r/sql_database.html.markdown | 6 +++++- .../docs/r/sql_database_instance.html.markdown | 18 +++++++++++++++--- website/docs/r/sql_ssl_cert.html.markdown | 6 +++++- website/docs/r/sql_user.html.markdown | 6 +++++- 5 files changed, 35 insertions(+), 7 deletions(-) diff --git a/website/docs/d/google_kms_secret.html.markdown b/website/docs/d/google_kms_secret.html.markdown index 92454928ec1..359738dc4fc 100644 --- a/website/docs/d/google_kms_secret.html.markdown +++ b/website/docs/d/google_kms_secret.html.markdown @@ -59,8 +59,12 @@ data "google_kms_secret" "sql_user_password" { ciphertext = "CiQAqD+xX4SXOSziF4a8JYvq4spfAuWhhYSNul33H85HnVtNQW4SOgDu2UZ46dQCRFl5MF6ekabviN8xq+F+2035ZJ85B+xTYXqNf4mZs0RJitnWWuXlYQh6axnnJYu3kDU=" } +resource "random_id" "db_name_suffix" { + byte_length = 4 +} + resource "google_sql_database_instance" "master" { - name = "master-instance" + name = "master-instance-${random_id.db_name_suffix.hex}" settings { tier = "D0" diff --git a/website/docs/r/sql_database.html.markdown b/website/docs/r/sql_database.html.markdown index 948c49c761a..8395517fb67 100644 --- a/website/docs/r/sql_database.html.markdown +++ b/website/docs/r/sql_database.html.markdown @@ -17,8 +17,12 @@ or the [JSON API](https://cloud.google.com/sql/docs/admin-api/v1beta4/databases) Example creating a SQL Database. ```hcl +resource "random_id" "db_name_suffix" { + byte_length = 4 +} + resource "google_sql_database_instance" "master" { - name = "master-instance" + name = "master-instance-${random_id.db_name_suffix.hex}" settings { tier = "D0" diff --git a/website/docs/r/sql_database_instance.html.markdown b/website/docs/r/sql_database_instance.html.markdown index 52e15991e4d..ba3a48f74de 100644 --- a/website/docs/r/sql_database_instance.html.markdown +++ b/website/docs/r/sql_database_instance.html.markdown @@ -21,8 +21,12 @@ a restricted host and strong password. ### SQL First Generation ```hcl +resource "random_id" "db_name_suffix" { + byte_length = 4 +} + resource "google_sql_database_instance" "master" { - name = "master-instance" + name = "master-instance-${random_id.db_name_suffix.hex}" database_version = "MYSQL_5_6" # First-generation instance regions are not the conventional # Google Compute Engine regions. See argument reference below. @@ -91,8 +95,12 @@ data "null_data_source" "auth_netw_postgres_allowed_2" { } } +resource "random_id" "db_name_suffix" { + byte_length = 4 +} + resource "google_sql_database_instance" "postgres" { - name = "postgres-instance" + name = "postgres-instance-${random_id.db_name_suffix.hex}" database_version = "POSTGRES_9_6" settings { @@ -136,10 +144,14 @@ resource "google_service_networking_connection" "private_vpc_connection" { reserved_peering_ranges = ["${google_compute_global_address.private_ip_address.name}"] } +resource "random_id" "db_name_suffix" { + byte_length = 4 +} + resource "google_sql_database_instance" "instance" { provider = "google-beta" - name = "private-instance" + name = "private-instance-${random_id.db_name_suffix.hex}" region = "us-central1" depends_on = [ diff --git a/website/docs/r/sql_ssl_cert.html.markdown b/website/docs/r/sql_ssl_cert.html.markdown index 8c9113772f7..547507fc99d 100644 --- a/website/docs/r/sql_ssl_cert.html.markdown +++ b/website/docs/r/sql_ssl_cert.html.markdown @@ -18,8 +18,12 @@ Creates a new Google SQL SSL Cert on a Google SQL Instance. For more information Example creating a SQL Client Certificate. ```hcl +resource "random_id" "db_name_suffix" { + byte_length = 4 +} + resource "google_sql_database_instance" "master" { - name = "master-instance" + name = "master-instance-${random_id.db_name_suffix.hex}" settings { tier = "D0" diff --git a/website/docs/r/sql_user.html.markdown b/website/docs/r/sql_user.html.markdown index 1628adb899b..8ed3d280a56 100644 --- a/website/docs/r/sql_user.html.markdown +++ b/website/docs/r/sql_user.html.markdown @@ -19,8 +19,12 @@ Creates a new Google SQL User on a Google SQL User Instance. For more informatio Example creating a SQL User. ```hcl +resource "random_id" "db_name_suffix" { + byte_length = 4 +} + resource "google_sql_database_instance" "master" { - name = "master-instance" + name = "master-instance-${random_id.db_name_suffix.hex}" settings { tier = "D0" From d91e4e894f60f4e23420797fea08cb24112983d2 Mon Sep 17 00:00:00 2001 From: rob salmond Date: Tue, 9 Apr 2019 17:12:26 -0600 Subject: [PATCH 2/2] whitespace fix --- website/docs/d/google_kms_secret.html.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/d/google_kms_secret.html.markdown b/website/docs/d/google_kms_secret.html.markdown index 359738dc4fc..6ad424e519b 100644 --- a/website/docs/d/google_kms_secret.html.markdown +++ b/website/docs/d/google_kms_secret.html.markdown @@ -64,7 +64,7 @@ resource "random_id" "db_name_suffix" { } resource "google_sql_database_instance" "master" { - name = "master-instance-${random_id.db_name_suffix.hex}" + name = "master-instance-${random_id.db_name_suffix.hex}" settings { tier = "D0"