From 8ad0deed318f85e9425c405bc9da002537d6b781 Mon Sep 17 00:00:00 2001 From: Abhishek Katiyar Date: Mon, 27 Apr 2020 04:37:17 +0530 Subject: [PATCH] [ ch8717 ] | Abhishek | Add support for creating readonly user and password --- bindata.go | 59 +++++++++++++++++++------------------- sample_infra_manifest.json | 4 ++- templates/rds-tf/main.tf | 8 ++++++ types.go | 2 ++ 4 files changed, 43 insertions(+), 30 deletions(-) diff --git a/bindata.go b/bindata.go index 8cd931c..70325e4 100644 --- a/bindata.go +++ b/bindata.go @@ -114,7 +114,7 @@ func bindataTemplatesAwsrolestfDeploysh() (*asset, error) { size: 374, md5checksum: "", mode: os.FileMode(420), - modTime: time.Unix(1583150135, 0), + modTime: time.Unix(1583930362, 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(1583150135, 0), + modTime: time.Unix(1583087747, 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(1587036332, 0), + modTime: time.Unix(1586425258, 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(1587036332, 0), + modTime: time.Unix(1586425258, 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(1587036332, 0), + modTime: time.Unix(1586425258, 0), } a := &asset{bytes: bytes, info: info} @@ -282,28 +282,29 @@ func bindataTemplatesRdstfDeploysh() (*asset, error) { } var _bindataTemplatesRdstfMaintf = []byte( - "\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") + "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xb4\x94\x4f\x4f\xdb\x40\x10\xc5\xef\xfe\x14\xab\xdc\xed\xb4\xea\xa1\x12" + + "\x12\x52\x69\x49\x2b\x2a\xb5\x42\x94\xf6\xd0\x8b\xb5\xb6\xc7\xce\xca\xbb\xb3\x66\x67\x4c\x08\x21\xdf\xbd\x5a\xaf" + + "\x13\x6c\x25\x24\x41\xa8\x3e\xc1\x64\xde\xdb\xdf\xbc\xfd\xc3\xe0\x9c\x2c\xad\x33\x62\x15\x09\x91\xc9\xbc\x06\x2c" + + "\xc4\x84\x3e\x4c\xba\x82\x10\x59\x9b\xd7\xc0\x62\xfc\x9d\x8b\x09\xca\x7b\x15\x67\x12\xeb\x78\x6b\x11\xe7\xd6\x18" + + "\x89\x45\x4c\x2c\x19\x26\x9d\xdc\x41\xa5\x2c\xee\xca\x65\x13\x93\x6d\x79\x1e\xbf\x0f\x7d\x35\x2c\xc5\xce\x77\x2e" + + "\x26\xae\xa0\xd0\xb0\xb0\xae\xa6\x46\xe6\x90\xd6\xb0\x4c\x1b\x07\xa5\x7a\xe8\x1b\xc2\x7a\x34\x5d\xad\x44\x32\x7b" + + "\x60\x27\x6f\x80\x6c\xeb\x72\xa0\xe4\x52\xb2\xcc\x24\x41\x72\x85\xc4\x12\x73\xf8\x29\x0d\x88\xf5\x3a\x78\x36\xce" + + "\x96\x4a\xc3\xce\xa2\xb9\x29\x42\x83\xcc\xf5\x5e\xaa\x10\x4a\x6c\x17\x08\x2e\x2e\x5b\xad\xe3\xdc\x22\x3b\xab\xbd" + + "\x6c\x1d\xad\xa3\xc8\xd8\xa2\xd5\x10\xf8\xbb\x24\x03\xd1\xc0\xa3\x52\x7c\x76\x46\x34\x3f\x9b\x4e\x2b\xc5\x9f\x2a" + + "\xc5\xf3\x36\x4b\x72\x53\x24\x5d\xb4\x0c\xf9\x3c\x51\x38\xed\xfe\x51\x58\x3a\x39\x75\x05\x25\x95\x62\xbf\x06\xe0" + + "\xbd\x72\x16\x0d\x20\x77\x6e\x7b\x46\x9f\x0d\x5a\x9e\xc4\x5d\x6b\xd9\x0f\x1e\x09\xa1\xfa\x28\x52\xf4\x59\xec\xd5" + + "\xee\x8f\x6d\xe4\xd2\x48\xa2\x85\x75\xc5\x66\x9e\x43\x2e\xd7\x9b\xde\x91\x03\xa9\x47\x18\xa6\x7a\xc8\xe1\x97\x7a" + + "\x84\x2b\xfc\x96\x05\x65\x4b\xe0\x4e\x55\xfe\xf6\xbd\x83\x75\x23\x21\x8c\x45\xc5\xd6\x29\xac\xd2\xd7\x4c\xf1\x63" + + "\x2b\xdb\x3f\xcf\xc0\xf6\x19\xf0\x54\xcb\x3d\x98\x45\xdf\x45\x27\x18\x5d\x66\x7e\x87\x48\x3c\x09\xd3\x12\xdf\xda" + + "\xef\x64\x31\x50\x6d\x5c\x52\x96\x15\x79\x97\x28\x80\xdd\x82\x34\xbd\xa9\xff\x33\xd9\xdd\xe1\x0e\x82\x8f\xb4\x45" + + "\x42\xac\x56\xb1\x50\xe5\x21\xb6\xd9\x03\x03\x92\xb2\x48\x3d\x53\x96\xc2\x73\xe9\xd8\x64\x03\xf5\xee\x78\x7e\x71" + + "\xff\x62\x9d\x86\x72\x03\xb2\xb0\xa8\x97\x5d\xda\x9d\xde\xf5\x95\xb0\x65\x87\x51\x46\xea\xff\x88\xb2\x3d\x94\xa7" + + "\xe1\x0c\x4e\xe3\xdb\x90\x2e\x16\xb4\xb9\xef\x5f\xb4\xa4\x7e\xb3\xe4\x82\xd2\xed\x93\x91\x77\xf5\xc3\x5c\x3b\x36" + + "\xa3\x53\xf5\x3a\xa4\xcf\x32\xaf\xdb\xe6\x52\x91\xcc\x34\x14\xc1\x21\xeb\x6a\xa9\x03\x06\x64\x65\x31\x6d\xc0\x29" + + "\xeb\xd3\x7a\xb7\xf1\xd7\x04\xc7\x7a\x3f\xbe\xc4\x82\x96\x0f\x5c\xd8\x56\xb3\xba\xf8\x3b\x06\x32\xbe\x98\xca\x47" + + "\x71\x2e\xd8\xb5\xf0\xea\x21\xaf\xe9\x4e\x7f\x95\x46\xe9\x65\xff\xb4\xd2\x9d\x4e\xcb\x50\x38\xf2\xb0\x3e\x2b\xdf" + + "\x10\xb2\x77\x99\x61\xa5\x10\xfe\x80\xf3\x17\x6d\x80\x01\x5d\x3d\xbd\xef\x7f\x38\x8e\x33\x36\x7a\x91\x6a\x1d\xfd" + + "\x0b\x00\x00\xff\xff\x29\x7f\x4f\x28\x7a\x08\x00\x00") func bindataTemplatesRdstfMaintfBytes() ([]byte, error) { return bindataRead( @@ -322,10 +323,10 @@ func bindataTemplatesRdstfMaintf() (*asset, error) { info := bindataFileInfo{ name: "templates/rds-tf/main.tf", - size: 1884, + size: 2170, md5checksum: "", mode: os.FileMode(420), - modTime: time.Unix(1587128614, 0), + modTime: time.Unix(1587942091, 0), } a := &asset{bytes: bytes, info: info} diff --git a/sample_infra_manifest.json b/sample_infra_manifest.json index 8803366..1640bc5 100644 --- a/sample_infra_manifest.json +++ b/sample_infra_manifest.json @@ -7,7 +7,9 @@ "password": "foo_service_password", "sizeInGb": 7, "dbNames": ["foo_service"], - "dbExtensions": ["pgcrypto"] + "dbExtensions": ["pgcrypto"], + "readonlyUser": "foo_readonly_user", + "readonlyPassword": "foo_readonly_password" }, "aws_access": { "policies": [ diff --git a/templates/rds-tf/main.tf b/templates/rds-tf/main.tf index f57e751..75ee178 100644 --- a/templates/rds-tf/main.tf +++ b/templates/rds-tf/main.tf @@ -31,6 +31,14 @@ module "rds" { db_extensions = {{ .ExtraResources.Database.DbExtensions | mustToJson }} {{- end }} + {{- if .ExtraResources.Database.ReadonlyUser }} + readonly_user = {{ .ExtraResources.Database.ReadonlyUser | mustToJson }} + {{- end }} + + {{- if .ExtraResources.Database.ReadonlyUser }} + readonly_password = {{ .ExtraResources.Database.ReadonlyPassword | mustToJson }} + {{- end }} + {{- if .ExtraResources.Database.AwsInstanceClass }} aws_instance_class = {{ .ExtraResources.Database.AwsInstanceClass | quote }} {{- end }} diff --git a/types.go b/types.go index 5e3991e..e127a8a 100644 --- a/types.go +++ b/types.go @@ -37,6 +37,8 @@ type Database struct { DbExtensions []string `json:"dbExtensions"` MonitoringUser string `env:"MONITORING_USER"` MonitoringPassword string `env:"MONITORING_PASSWORD"` + ReadonlyUser string `json:"readonlyUser"` + ReadonlyPassword string `json:"readonlyPassword"` } type Team struct {