Merge pull request #11 from navi-infra/ch7797

ch7797| Deepak | adding monitoring user
This commit is contained in:
Deepak Jain
2020-04-20 16:44:33 +05:30
committed by GitHub Enterprise
6 changed files with 60 additions and 41 deletions

View File

@@ -114,7 +114,7 @@ func bindataTemplatesAwsrolestfDeploysh() (*asset, error) {
size: 374,
md5checksum: "",
mode: os.FileMode(420),
modTime: time.Unix(1583930362, 0),
modTime: time.Unix(1583150135, 0),
}
a := &asset{bytes: bytes, info: info}
@@ -157,7 +157,7 @@ func bindataTemplatesAwsrolestfMaintf() (*asset, error) {
size: 735,
md5checksum: "",
mode: os.FileMode(420),
modTime: time.Unix(1583087747, 0),
modTime: time.Unix(1583150135, 0),
}
a := &asset{bytes: bytes, info: info}
@@ -193,7 +193,7 @@ func bindataTemplatesAwss3buckettfDeploysh() (*asset, error) {
size: 211,
md5checksum: "",
mode: os.FileMode(420),
modTime: time.Unix(1586425258, 0),
modTime: time.Unix(1587036332, 0),
}
a := &asset{bytes: bytes, info: info}
@@ -236,7 +236,7 @@ func bindataTemplatesAwss3buckettfMaintf() (*asset, error) {
size: 660,
md5checksum: "",
mode: os.FileMode(420),
modTime: time.Unix(1586425258, 0),
modTime: time.Unix(1587036332, 0),
}
a := &asset{bytes: bytes, info: info}
@@ -273,7 +273,7 @@ func bindataTemplatesRdstfDeploysh() (*asset, error) {
size: 449,
md5checksum: "",
mode: os.FileMode(420),
modTime: time.Unix(1586425258, 0),
modTime: time.Unix(1587036332, 0),
}
a := &asset{bytes: bytes, info: info}
@@ -282,27 +282,28 @@ func bindataTemplatesRdstfDeploysh() (*asset, error) {
}
var _bindataTemplatesRdstfMaintf = []byte(
"\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x94\x41\x6b\xdb\x4e\x10\xc5\xef\xfa\x14\x83\xef\x92\xff\x7f\x7a\x28" +
"\x04\x0c\x4d\x1b\xb7\xa4\xd0\x12\xda\xb4\x87\x5e\xc4\x68\x35\x92\x17\xad\x76\x95\x9d\x51\x9c\xc4\xf1\x77\x2f\xab" +
"\x95\x13\x1b\x3b\x76\x42\x75\xb2\x47\xf3\xde\xfc\xe6\xb1\x2b\x21\xef\xb1\x72\xbe\x85\x55\x02\x50\xa0\x6a\xc8\x96" +
"\x30\xe1\x77\x93\xa1\x00\x50\xf4\xaa\x21\x81\xdd\x67\x06\x13\x8b\xb7\x3a\x2d\xd0\x36\xe9\x93\x45\xaa\x5c\xdb\xa2" +
"\x2d\x53\x16\x14\x9a\x0c\x72\x4f\xb5\x76\x76\x5f\x8e\x5d\xca\xae\x97\x45\xfa\x7f\xec\x6b\xe8\x1e\xf6\x9e\x19\x4c" +
"\x7c\xc9\xb1\x61\xe9\x7c\xc3\x1d\x2a\xca\x1b\xba\xcf\x3b\x4f\x95\xbe\x1b\x1b\xe2\x3c\x9e\xae\x56\x90\xcd\xef\xc4" +
"\xe3\x0f\x62\xd7\x7b\x45\x9c\x5d\xa0\x60\x81\x4c\xd9\xa5\x65\x41\xab\xe8\x3b\xb6\x04\xeb\x75\xf4\xec\xbc\xab\xb4" +
"\xa1\xbd\xa1\xaa\x2d\x63\x03\x2a\x73\x90\x2a\x86\x92\xba\xa5\x25\x9f\x56\xbd\x31\xa9\x72\x56\xbc\x33\x41\xb6\x4e" +
"\xd6\x49\xd2\xba\xb2\x37\x14\xf9\x87\x24\x23\xd1\x96\x47\xad\xe5\xec\x8c\x79\x71\x36\x9d\xd6\x5a\x3e\xd4\x5a\x16" +
"\x7d\x91\xa9\xb6\xcc\x86\x68\x85\xd4\x22\xd3\x76\x3a\xfc\xd1\xb6\xf2\x38\xf5\x25\x67\xb5\x96\x30\x83\xec\xad\xf6" +
"\xce\xb6\x64\x65\x70\x3b\xb0\xfa\x7c\xab\xe5\x11\x6e\x7a\x27\x61\xf1\x04\x40\x8f\x51\xe4\x36\x64\x71\x50\x7b\x38" +
"\xb6\x1d\x97\x0e\x99\x97\xce\x97\x9b\x7d\x8e\xb9\x5c\x6d\x7a\x77\x1c\x58\x3f\xd0\x76\xaa\xc7\x1c\x7e\xea\x07\xba" +
"\xb4\x5f\x8a\xa8\xec\x99\xfc\x6b\x95\xbf\x42\xef\xd6\xdc\x04\xa0\x1c\xdf\xf1\x2b\xe4\x17\x45\x58\x9d\xe1\x11\xda" +
"\x9e\xe5\xda\x7d\x65\x67\x23\xc4\xc6\x25\x17\xac\x39\xb8\x24\x11\xe7\x9a\xb0\x1d\x4d\xc3\xcf\x6c\x3f\xba\x01\x42" +
"\x4e\xb4\x25\x00\xab\x55\x0a\xba\x3a\xc6\x36\xbf\x13\xb2\xac\x9d\xe5\x91\xa9\xc8\xe9\xb9\x74\x6a\xb3\x2d\xf5\xfe" +
"\x7a\x61\x78\xf8\x14\xbc\x0e\xe5\x7c\xc9\x9b\xa3\xf2\xc9\x20\x8f\x38\xb8\xe4\xfc\xe9\xb4\xa9\xa1\x7e\x9c\x69\xcf" +
"\x66\x27\xb7\xb7\x21\x7d\x44\xd5\xf4\xdd\x85\x66\x2c\x0c\x95\xd1\xa1\x18\x6a\xb9\x27\x21\x2b\xda\xd9\xbc\x23\xaf" +
"\x5d\x09\x33\xf8\x6f\xe3\x6f\x98\x4e\xf5\xbe\x7f\x89\xc5\x3a\x79\x99\xe7\x5b\x6f\x44\x9f\xff\xd9\x05\x6a\x43\x31" +
"\xc7\x07\x98\x81\xf8\x9e\xde\xbc\xe4\x15\xdf\x98\xcf\xd8\x6a\x73\x3f\xde\x4a\xbe\x31\x79\x15\x0b\x27\xee\xe4\xb3" +
"\xf2\x1f\x42\x0e\x2e\x73\x5b\x6b\x4b\xbf\xc9\x87\xa3\xb4\x85\x41\x43\x3d\xbf\x1d\x5f\x9c\xc6\xd9\x35\x7a\x91\x6a" +
"\x9d\xfc\x0d\x00\x00\xff\xff\x34\xcc\x13\xc2\xb5\x06\x00\x00")
"\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x94\x4d\x6f\xdb\x3c\x0c\x80\xef\xfe\x15\x44\xee\x76\xde\x17\x3b\x0c" +
"\x28\x10\x60\xdd\x9a\x0d\x1d\xb0\xa1\xd8\xba\x1d\x76\x31\x64\x9b\x76\x04\x5b\x94\x2b\xd2\x4d\xdb\x34\xff\x7d\x90" +
"\xe5\xb4\x0e\x92\xe6\x03\xf3\x29\x61\xc8\x87\x0f\x69\x45\x82\xce\xa9\xd2\x3a\x03\xab\x08\x20\x53\x79\x8d\x54\xc0" +
"\x84\xdf\x4d\xfa\x00\x40\xd6\xe5\x35\x0a\x6c\x3f\x33\x98\x90\xba\xd7\x71\xa6\xa8\x8e\x5f\x10\x71\x6e\x8d\x51\x54" +
"\xc4\x2c\x4a\x70\xd2\x97\x3b\xac\xb4\xa5\xdd\x72\xd5\xc6\x6c\x3b\x59\xc4\xff\x87\xbc\x1a\x1f\x61\xe7\x99\xc1\xc4" +
"\x15\x1c\x12\x96\xd6\xd5\xdc\xaa\x1c\xd3\x1a\x1f\xd3\xd6\x61\xa9\x1f\x86\x84\xd0\x8f\xa7\xab\x15\x24\xf3\x07\x71" +
"\xea\x07\xb2\xed\x5c\x8e\x9c\x5c\x29\x51\x99\x62\x4c\xae\x89\x45\x51\x8e\xdf\x95\x41\x58\xaf\x03\xb3\x75\xb6\xd4" +
"\x0d\xee\x34\xcd\x4d\x11\x12\x54\xde\xec\xb5\x0a\x4b\x89\xed\x92\xd0\xc5\x65\xd7\x34\x71\x6e\x49\x9c\x6d\x7c\xd9" +
"\x3a\x5a\x47\x91\xb1\x45\xd7\x60\xf0\xef\x37\x19\x8c\x46\x8c\x4a\xcb\xc5\x05\xf3\xe2\x62\x3a\xad\xb4\x7c\xa8\xb4" +
"\x2c\xba\x2c\xc9\x4d\x91\xf4\xab\x15\xcc\x17\x89\xa6\x69\xff\x45\x53\xe9\xd4\xd4\x15\x9c\x54\x5a\x7c\x0f\xa4\x7b" +
"\xed\x2c\x19\x24\xe9\x69\x7b\x46\x9f\x8f\x52\x9e\xe1\xae\xb3\xe2\x07\x8f\x00\xf4\xb0\x8a\x94\xfc\x2e\xf6\xd6\xee" +
"\x5f\xdb\x16\xa5\x55\xcc\x4b\xeb\x8a\xcd\x3c\x87\x28\x37\x9b\xdc\x2d\x02\xeb\x27\x1c\x6f\xf5\x10\xe1\xa7\x7e\xc2" +
"\x6b\xfa\x92\x85\xca\x8e\xd1\x9d\x5a\xf9\xcb\xe7\x8e\xfa\x46\x00\xc6\x92\x16\xeb\x34\x55\xe9\x39\x53\x7c\x7b\x29" +
"\xdb\x3f\xcf\x08\xfb\x2a\x78\x2a\x72\x8f\x66\x31\x64\xf1\x09\xa0\xab\xcc\xbf\x21\x86\x67\x30\x1d\xcb\xad\xfd\xca" +
"\x96\x82\xd5\x86\x92\x8a\xaa\xd8\x53\xa2\x20\x76\x8b\xca\x0c\x50\xff\x31\xd9\x7d\xc3\xbd\x84\x1c\x49\x8b\x00\x56" +
"\xab\x18\x74\x79\xc8\x6d\xfe\x20\x48\xac\x2d\xf1\xe0\x94\xa5\xf8\x1a\x3a\x36\xd9\xa8\x7a\x77\x3c\xdf\xdc\xdf\x58" +
"\xa7\xa9\x5c\x2e\x79\x73\xa2\x3f\x35\x8a\x07\x1d\xb5\xe4\xf4\xe5\x4f\x91\xf7\xf1\xc3\x4e\x3b\x98\xad\xbd\x9d\xa7" +
"\xf4\x51\xe5\x75\xd7\x5e\x69\x56\x59\x83\x45\x20\x64\x7d\x2c\x75\x28\x48\xa2\x2d\xa5\x2d\x3a\x6d\x0b\x98\xc1\x7f" +
"\x1b\x7e\xc3\x78\x2c\xf7\xfd\x5b\x2e\x64\xe5\xc0\x91\xec\x1a\xd1\x97\x7f\xb6\x85\x8c\x0f\xa6\xea\x09\x66\x20\xae" +
"\xc3\xb3\x87\xbc\xe1\xbb\xe6\xb3\x32\xba\x79\x1c\x2e\x0f\xbe\x6b\xd2\x32\x04\x8e\x5c\x1d\xaf\x95\xff\xb0\x64\x4f" +
"\x99\x53\xa5\x09\x7f\xa3\xf3\x47\x69\xa4\x81\x7d\x3c\xbd\x1f\x7e\x38\xae\xb3\x0d\x7a\xd3\x6a\x1d\xfd\x0d\x00\x00" +
"\xff\xff\xec\xc5\xed\x61\x5c\x07\x00\x00")
func bindataTemplatesRdstfMaintfBytes() ([]byte, error) {
return bindataRead(
@@ -321,10 +322,10 @@ func bindataTemplatesRdstfMaintf() (*asset, error) {
info := bindataFileInfo{
name: "templates/rds-tf/main.tf",
size: 1717,
size: 1884,
md5checksum: "",
mode: os.FileMode(420),
modTime: time.Unix(1586790829, 0),
modTime: time.Unix(1587128614, 0),
}
a := &asset{bytes: bytes, info: info}

1
go.mod
View File

@@ -5,6 +5,7 @@ go 1.13
require (
github.com/Masterminds/sprig/v3 v3.0.2
github.com/a8m/envsubst v1.1.0
github.com/caarlos0/env/v6 v6.2.1 // indirect
github.com/huandu/xstrings v1.2.1 // indirect
github.com/imdario/mergo v0.3.8 // indirect
github.com/urfave/cli/v2 v2.1.1

4
go.sum
View File

@@ -7,6 +7,9 @@ github.com/Masterminds/sprig/v3 v3.0.2 h1:wz22D0CiSctrliXiI9ZO3HoNApweeRGftyDN+B
github.com/Masterminds/sprig/v3 v3.0.2/go.mod h1:oesJ8kPONMONaZgtiHNzUShJbksypC5kWczhZAf6+aU=
github.com/a8m/envsubst v1.1.0 h1:d+14SVq1lbI+JuxhEqYduWofZ0/qQHatwm3TBzvdzaE=
github.com/a8m/envsubst v1.1.0/go.mod h1:91m2Q6AZE0w4WD/laQam2MtWq6FxJVm7UqcB30DeYxw=
github.com/caarlos0/env v3.5.0+incompatible h1:Yy0UN8o9Wtr/jGHZDpCBLpNrzcFLLM2yixi/rBrKyJs=
github.com/caarlos0/env/v6 v6.2.1 h1:/bFpX1dg4TNioJjg7mrQaSrBoQvRfLUHNfXivdFbbEo=
github.com/caarlos0/env/v6 v6.2.1/go.mod h1:3LpmfcAYCG6gCiSgDLaFR5Km1FRpPwFvBbRcjHar6Sw=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
@@ -37,6 +40,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/urfave/cli/v2 v2.1.1 h1:Qt8FeAtxE/vfdrLmR3rxR6JRE0RoVmbXu8+6kZtYU4k=
github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=

12
main.go
View File

@@ -2,11 +2,13 @@ package main
import (
"encoding/json"
"github.com/a8m/envsubst"
"github.com/urfave/cli/v2"
"io/ioutil"
"log"
"os"
"github.com/a8m/envsubst"
"github.com/caarlos0/env/v6"
"github.com/urfave/cli/v2"
)
func init() {
@@ -34,6 +36,12 @@ func parseManifest(manifestPath string) (*Manifest, error) {
return nil, err
}
err = env.Parse(&manifest.ExtraResources.Database)
if err != nil {
log.Fatalf("\nErr: %v", err)
return nil, err
}
manifest.ExtraResources.Workspace = workspaceMap[manifest.ExtraResources.Environment]
manifest.Deployment.NameSuffix = DEPLOYMENT_NAME_SUFFIX

View File

@@ -17,6 +17,9 @@ module "rds" {
size = {{ .ExtraResources.Database.SizeInGb }}
user = {{ .ExtraResources.Database.User | quote }}
monitoring_password = {{ .ExtraResources.Database.MonitoringPassword | quote }}
monitoring_user = {{ .ExtraResources.Database.MonitoringUser | quote }}
databases = {{ .ExtraResources.Database.DbNames | mustToJson }}
database_tags = {
Team = {{ .Team.Name | quote }}

View File

@@ -24,17 +24,19 @@ type ExtraResources struct {
//We provide defaults in respective terraforms instead of here to keep all values at one place
type Database struct {
AwsInstanceClass string `json:"awsInstanceClass"`
PsqlFamily string `json:"psqlFamily"`
PsqlEngineVersion string `json:"psqlEngineVersion"`
User string `json:"user"`
Password string `json:"password"`
SizeInGb int `json:"sizeInGb"`
DbNames []string `json:"dbNames"`
InstanceName string `json:"instanceName"`
BackupDisabled bool `json:"backupDisabled"`
MultiAZDisabled bool `json:"multiAZDisabled"`
DbExtensions []string `json:"dbExtensions"`
AwsInstanceClass string `json:"awsInstanceClass"`
PsqlFamily string `json:"psqlFamily"`
PsqlEngineVersion string `json:"psqlEngineVersion"`
User string `json:"user"`
Password string `json:"password"`
SizeInGb int `json:"sizeInGb"`
DbNames []string `json:"dbNames"`
InstanceName string `json:"instanceName"`
BackupDisabled bool `json:"backupDisabled"`
MultiAZDisabled bool `json:"multiAZDisabled"`
DbExtensions []string `json:"dbExtensions"`
MonitoringUser string `env:"MONITORING_USER"`
MonitoringPassword string `env:"MONITORING_PASSWORD"`
}
type Team struct {