[INFRA-403] | Piyush | Add support for creating read replica

This commit is contained in:
Piyush Sinha
2020-06-26 11:32:06 +05:30
parent 76cc3435ac
commit 358418896d
5 changed files with 66 additions and 46 deletions

View File

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

View File

@@ -10,7 +10,11 @@
"dbExtensions": ["pgcrypto"],
"readonlyUser": "foo_readonly_user",
"readonlyPassword": "foo_readonly_password",
"performanceInsightsEnabled": false
"performanceInsightsEnabled": false,
"readReplica": {
"awsInstanceClass": "db.t3.micro",
"performanceInsightsEnabled": true
}
},
"aws_access": {
"policies": [

View File

@@ -11,5 +11,7 @@ terraform init
terraform workspace select {{ .ExtraResources.Workspace }} || terraform workspace new {{ .ExtraResources.Workspace }}
terraform $terraform_action -target=module.rds.data.aws_subnet_ids.command_private_subnets $additional_terraform_options
terraform $terraform_action -target=module.rds.module.rds_instance $additional_terraform_options
terraform $terraform_action -target=module.rds.module.rds_instance_events $additional_terraform_options
{{- if .ExtraResources.Database.ReadReplica }}
terraform $terraform_action -target=module.rds.module.rds_instance_replica $additional_terraform_options
{{- end }}
terraform $terraform_action -target=module.rds.module.postgres_db $additional_terraform_options

View File

@@ -74,4 +74,9 @@ module "rds" {
psql_engine_version = {{ .ExtraResources.Database.PsqlEngineVersion | quote }}
{{- end }}
{{- if .ExtraResources.Database.ReadReplica }}
read_replica_instance_class = {{ .ExtraResources.Database.ReadReplica.AwsInstanceClass | mustToJson }}
read_replica_performance_insights_enabled = {{ .ExtraResources.Database.ReadReplica.PerformanceInsightsEnabled | mustToJson }}
{{- end }}
}

View File

@@ -40,6 +40,7 @@ type Database struct {
ReadonlyUser string `json:"readonlyUser"`
ReadonlyPassword string `json:"readonlyPassword"`
PerformanceInsightsEnabled bool `json:"performanceInsightsEnabled"`
ReadReplica *ReadReplica `json:"readReplica"`
}
type Team struct {
@@ -73,3 +74,8 @@ type LifecycleRule struct {
type ObjectExpiration struct {
Days int `json:"days"`
}
type ReadReplica struct {
AwsInstanceClass string `json:"awsInstanceClass"`
PerformanceInsightsEnabled bool `json:"performanceInsightsEnabled"`
}