From 676b625bd2eb695f5c8bf0064742848b5659d769 Mon Sep 17 00:00:00 2001 From: pradeepbhadani Date: Wed, 5 Jun 2019 13:47:49 +0100 Subject: [PATCH] Fix aws region (#109) * fixes #108, Put region flag in aws command * update CHANGELOG.md --- CHANGELOG.md | 5 +++++ db.tf | 1 + scripts/mysql-user.sh | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index feeebb9..448b6db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [2.0.1] - 2019-06-05 + +### Added +- `region` flag to `mysql_user.sh` script. + ## [2.0.0] - 2019-05-23 ### Added diff --git a/db.tf b/db.tf index 006b0b9..1f2ac48 100644 --- a/db.tf +++ b/db.tf @@ -122,6 +122,7 @@ resource "null_resource" "mysql_rw_user" { MYSQL_DB = "${var.apiary_database_name}" MYSQL_SECRET_ARN = "${data.aws_secretsmanager_secret.db_rw_user.arn}" MYSQL_PERMISSIONS = "ALL" + AWS_REGION = "${var.aws_region}" } } } diff --git a/scripts/mysql-user.sh b/scripts/mysql-user.sh index 1338811..bc8ff7d 100755 --- a/scripts/mysql-user.sh +++ b/scripts/mysql-user.sh @@ -1,6 +1,6 @@ #!/bin/bash MYSQL_OPTIONS="-h $MYSQL_HOST --user=$MYSQL_MASTER_USER --password=$MYSQL_MASTER_PASSWORD" MYSQL_USER=$(aws secretsmanager get-secret-value --secret-id ${MYSQL_SECRET_ARN}|jq .SecretString -r|jq .username -r) -MYSQL_PASSWORD=$(aws secretsmanager get-secret-value --secret-id ${MYSQL_SECRET_ARN}|jq .SecretString -r|jq .password -r) +MYSQL_PASSWORD=$(aws secretsmanager get-secret-value --secret-id ${MYSQL_SECRET_ARN} --region ${AWS_REGION}|jq .SecretString -r|jq .password -r) echo "GRANT $MYSQL_PERMISSIONS ON $MYSQL_DB.* TO '$MYSQL_USER'@\`%\` IDENTIFIED BY '$MYSQL_PASSWORD';"|mysql $MYSQL_OPTIONS