From c79d74524dbf27337368ac7b2051f2da6a06c2c6 Mon Sep 17 00:00:00 2001 From: piyush-sinha Date: Thu, 26 Mar 2020 11:46:53 +0530 Subject: [PATCH 1/6] [ch5781] | Piyush | Add support for db backup --- bindata.go | 64 ++++++++++++++++++++------------------ rds-tf/deploy.sh | 7 +++++ rds-tf/main.tf | 25 +++++++++++++++ sample_infra_manifest.json | 15 ++++----- templates/rds-tf/deploy.sh | 11 ++++--- templates/rds-tf/main.tf | 8 ++++- types.go | 1 + 7 files changed, 87 insertions(+), 44 deletions(-) create mode 100755 rds-tf/deploy.sh create mode 100755 rds-tf/main.tf diff --git a/bindata.go b/bindata.go index 0d4a4dc..34a32fb 100644 --- a/bindata.go +++ b/bindata.go @@ -112,7 +112,7 @@ func bindataTemplatesAwsrolestfDeploysh() (*asset, error) { size: 374, md5checksum: "", mode: os.FileMode(420), - modTime: time.Unix(1583091581, 0), + modTime: time.Unix(1584392515, 0), } a := &asset{bytes: bytes, info: info} @@ -155,7 +155,7 @@ func bindataTemplatesAwsrolestfMaintf() (*asset, error) { size: 735, md5checksum: "", mode: os.FileMode(420), - modTime: time.Unix(1583087747, 0), + modTime: time.Unix(1582736085, 0), } a := &asset{bytes: bytes, info: info} @@ -164,13 +164,14 @@ func bindataTemplatesAwsrolestfMaintf() (*asset, error) { } var _bindataTemplatesRdstfDeploysh = []byte( - "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\x8d\x41\x4e\xc4\x30\x0c\x45\xf7\x9c\xc2\x88\x75\xd3\x13\xb0\xe4\x02" + - "\x6c\x58\x46\x6e\x62\x4a\x44\x13\x47\xb6\xd3\x82\xda\xde\x9d\x0d\x9a\xa9\x46\x23\xcd\x68\x76\xb6\xfe\x7f\xef\xbf" + - "\x3c\xf7\x43\x2a\xbd\x7e\x3d\x19\x89\xe0\x27\x4b\x86\x54\x92\x1d\xde\x85\xe5\x5b\x2b\x06\x02\xa5\x89\x82\xc1\xba" + - "\x82\x7b\xfb\x31\xc1\x77\x52\x6e\x12\x48\xdd\xc7\xa9\xb3\xef\xb0\x6d\x70\x8d\x2e\xb4\xdc\x42\x0f\xab\x58\xeb\xf4" + - "\x0b\x9d\xa1\x8c\x64\xaf\x99\x63\x9b\xc8\x49\x54\x17\xd1\xd0\xe1\xa2\x5e\xdb\x50\xc8\x7c\x8a\xea\x02\xe7\x8c\x25" + - "\xfa\x2a\x69\x46\xa3\xff\x48\xa1\xc3\x66\xdc\x61\xad\xc2\x33\xdd\x23\x3f\x9f\x3e\x15\x35\x2c\x81\x1e\x96\x54\x56" + - "\x1b\x85\xd4\xc7\xe1\xc2\xf1\x17\x00\x00\xff\xff\x61\x91\x15\xf4\x75\x01\x00\x00") + "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x8e\x31\x4e\x04\x31\x0c\x45\x7b\x4e\x11\x44\x3d\x59\x51\x52\x50\x72" + + "\x01\x1a\xca\xc8\x93\x7c\x96\x88\x19\x3b\xb2\x9d\x19\xd0\xee\xde\x9d\x06\x2d\x0c\x0d\x48\x6c\x67\xd9\x7e\xef\xff" + + "\x9b\xeb\xdd\x58\x79\x67\x2f\x57\x0e\x55\x7a\x16\x9d\x6f\xef\x42\xe5\xea\x9b\xc5\x2a\xfa\x6a\x8d\x32\x82\x61\x42" + + "\xf6\x70\x38\x84\xf8\xf0\xe6\x4a\x8f\x30\xe9\x9a\x61\xf1\xe9\xfc\x73\x3a\x85\xe3\x31\x9c\xf9\x6f\x34\x63\xfd\x0d" + + "\xdd\xe4\x52\x6b\xd3\x7b\x18\x9c\x74\x0f\xbf\x9f\xa5\xf4\x09\x51\x8b\xc5\x42\x4e\x91\x56\x4b\xd6\x47\x86\xa7\x5a" + + "\x2c\x66\x99\x67\xe2\x92\x9a\xd6\x85\x1c\x9f\x27\x0b\x03\x75\x97\x81\x5a\x53\x59\xf0\x37\xfd\xd7\x98\x2a\x9b\x13" + + "\x67\x5c\x48\x93\xb0\x80\xff\x55\xaa\x89\xf9\x5e\x61\xa9\x8c\x3f\x2c\x1f\x01\x00\x00\xff\xff\x78\xa7\xe0\xdd\xcd" + + "\x01\x00\x00") func bindataTemplatesRdstfDeployshBytes() ([]byte, error) { return bindataRead( @@ -189,10 +190,10 @@ func bindataTemplatesRdstfDeploysh() (*asset, error) { info := bindataFileInfo{ name: "templates/rds-tf/deploy.sh", - size: 373, + size: 461, md5checksum: "", mode: os.FileMode(420), - modTime: time.Unix(1582717464, 0), + modTime: time.Unix(1585173441, 0), } a := &asset{bytes: bytes, info: info} @@ -201,24 +202,25 @@ func bindataTemplatesRdstfDeploysh() (*asset, error) { } var _bindataTemplatesRdstfMaintf = []byte( - "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x53\x5d\x6b\xdb\x30\x14\x7d\xf7\xaf\xb8\xe4\x5d\x0e\x63\x6f\x85\xc2" + - "\xc6\x9a\x8d\xee\x61\x94\xad\xdb\xab\xb9\x96\xaf\x1d\x61\x7d\x24\xba\x72\xd2\x34\xcd\x7f\x1f\xb2\x9c\x2e\xc6\x69" + - "\x52\x98\xc0\x60\x5f\x9d\x73\xee\xb9\x47\x72\x20\xef\xb1\x76\xde\xc0\x3e\x03\x28\x51\xb6\x64\x2b\x98\xf1\xc7\x59" + - "\x5f\x00\x28\x3b\xd9\x52\x80\xf1\xba\x85\x99\xc5\x8d\x12\x25\xda\x56\xbc\x4a\x08\xe9\x8c\x41\x5b\x09\x0e\x18\x68" + - "\xd6\xd3\x3d\x35\xca\xd9\x29\x1d\x57\x82\x5d\x17\x96\xe2\x43\xc2\xb5\xb4\x83\xc9\xba\x85\x99\xaf\x38\x01\xb6\xce" + - "\xb7\xbc\x42\x49\x45\x4b\xbb\x62\xe5\xa9\x56\x4f\x03\x20\xf5\xe3\xf9\x7e\x0f\xf9\xe2\x29\x78\xfc\x49\xec\x3a\x2f" + - "\x89\xf3\x3b\x0c\x58\x22\x53\x7e\x6f\x39\xa0\x95\xf4\x03\x0d\xc1\xe1\x90\x34\x57\xde\xd5\x4a\xd3\xa4\xa9\x34\x55" + - "\x02\xa0\xd4\x67\x5d\xa5\x50\x84\xdb\x5a\xf2\xa2\xee\xb4\x16\xd2\xd9\xe0\x9d\x8e\xb4\x43\x76\xc8\x32\xe3\xaa\x4e" + - "\x53\xf2\xdf\x27\x99\x1c\x9d\x68\x34\x2a\xdc\xdc\x30\x2f\x6f\xe6\xf3\x46\x85\x4f\x8d\x0a\xcb\xae\xcc\xa5\xa9\xf2" + - "\x3e\xda\x40\x72\x99\x2b\x3b\xef\x3f\x94\xad\x3d\xce\x7d\xc5\x79\xa3\x42\xec\x41\x76\xa3\xbc\xb3\x86\x6c\xe8\xd5" + - "\xce\x8c\xbe\x38\x81\xbc\xc0\xba\x73\x21\x0e\x9e\x01\xa8\x21\x8a\xc2\xc6\x2c\xce\x72\xcf\xc7\x36\x52\x59\x21\xf3" + - "\xd6\xf9\xea\x38\xcf\x25\x95\x87\x23\x76\xa4\xc0\xea\x99\x4e\x53\xbd\xa4\xf0\x4b\x3d\xd3\xbd\xfd\x56\x26\x66\xc7" + - "\xe4\xdf\xcb\xfc\x1d\xb1\x27\x7d\x33\x80\x6a\xd8\xe3\x77\xd0\xef\xca\x38\x3a\xc3\x0b\x98\x8e\xc3\xa3\xfb\xce\xce" + - "\x26\x13\x47\x95\x22\x60\xc3\x51\x25\x4b\x76\x1e\x09\xcd\x20\x1a\x5f\xf3\x69\x74\xf1\xc9\x00\xf6\x7b\x01\xaa\x7e" + - "\xbb\xf5\xe7\x2d\x1f\xe3\xff\xa2\x91\x39\x91\x71\xcb\xc5\xeb\x09\xca\xbe\x7e\x79\x82\x89\xcc\xc8\x4b\x34\x11\xff" + - "\xf8\x94\xcc\x35\x4b\x0f\xbc\xd6\x5f\xd1\x28\xbd\x1b\x2e\x01\xaf\x75\x51\xa7\xc2\x95\x2b\xf0\x8f\xf9\x9f\xfd\x17" + - "\xb6\x51\x96\xfe\x90\x67\x75\x3c\x8a\xde\x06\xf5\xf5\x62\x33\x6c\x5c\xb7\x33\x16\x7a\xd3\xd5\x21\xfb\x1b\x00\x00" + - "\xff\xff\xa5\x20\x97\xf0\x24\x05\x00\x00") + "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x93\x4f\x6f\xda\x40\x10\xc5\xef\xfe\x14\x23\xee\x36\xad\x7a\xa8\x14" + + "\x29\x52\xff\x84\x56\xe9\xa1\x8a\xda\xb4\x57\x6b\xbc\x1e\x9b\x95\xd7\xb3\xce\xce\x1a\x42\x88\xbf\x7b\x65\xaf\x9d" + + "\x82\x20\x40\x55\x9f\x60\xfc\xde\x6f\xde\x3e\x16\x4f\xce\x61\x61\x5d\x0d\xdb\x08\x20\x43\x55\x11\xe7\x30\x93\x77" + + "\xb3\x61\x00\x90\xb5\xaa\x22\x0f\xfb\xcf\x35\xcc\x18\x57\x3a\xce\x90\xab\xf8\x05\x11\x2b\x5b\xd7\xc8\x79\x2c\x1e" + + "\x3d\xcd\x06\xbb\xa3\x52\x5b\x3e\xb4\x63\x13\x8b\x6d\xfd\x32\x7e\x1b\x74\x15\x6d\xe0\xe0\xb9\x86\x99\xcb\x25\x08" + + "\xd6\xd6\x55\xd2\xa0\xa2\xb4\xa2\x4d\xda\x38\x2a\xf4\xe3\x28\x08\xfb\x64\xbe\xdd\x42\xb2\x78\xf4\x0e\x7f\x90\xd8" + + "\xd6\x29\x92\xe4\x06\x3d\x66\x28\x94\xdc\xb2\x78\x64\x45\xdf\xb1\x26\xe8\xba\xc0\x6c\x9c\x2d\xb4\xa1\x83\xa5\xaa" + + "\xce\x83\x00\x95\x39\x9a\x2a\x94\x12\xdb\x35\x93\x8b\x8b\xd6\x98\x58\x59\xf6\xce\x9a\xde\xd6\x45\x5d\x14\xd5\x36" + + "\x6f\x0d\x85\xfc\x43\x93\x21\xd1\x0e\xa3\xd4\xfe\xea\x4a\x64\x79\x35\x9f\x97\xda\x7f\x28\xb5\x5f\xb6\x59\xa2\xea" + + "\x3c\x19\xaa\xf5\xa4\x96\x89\xe6\xf9\xf0\x45\x73\xe1\x70\xee\x72\x49\x4a\xed\xfb\x1d\xc4\x2b\xed\x2c\xd7\xc4\x7e" + + "\xa0\x1d\x39\xfa\x62\x47\xf2\x0c\x0f\xad\xf5\xfd\xc1\x23\x00\x3d\x56\x91\x72\xdf\xc5\x51\xef\xf1\xda\xf6\x28\x0d" + + "\x8a\xac\xad\xcb\xa7\xf3\x9c\xa2\xdc\x4d\xda\x3d\x82\xe8\x27\xda\x6d\xf5\x14\xe1\xa7\x7e\xa2\x5b\xfe\x9a\x05\x67" + + "\x2b\xe4\x2e\x75\xfe\xea\xb5\x3b\x7b\x23\x80\x7c\x7c\x27\x17\xd8\x6f\xb2\xfe\xe8\x02\xcf\x50\xb7\xe2\xef\xed\x37" + + "\xb1\x1c\x42\x4c\x94\xd4\x63\x29\x3d\x25\x0a\x71\xee\x09\xeb\x11\xda\x7f\x4c\x0e\xab\x1b\x42\x6c\xb7\x31\xe8\xe2" + + "\xf5\xc5\x1f\xd7\x32\x95\xff\xd9\xa0\x48\xb0\xe2\x5a\xd2\x97\xdf\x4f\x0d\xf3\xd3\xf9\x0f\x30\x7b\x49\xfa\x10\xfd" + + "\xff\xbd\xbb\x28\xd2\x27\x54\x55\xdb\x2c\x18\x33\x43\x79\x00\x64\xc3\x28\x75\xe4\x89\xbd\xb6\x9c\x36\xe4\xb4\xcd" + + "\xe1\x1a\xde\x4f\x78\x23\x74\x4e\xfb\xe6\x9f\xa3\xdc\xc9\x83\xf9\x82\xb5\x36\x9b\xf1\x36\xca\x83\x49\x8b\x30\x38" + + "\x73\x17\xff\x3a\xff\xa3\x8a\x9e\xb2\xe0\x52\x33\xfd\x26\x27\x7a\xba\x13\x43\x0c\x1a\xe6\xe9\x6a\x7c\x71\x3e\xce" + + "\x3e\xe8\xd5\x54\x5d\xf4\x27\x00\x00\xff\xff\x9a\x4f\x09\x1d\xad\x05\x00\x00") func bindataTemplatesRdstfMaintfBytes() ([]byte, error) { return bindataRead( @@ -237,10 +239,10 @@ func bindataTemplatesRdstfMaintf() (*asset, error) { info := bindataFileInfo{ name: "templates/rds-tf/main.tf", - size: 1316, + size: 1453, md5checksum: "", mode: os.FileMode(420), - modTime: time.Unix(1582717464, 0), + modTime: time.Unix(1585203322, 0), } a := &asset{bytes: bytes, info: info} diff --git a/rds-tf/deploy.sh b/rds-tf/deploy.sh new file mode 100755 index 0000000..7f17819 --- /dev/null +++ b/rds-tf/deploy.sh @@ -0,0 +1,7 @@ +#!/bin/sh +terraform19 init +terraform19 workspace select spike.np.navi-tech.in || terraform workspace new spike.np.navi-tech.in +terraform19 apply -target=module.rds.data.aws_subnet_ids.command_private_subnets -auto-approve +terraform19 apply -target=module.rds.module.rds_instance -auto-approve +terraform19 apply -target=module.rds.module.rds_instance_events -auto-approve +terraform19 apply -target=module.rds.module.postgres_db -auto-approve diff --git a/rds-tf/main.tf b/rds-tf/main.tf new file mode 100755 index 0000000..c7a9837 --- /dev/null +++ b/rds-tf/main.tf @@ -0,0 +1,25 @@ +terraform { + backend "s3" { + bucket = "navi-bank-terraform-command-state" + region = "ap-south-1" + key = "rds" + workspace_key_prefix = "rds-states/foo-service" + profile = "cmd" + acl = "bucket-owner-full-control" + } +} + +module "rds" { + source = "git::ssh://git@github.cmd.navi-tech.in/navi-infra/rds.git" + environment = "spike" + instance_name = "foo-service" + password = "foo_service_password" + size = 7 + user = "foo_service_user" + + databases = ["foo_service"] + database_tags = { + Team = "Infra" + } + backup_retention_period = 1 +} diff --git a/sample_infra_manifest.json b/sample_infra_manifest.json index 5792bc5..4a3592a 100644 --- a/sample_infra_manifest.json +++ b/sample_infra_manifest.json @@ -1,12 +1,13 @@ { "extraResources": { - "environment": "dev", + "environment": "spike", "database": { - "instanceName": "auth-service", - "user": "auth_service_user", - "password": "auth_service_password", + "instanceName": "foo-service", + "user": "foo_service_user", + "password": "foo_service_password", "sizeInGb": 7, - "dbNames": ["auth_service"] + "dbNames": ["foo_service"], + "backupEnabled": true }, "aws_access": { "policies": [ @@ -26,9 +27,9 @@ } }, "team": { - "name": "LoanOrigination" + "name": "Infra" }, "deployment": { - "name": "auth" + "name": "foo" } } diff --git a/templates/rds-tf/deploy.sh b/templates/rds-tf/deploy.sh index ddfacc9..04df96d 100644 --- a/templates/rds-tf/deploy.sh +++ b/templates/rds-tf/deploy.sh @@ -1,6 +1,7 @@ #!/bin/sh -terraform init -terraform workspace select {{ .ExtraResources.Workspace }} || terraform workspace new {{ .ExtraResources.Workspace }} -terraform apply -target=module.rds.data.aws_subnet_ids.command_private_subnets -auto-approve -terraform apply -target=module.rds.module.rds_instance -auto-approve -terraform apply -target=module.rds.module.postgres_db -auto-approve +terraform19 init +terraform19 workspace select {{ .ExtraResources.Workspace }} || terraform workspace new {{ .ExtraResources.Workspace }} +terraform19 apply -target=module.rds.data.aws_subnet_ids.command_private_subnets -auto-approve +terraform19 apply -target=module.rds.module.rds_instance -auto-approve +terraform19 apply -target=module.rds.module.rds_instance_events -auto-approve +terraform19 apply -target=module.rds.module.postgres_db -auto-approve diff --git a/templates/rds-tf/main.tf b/templates/rds-tf/main.tf index c755ab0..3e8dac6 100644 --- a/templates/rds-tf/main.tf +++ b/templates/rds-tf/main.tf @@ -21,11 +21,17 @@ module "rds" { database_tags = { Team = {{ .Team.Name | quote }} } - + {{- if .ExtraResources.Database.AwsInstanceClass }} aws_instance_class = {{ .ExtraResources.Database.AwsInstanceClass | quote }} {{- end }} + {{- if .ExtraResources.Database.BackupEnabled }} + backup_retention_period = 7 + {{- else }} + backup_retention_period = 0 + {{- end }} + {{- if .ExtraResources.Database.PsqlFamily }} psql_family = {{ .ExtraResources.Database.PsqlFamily | quote }} {{- end }} diff --git a/types.go b/types.go index 727ccce..fb3e29d 100644 --- a/types.go +++ b/types.go @@ -31,6 +31,7 @@ type Database struct { SizeInGb int `json:"sizeInGb"` DbNames []string `json:"dbNames"` InstanceName string `json:"instanceName"` + BackupEnabled bool `json:"backupEnabled"` } type Team struct { From a77b2fef883bdf0d8c419d382f23df1ffe30229a Mon Sep 17 00:00:00 2001 From: piyush-sinha Date: Thu, 26 Mar 2020 11:48:03 +0530 Subject: [PATCH 2/6] [ch5781] | Piyush | Remove code which was generated --- rds-tf/deploy.sh | 7 ------- rds-tf/main.tf | 25 ------------------------- 2 files changed, 32 deletions(-) delete mode 100755 rds-tf/deploy.sh delete mode 100755 rds-tf/main.tf diff --git a/rds-tf/deploy.sh b/rds-tf/deploy.sh deleted file mode 100755 index 7f17819..0000000 --- a/rds-tf/deploy.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -terraform19 init -terraform19 workspace select spike.np.navi-tech.in || terraform workspace new spike.np.navi-tech.in -terraform19 apply -target=module.rds.data.aws_subnet_ids.command_private_subnets -auto-approve -terraform19 apply -target=module.rds.module.rds_instance -auto-approve -terraform19 apply -target=module.rds.module.rds_instance_events -auto-approve -terraform19 apply -target=module.rds.module.postgres_db -auto-approve diff --git a/rds-tf/main.tf b/rds-tf/main.tf deleted file mode 100755 index c7a9837..0000000 --- a/rds-tf/main.tf +++ /dev/null @@ -1,25 +0,0 @@ -terraform { - backend "s3" { - bucket = "navi-bank-terraform-command-state" - region = "ap-south-1" - key = "rds" - workspace_key_prefix = "rds-states/foo-service" - profile = "cmd" - acl = "bucket-owner-full-control" - } -} - -module "rds" { - source = "git::ssh://git@github.cmd.navi-tech.in/navi-infra/rds.git" - environment = "spike" - instance_name = "foo-service" - password = "foo_service_password" - size = 7 - user = "foo_service_user" - - databases = ["foo_service"] - database_tags = { - Team = "Infra" - } - backup_retention_period = 1 -} From 7def2586525b76a8cb115a9445c95d05b40e3d71 Mon Sep 17 00:00:00 2001 From: piyush-sinha Date: Thu, 26 Mar 2020 11:49:17 +0530 Subject: [PATCH 3/6] [ch5781] | Piyush | Fix deploy script --- templates/rds-tf/deploy.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/templates/rds-tf/deploy.sh b/templates/rds-tf/deploy.sh index 04df96d..431e01c 100644 --- a/templates/rds-tf/deploy.sh +++ b/templates/rds-tf/deploy.sh @@ -1,7 +1,7 @@ #!/bin/sh -terraform19 init -terraform19 workspace select {{ .ExtraResources.Workspace }} || terraform workspace new {{ .ExtraResources.Workspace }} -terraform19 apply -target=module.rds.data.aws_subnet_ids.command_private_subnets -auto-approve -terraform19 apply -target=module.rds.module.rds_instance -auto-approve -terraform19 apply -target=module.rds.module.rds_instance_events -auto-approve -terraform19 apply -target=module.rds.module.postgres_db -auto-approve +terraform init +terraform workspace select {{ .ExtraResources.Workspace }} || terraform workspace new {{ .ExtraResources.Workspace }} +terraform apply -target=module.rds.data.aws_subnet_ids.command_private_subnets -auto-approve +terraform apply -target=module.rds.module.rds_instance -auto-approve +terraform apply -target=module.rds.module.rds_instance_events -auto-approve +terraform apply -target=module.rds.module.postgres_db -auto-approve From 1ab0eff863fea76e53c863864edefdc2e0d9ea70 Mon Sep 17 00:00:00 2001 From: piyush-sinha Date: Thu, 26 Mar 2020 12:41:15 +0530 Subject: [PATCH 4/6] [ch5781] | Piyush | Change the variable name in manifest --- bindata.go | 61 +++++++++++++++++++------------------- sample_infra_manifest.json | 2 +- templates/rds-tf/main.tf | 6 ++-- types.go | 2 +- 4 files changed, 35 insertions(+), 36 deletions(-) diff --git a/bindata.go b/bindata.go index 34a32fb..bd072e8 100644 --- a/bindata.go +++ b/bindata.go @@ -164,14 +164,13 @@ func bindataTemplatesAwsrolestfMaintf() (*asset, error) { } var _bindataTemplatesRdstfDeploysh = []byte( - "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x8e\x31\x4e\x04\x31\x0c\x45\x7b\x4e\x11\x44\x3d\x59\x51\x52\x50\x72" + - "\x01\x1a\xca\xc8\x93\x7c\x96\x88\x19\x3b\xb2\x9d\x19\xd0\xee\xde\x9d\x06\x2d\x0c\x0d\x48\x6c\x67\xd9\x7e\xef\xff" + - "\x9b\xeb\xdd\x58\x79\x67\x2f\x57\x0e\x55\x7a\x16\x9d\x6f\xef\x42\xe5\xea\x9b\xc5\x2a\xfa\x6a\x8d\x32\x82\x61\x42" + - "\xf6\x70\x38\x84\xf8\xf0\xe6\x4a\x8f\x30\xe9\x9a\x61\xf1\xe9\xfc\x73\x3a\x85\xe3\x31\x9c\xf9\x6f\x34\x63\xfd\x0d" + - "\xdd\xe4\x52\x6b\xd3\x7b\x18\x9c\x74\x0f\xbf\x9f\xa5\xf4\x09\x51\x8b\xc5\x42\x4e\x91\x56\x4b\xd6\x47\x86\xa7\x5a" + - "\x2c\x66\x99\x67\xe2\x92\x9a\xd6\x85\x1c\x9f\x27\x0b\x03\x75\x97\x81\x5a\x53\x59\xf0\x37\xfd\xd7\x98\x2a\x9b\x13" + - "\x67\x5c\x48\x93\xb0\x80\xff\x55\xaa\x89\xf9\x5e\x61\xa9\x8c\x3f\x2c\x1f\x01\x00\x00\xff\xff\x78\xa7\xe0\xdd\xcd" + - "\x01\x00\x00") + "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xac\x8e\x31\x4e\xc4\x40\x0c\x45\x7b\x4e\x61\x44\x9d\xd9\x13\x50\x72\x01" + + "\x1a\xca\x91\x33\xf3\x59\x46\x24\xf6\xc8\x76\x12\xd0\xee\xde\x9d\x06\x41\x84\x90\x40\x82\xce\x96\xfd\xde\xff\x37" + + "\xd7\x87\xb1\xc9\xc1\x9f\xae\x02\x66\xfc\xa8\x36\x53\x93\x16\xbb\x75\x53\x7b\xf6\xce\x05\xe4\x98\x50\x82\x4e\x27" + + "\x4a\x77\x2f\x61\x7c\x0f\xd7\xc5\x0a\x3c\x3d\x7c\xfc\x5c\x2e\x74\x3e\xd3\x77\xb4\x60\xfb\x09\xdd\xa5\x72\xef\xd3" + + "\x2b\x0d\xc1\x76\x44\xdc\xce\x5a\x97\x09\xc9\xaa\xa7\xca\xc1\x89\x37\xcf\xbe\x8c\x82\xc8\xad\x7a\x2a\x3a\xcf\x2c" + + "\x35\x77\x6b\x2b\x07\xde\x4f\x4e\x03\x2f\xa1\x03\xf7\x6e\xba\xe2\x37\xf2\xcf\x31\x37\xf1\x60\x29\xf8\x17\x49\xc6" + + "\x0a\xf9\x43\xa1\xae\x1e\x47\x83\xe7\x3a\x7e\x71\xbc\x05\x00\x00\xff\xff\xb6\x6e\x64\x21\xc1\x01\x00\x00") func bindataTemplatesRdstfDeployshBytes() ([]byte, error) { return bindataRead( @@ -190,10 +189,10 @@ func bindataTemplatesRdstfDeploysh() (*asset, error) { info := bindataFileInfo{ name: "templates/rds-tf/deploy.sh", - size: 461, + size: 449, md5checksum: "", mode: os.FileMode(420), - modTime: time.Unix(1585173441, 0), + modTime: time.Unix(1585203532, 0), } a := &asset{bytes: bytes, info: info} @@ -202,25 +201,25 @@ func bindataTemplatesRdstfDeploysh() (*asset, error) { } var _bindataTemplatesRdstfMaintf = []byte( - "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x93\x4f\x6f\xda\x40\x10\xc5\xef\xfe\x14\x23\xee\x36\xad\x7a\xa8\x14" + - "\x29\x52\xff\x84\x56\xe9\xa1\x8a\xda\xb4\x57\x6b\xbc\x1e\x9b\x95\xd7\xb3\xce\xce\x1a\x42\x88\xbf\x7b\x65\xaf\x9d" + - "\x82\x20\x40\x55\x9f\x60\xfc\xde\x6f\xde\x3e\x16\x4f\xce\x61\x61\x5d\x0d\xdb\x08\x20\x43\x55\x11\xe7\x30\x93\x77" + - "\xb3\x61\x00\x90\xb5\xaa\x22\x0f\xfb\xcf\x35\xcc\x18\x57\x3a\xce\x90\xab\xf8\x05\x11\x2b\x5b\xd7\xc8\x79\x2c\x1e" + - "\x3d\xcd\x06\xbb\xa3\x52\x5b\x3e\xb4\x63\x13\x8b\x6d\xfd\x32\x7e\x1b\x74\x15\x6d\xe0\xe0\xb9\x86\x99\xcb\x25\x08" + - "\xd6\xd6\x55\xd2\xa0\xa2\xb4\xa2\x4d\xda\x38\x2a\xf4\xe3\x28\x08\xfb\x64\xbe\xdd\x42\xb2\x78\xf4\x0e\x7f\x90\xd8" + - "\xd6\x29\x92\xe4\x06\x3d\x66\x28\x94\xdc\xb2\x78\x64\x45\xdf\xb1\x26\xe8\xba\xc0\x6c\x9c\x2d\xb4\xa1\x83\xa5\xaa" + - "\xce\x83\x00\x95\x39\x9a\x2a\x94\x12\xdb\x35\x93\x8b\x8b\xd6\x98\x58\x59\xf6\xce\x9a\xde\xd6\x45\x5d\x14\xd5\x36" + - "\x6f\x0d\x85\xfc\x43\x93\x21\xd1\x0e\xa3\xd4\xfe\xea\x4a\x64\x79\x35\x9f\x97\xda\x7f\x28\xb5\x5f\xb6\x59\xa2\xea" + - "\x3c\x19\xaa\xf5\xa4\x96\x89\xe6\xf9\xf0\x45\x73\xe1\x70\xee\x72\x49\x4a\xed\xfb\x1d\xc4\x2b\xed\x2c\xd7\xc4\x7e" + - "\xa0\x1d\x39\xfa\x62\x47\xf2\x0c\x0f\xad\xf5\xfd\xc1\x23\x00\x3d\x56\x91\x72\xdf\xc5\x51\xef\xf1\xda\xf6\x28\x0d" + - "\x8a\xac\xad\xcb\xa7\xf3\x9c\xa2\xdc\x4d\xda\x3d\x82\xe8\x27\xda\x6d\xf5\x14\xe1\xa7\x7e\xa2\x5b\xfe\x9a\x05\x67" + - "\x2b\xe4\x2e\x75\xfe\xea\xb5\x3b\x7b\x23\x80\x7c\x7c\x27\x17\xd8\x6f\xb2\xfe\xe8\x02\xcf\x50\xb7\xe2\xef\xed\x37" + - "\xb1\x1c\x42\x4c\x94\xd4\x63\x29\x3d\x25\x0a\x71\xee\x09\xeb\x11\xda\x7f\x4c\x0e\xab\x1b\x42\x6c\xb7\x31\xe8\xe2" + - "\xf5\xc5\x1f\xd7\x32\x95\xff\xd9\xa0\x48\xb0\xe2\x5a\xd2\x97\xdf\x4f\x0d\xf3\xd3\xf9\x0f\x30\x7b\x49\xfa\x10\xfd" + - "\xff\xbd\xbb\x28\xd2\x27\x54\x55\xdb\x2c\x18\x33\x43\x79\x00\x64\xc3\x28\x75\xe4\x89\xbd\xb6\x9c\x36\xe4\xb4\xcd" + - "\xe1\x1a\xde\x4f\x78\x23\x74\x4e\xfb\xe6\x9f\xa3\xdc\xc9\x83\xf9\x82\xb5\x36\x9b\xf1\x36\xca\x83\x49\x8b\x30\x38" + - "\x73\x17\xff\x3a\xff\xa3\x8a\x9e\xb2\xe0\x52\x33\xfd\x26\x27\x7a\xba\x13\x43\x0c\x1a\xe6\xe9\x6a\x7c\x71\x3e\xce" + - "\x3e\xe8\xd5\x54\x5d\xf4\x27\x00\x00\xff\xff\x9a\x4f\x09\x1d\xad\x05\x00\x00") + "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x93\x4f\x8f\xda\x30\x10\xc5\xef\xf9\x14\x23\xee\x09\xad\x7a\xa8\x84" + + "\x84\xd4\x3f\xd0\x6a\x7b\xa8\x56\xed\xb6\xd7\x68\xe2\x4c\x82\x15\xc7\x0e\x1e\x07\x96\x65\xf3\xdd\xab\xd8\xc9\x16" + + "\x04\x0b\x54\xcd\x09\x26\xef\xfd\xe6\xf9\x61\x1c\x59\x8b\x85\xb1\x35\xec\x23\x80\x0c\x45\x45\x3a\x87\x09\xbf\x9b" + + "\xf8\x01\x40\xd6\x8a\x8a\x1c\x1c\x3f\x73\x98\x68\xdc\xc8\x38\x43\x5d\xc5\x2f\x88\x58\x98\xba\x46\x9d\xc7\xec\xd0" + + "\xd1\xc4\xdb\x2d\x95\xd2\xe8\x53\x3b\x36\x31\x9b\xd6\xad\xe2\xb7\x41\x57\xd1\x0e\x4e\x9e\x39\x4c\x6c\xce\x41\xb0" + + "\x35\xb6\xe2\x06\x05\xa5\x15\xed\xd2\xc6\x52\x21\x1f\x07\x41\xd8\xc7\xd3\xfd\x1e\x92\xe5\xa3\xb3\xf8\x83\xd8\xb4" + + "\x56\x10\x27\x0b\x74\x98\x21\x53\x72\xa7\xd9\xa1\x16\xf4\x1d\x6b\x82\xae\x0b\xcc\xc6\x9a\x42\x2a\x3a\x59\x2a\xea" + + "\x3c\x08\x50\xa8\xb3\xa9\x42\x29\xb1\xd9\x6a\xb2\x71\xd1\x2a\x15\x0b\xa3\x9d\x35\xaa\xb7\x75\x51\x17\x45\xb5\xc9" + + "\x5b\x45\x21\xbf\x6f\x32\x24\x3a\x60\x94\xd2\xcd\x66\xcc\xab\xd9\x74\x5a\x4a\xf7\xa1\x94\x6e\xd5\x66\x89\xa8\xf3" + + "\xc4\x57\xeb\x48\xac\x12\xa9\xa7\xfe\x8b\xd4\x85\xc5\xa9\xcd\x39\x29\xa5\xeb\x77\x90\xde\x48\x6b\x74\x4d\xda\x79" + + "\xda\x99\xa3\x2f\x0f\x24\xcf\xb0\x6e\x8d\xeb\x0f\x1e\x01\xc8\xa1\x8a\x54\xf7\x5d\x9c\xf5\x9e\xaf\xed\x88\xd2\x20" + + "\xf3\xd6\xd8\x7c\x3c\xcf\x25\xca\xfd\xa8\x3d\x22\xb0\x7c\xa2\xc3\x56\x2f\x11\x7e\xca\x27\xba\xd3\x5f\xb3\xe0\x6c" + + "\x99\xec\xad\xce\x5f\xbd\xf6\x60\x6f\x04\x90\x0f\xef\xf8\x06\xfb\x22\xeb\x8f\xce\xf0\x0c\x75\xcb\xee\xc1\x7c\x63" + + "\xa3\x43\x88\x91\x92\x3a\x2c\xb9\xa7\x44\x21\xce\x03\x61\x3d\x40\xfb\x8f\xc9\x69\x75\x3e\xc4\x7e\x1f\x83\x2c\x5e" + + "\x5f\xfc\x71\xcb\x63\xf9\x9f\x15\x32\x07\x2b\x6e\x39\x7d\xf9\xfd\x84\x9f\x5f\xce\x7f\x82\x39\x4a\xd2\x87\xe8\xff" + + "\xef\xdd\x4d\x91\x3e\xa1\xa8\xda\x66\x21\x19\x33\x45\x79\x20\x64\x7e\x96\x5a\x72\xa4\x9d\x34\x3a\x6d\xc8\x4a\x93" + + "\xc3\x1c\xde\x8c\x7c\xc5\x74\x4d\xfb\xfe\x9f\xb3\xdc\xf3\x5a\x7d\xc1\x5a\xaa\xdd\x70\x1d\x79\xad\xd2\x22\x0c\xae" + + "\x5c\xc6\xbf\xce\xff\xe8\xa2\xa7\x2c\x75\x29\x35\xfd\x26\xcb\x72\xbc\x14\x3e\x06\xf9\x79\xba\x19\x5e\x5c\x8f\x73" + + "\x0c\x7a\x35\x55\x17\xfd\x09\x00\x00\xff\xff\xa2\xe7\x34\x86\xae\x05\x00\x00") func bindataTemplatesRdstfMaintfBytes() ([]byte, error) { return bindataRead( @@ -239,10 +238,10 @@ func bindataTemplatesRdstfMaintf() (*asset, error) { info := bindataFileInfo{ name: "templates/rds-tf/main.tf", - size: 1453, + size: 1454, md5checksum: "", mode: os.FileMode(420), - modTime: time.Unix(1585203322, 0), + modTime: time.Unix(1585205850, 0), } a := &asset{bytes: bytes, info: info} diff --git a/sample_infra_manifest.json b/sample_infra_manifest.json index 4a3592a..cfa3834 100644 --- a/sample_infra_manifest.json +++ b/sample_infra_manifest.json @@ -7,7 +7,7 @@ "password": "foo_service_password", "sizeInGb": 7, "dbNames": ["foo_service"], - "backupEnabled": true + "backupDisabled": true }, "aws_access": { "policies": [ diff --git a/templates/rds-tf/main.tf b/templates/rds-tf/main.tf index 3e8dac6..101fd58 100644 --- a/templates/rds-tf/main.tf +++ b/templates/rds-tf/main.tf @@ -26,10 +26,10 @@ module "rds" { aws_instance_class = {{ .ExtraResources.Database.AwsInstanceClass | quote }} {{- end }} - {{- if .ExtraResources.Database.BackupEnabled }} - backup_retention_period = 7 - {{- else }} + {{- if .ExtraResources.Database.BackupDisabled }} backup_retention_period = 0 + {{- else }} + backup_retention_period = 7 {{- end }} {{- if .ExtraResources.Database.PsqlFamily }} diff --git a/types.go b/types.go index fb3e29d..b00cdff 100644 --- a/types.go +++ b/types.go @@ -31,7 +31,7 @@ type Database struct { SizeInGb int `json:"sizeInGb"` DbNames []string `json:"dbNames"` InstanceName string `json:"instanceName"` - BackupEnabled bool `json:"backupEnabled"` + BackupDisabled bool `json:"backupDisabled"` } type Team struct { From fb4e03de3c35f58ad145a10f2a286af278d9a232 Mon Sep 17 00:00:00 2001 From: piyush-sinha Date: Fri, 27 Mar 2020 00:16:42 +0530 Subject: [PATCH 5/6] [ch5781] | Piyush | Add multi az support for db --- bindata.go | 43 +++++++++++++++++++------------------- sample_infra_manifest.json | 3 +-- templates/rds-tf/main.tf | 4 ++++ types.go | 1 + 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/bindata.go b/bindata.go index bd072e8..f159534 100644 --- a/bindata.go +++ b/bindata.go @@ -201,25 +201,26 @@ func bindataTemplatesRdstfDeploysh() (*asset, error) { } var _bindataTemplatesRdstfMaintf = []byte( - "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x93\x4f\x8f\xda\x30\x10\xc5\xef\xf9\x14\x23\xee\x09\xad\x7a\xa8\x84" + - "\x84\xd4\x3f\xd0\x6a\x7b\xa8\x56\xed\xb6\xd7\x68\xe2\x4c\x82\x15\xc7\x0e\x1e\x07\x96\x65\xf3\xdd\xab\xd8\xc9\x16" + - "\x04\x0b\x54\xcd\x09\x26\xef\xfd\xe6\xf9\x61\x1c\x59\x8b\x85\xb1\x35\xec\x23\x80\x0c\x45\x45\x3a\x87\x09\xbf\x9b" + - "\xf8\x01\x40\xd6\x8a\x8a\x1c\x1c\x3f\x73\x98\x68\xdc\xc8\x38\x43\x5d\xc5\x2f\x88\x58\x98\xba\x46\x9d\xc7\xec\xd0" + - "\xd1\xc4\xdb\x2d\x95\xd2\xe8\x53\x3b\x36\x31\x9b\xd6\xad\xe2\xb7\x41\x57\xd1\x0e\x4e\x9e\x39\x4c\x6c\xce\x41\xb0" + - "\x35\xb6\xe2\x06\x05\xa5\x15\xed\xd2\xc6\x52\x21\x1f\x07\x41\xd8\xc7\xd3\xfd\x1e\x92\xe5\xa3\xb3\xf8\x83\xd8\xb4" + - "\x56\x10\x27\x0b\x74\x98\x21\x53\x72\xa7\xd9\xa1\x16\xf4\x1d\x6b\x82\xae\x0b\xcc\xc6\x9a\x42\x2a\x3a\x59\x2a\xea" + - "\x3c\x08\x50\xa8\xb3\xa9\x42\x29\xb1\xd9\x6a\xb2\x71\xd1\x2a\x15\x0b\xa3\x9d\x35\xaa\xb7\x75\x51\x17\x45\xb5\xc9" + - "\x5b\x45\x21\xbf\x6f\x32\x24\x3a\x60\x94\xd2\xcd\x66\xcc\xab\xd9\x74\x5a\x4a\xf7\xa1\x94\x6e\xd5\x66\x89\xa8\xf3" + - "\xc4\x57\xeb\x48\xac\x12\xa9\xa7\xfe\x8b\xd4\x85\xc5\xa9\xcd\x39\x29\xa5\xeb\x77\x90\xde\x48\x6b\x74\x4d\xda\x79" + - "\xda\x99\xa3\x2f\x0f\x24\xcf\xb0\x6e\x8d\xeb\x0f\x1e\x01\xc8\xa1\x8a\x54\xf7\x5d\x9c\xf5\x9e\xaf\xed\x88\xd2\x20" + - "\xf3\xd6\xd8\x7c\x3c\xcf\x25\xca\xfd\xa8\x3d\x22\xb0\x7c\xa2\xc3\x56\x2f\x11\x7e\xca\x27\xba\xd3\x5f\xb3\xe0\x6c" + - "\x99\xec\xad\xce\x5f\xbd\xf6\x60\x6f\x04\x90\x0f\xef\xf8\x06\xfb\x22\xeb\x8f\xce\xf0\x0c\x75\xcb\xee\xc1\x7c\x63" + - "\xa3\x43\x88\x91\x92\x3a\x2c\xb9\xa7\x44\x21\xce\x03\x61\x3d\x40\xfb\x8f\xc9\x69\x75\x3e\xc4\x7e\x1f\x83\x2c\x5e" + - "\x5f\xfc\x71\xcb\x63\xf9\x9f\x15\x32\x07\x2b\x6e\x39\x7d\xf9\xfd\x84\x9f\x5f\xce\x7f\x82\x39\x4a\xd2\x87\xe8\xff" + - "\xef\xdd\x4d\x91\x3e\xa1\xa8\xda\x66\x21\x19\x33\x45\x79\x20\x64\x7e\x96\x5a\x72\xa4\x9d\x34\x3a\x6d\xc8\x4a\x93" + - "\xc3\x1c\xde\x8c\x7c\xc5\x74\x4d\xfb\xfe\x9f\xb3\xdc\xf3\x5a\x7d\xc1\x5a\xaa\xdd\x70\x1d\x79\xad\xd2\x22\x0c\xae" + - "\x5c\xc6\xbf\xce\xff\xe8\xa2\xa7\x2c\x75\x29\x35\xfd\x26\xcb\x72\xbc\x14\x3e\x06\xf9\x79\xba\x19\x5e\x5c\x8f\x73" + - "\x0c\x7a\x35\x55\x17\xfd\x09\x00\x00\xff\xff\xa2\xe7\x34\x86\xae\x05\x00\x00") + "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x93\xcd\x6e\xdb\x3a\x10\x85\xf7\x7a\x8a\x81\xf7\x92\xef\x45\x17\x05" + + "\x02\x18\x68\xda\xa4\x45\x0a\xb4\x08\xda\xb4\x8b\x6e\x84\x11\x35\x92\x09\xf1\x47\xe1\x90\x71\x12\xc7\xef\x5e\x50" + + "\xb4\x52\x0b\xb6\x13\x17\xe5\xca\x1e\xce\x39\xf3\xcd\x31\xed\xc9\x39\x6c\xac\xd3\xb0\xce\x00\x2a\x14\x1d\x99\x1a" + + "\x66\xfc\x66\x36\x14\x00\xaa\x20\x3a\xf2\x30\x3d\x0b\x98\x19\xbc\x93\x79\x85\xa6\xcb\x9f\x2d\x72\x61\xb5\x46\x53" + + "\xe7\xec\xd1\xd3\x6c\x90\x3b\x6a\xa5\x35\xfb\x72\xec\x73\xb6\xc1\x2f\xf3\xff\x53\x5f\x47\x0f\xb0\x77\x16\x30\x73" + + "\x35\xa7\x86\x95\x75\x1d\xf7\x28\xa8\xec\xe8\xa1\xec\x1d\x35\xf2\x7e\xdb\x90\xe6\xf1\x7c\xbd\x86\xe2\xf2\xde\x3b" + + "\xfc\x46\x6c\x83\x13\xc4\xc5\x05\x7a\xac\x90\xa9\xb8\x32\xec\xd1\x08\xfa\x8a\x9a\x60\xb3\x49\x9e\xbd\xb3\x8d\x54" + + "\xb4\x37\x54\xe8\x3a\x35\xa0\x50\x07\xa9\x52\x28\xb9\x5d\x19\x72\x79\x13\x94\xca\x85\x35\xde\x59\x15\x65\x9b\x6c" + + "\x93\x65\xda\xd6\x41\x51\xe2\x1f\x92\x4c\x44\x3b\x1e\xad\xf4\x67\x67\xcc\xcb\xb3\xf9\xbc\x95\xfe\x5d\x2b\xfd\x32" + + "\x54\x85\xd0\x75\x31\x44\xeb\x49\x2c\x0b\x69\xe6\xc3\x17\x69\x1a\x87\x73\x57\x73\xd1\x4a\x1f\x67\x90\xb9\x93\xce" + + "\x1a\x4d\xc6\x0f\x6e\x07\x56\xbf\xdc\x69\x79\x82\xdb\x60\x7d\x5c\x3c\x03\x90\xdb\x28\x4a\x13\xb3\x38\xa8\x3d\x1c" + + "\xdb\xc4\xa5\x47\xe6\x95\x75\xf5\xb8\xcf\x4b\x2e\xd7\x63\xef\xc4\x81\xe5\x23\xed\xa6\xfa\x92\xc3\x77\xf9\x48\x57" + + "\xe6\x53\x95\x94\x81\xc9\x9d\xaa\xfc\x11\x7b\x77\xe6\x66\x00\xf5\xf6\x8e\x4f\x90\x5f\x54\x71\x75\x86\x27\xd0\x81" + + "\xfd\x8d\xfd\xcc\xd6\x24\x88\xd1\xa5\xf4\xd8\x72\x74\xc9\x12\xce\x0d\xa1\xde\x9a\xc6\x8f\xc5\x7e\x74\x03\xc4\x7a" + + "\x9d\x83\x6c\x8e\x0f\x3e\x5f\xf1\x18\xfe\x07\x85\xcc\x49\x8a\x2b\x2e\x9f\x7f\x3f\x31\xd4\x5f\xe6\xdf\xb3\x99\x90" + + "\x44\x88\xf8\x7f\xdf\x9c\x84\xf4\x1e\x45\x17\xfa\x0b\xc9\x58\x29\xaa\x93\x43\x35\xd4\x4a\x47\x9e\x8c\x97\xd6\x94" + + "\x3d\x39\x69\x6b\x58\xc0\x7f\xa3\xbf\x62\x7a\xad\xf7\xed\x31\x16\x63\xfd\x71\x9e\x2f\x41\x79\x79\xfe\x6b\x0a\xa4" + + "\x63\xb1\xc4\x47\x58\x80\x77\x81\xfe\x7a\xc9\x6b\xbe\x55\x1f\x51\x4b\xf5\xb0\x7d\xe7\x7c\xab\xca\x26\x15\x5e\x79" + + "\xe5\x7f\x94\xff\x10\x72\x74\xb9\x34\xad\x34\xf4\x93\x1c\xcb\xf1\xb5\x0d\x18\x34\xd4\xcb\xbb\xed\xc5\xeb\x38\x53" + + "\xa3\xa3\x54\x9b\xec\x77\x00\x00\x00\xff\xff\x57\xd3\xf8\xf1\x07\x06\x00\x00") func bindataTemplatesRdstfMaintfBytes() ([]byte, error) { return bindataRead( @@ -238,10 +239,10 @@ func bindataTemplatesRdstfMaintf() (*asset, error) { info := bindataFileInfo{ name: "templates/rds-tf/main.tf", - size: 1454, + size: 1543, md5checksum: "", mode: os.FileMode(420), - modTime: time.Unix(1585205850, 0), + modTime: time.Unix(1585216252, 0), } a := &asset{bytes: bytes, info: info} diff --git a/sample_infra_manifest.json b/sample_infra_manifest.json index cfa3834..be5ef76 100644 --- a/sample_infra_manifest.json +++ b/sample_infra_manifest.json @@ -6,8 +6,7 @@ "user": "foo_service_user", "password": "foo_service_password", "sizeInGb": 7, - "dbNames": ["foo_service"], - "backupDisabled": true + "dbNames": ["foo_service"] }, "aws_access": { "policies": [ diff --git a/templates/rds-tf/main.tf b/templates/rds-tf/main.tf index 101fd58..12f4734 100644 --- a/templates/rds-tf/main.tf +++ b/templates/rds-tf/main.tf @@ -32,6 +32,10 @@ module "rds" { backup_retention_period = 7 {{- end }} + {{- if not .ExtraResources.Database.MultiAZDisabled }} + multi_az = true + {{- end }} + {{- if .ExtraResources.Database.PsqlFamily }} psql_family = {{ .ExtraResources.Database.PsqlFamily | quote }} {{- end }} diff --git a/types.go b/types.go index b00cdff..0f9e07a 100644 --- a/types.go +++ b/types.go @@ -32,6 +32,7 @@ type Database struct { DbNames []string `json:"dbNames"` InstanceName string `json:"instanceName"` BackupDisabled bool `json:"backupDisabled"` + MultiAZDisabled bool `json:"multiAZDisabled"` } type Team struct { From 0ff295fc85042fc3b53888084635bfe8c016826d Mon Sep 17 00:00:00 2001 From: Kaushik Chandrashekar Date: Thu, 2 Apr 2020 11:14:34 +0000 Subject: [PATCH 6/6] [ch5081] | Kaushik | Add team name to RDS deployment --- bindata.go | 58 ++++++++++++++++++++-------------------- environment_config.go | 2 +- templates/rds-tf/main.tf | 2 ++ 3 files changed, 32 insertions(+), 30 deletions(-) diff --git a/bindata.go b/bindata.go index f159534..351ae58 100644 --- a/bindata.go +++ b/bindata.go @@ -111,8 +111,8 @@ func bindataTemplatesAwsrolestfDeploysh() (*asset, error) { name: "templates/aws-roles-tf/deploy.sh", size: 374, md5checksum: "", - mode: os.FileMode(420), - modTime: time.Unix(1584392515, 0), + mode: os.FileMode(436), + modTime: time.Unix(1585549780, 0), } a := &asset{bytes: bytes, info: info} @@ -154,8 +154,8 @@ func bindataTemplatesAwsrolestfMaintf() (*asset, error) { name: "templates/aws-roles-tf/main.tf", size: 735, md5checksum: "", - mode: os.FileMode(420), - modTime: time.Unix(1582736085, 0), + mode: os.FileMode(436), + modTime: time.Unix(1585549780, 0), } a := &asset{bytes: bytes, info: info} @@ -191,8 +191,8 @@ func bindataTemplatesRdstfDeploysh() (*asset, error) { name: "templates/rds-tf/deploy.sh", size: 449, md5checksum: "", - mode: os.FileMode(420), - modTime: time.Unix(1585203532, 0), + mode: os.FileMode(436), + modTime: time.Unix(1585715612, 0), } a := &asset{bytes: bytes, info: info} @@ -201,26 +201,26 @@ func bindataTemplatesRdstfDeploysh() (*asset, error) { } var _bindataTemplatesRdstfMaintf = []byte( - "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x93\xcd\x6e\xdb\x3a\x10\x85\xf7\x7a\x8a\x81\xf7\x92\xef\x45\x17\x05" + - "\x02\x18\x68\xda\xa4\x45\x0a\xb4\x08\xda\xb4\x8b\x6e\x84\x11\x35\x92\x09\xf1\x47\xe1\x90\x71\x12\xc7\xef\x5e\x50" + - "\xb4\x52\x0b\xb6\x13\x17\xe5\xca\x1e\xce\x39\xf3\xcd\x31\xed\xc9\x39\x6c\xac\xd3\xb0\xce\x00\x2a\x14\x1d\x99\x1a" + - "\x66\xfc\x66\x36\x14\x00\xaa\x20\x3a\xf2\x30\x3d\x0b\x98\x19\xbc\x93\x79\x85\xa6\xcb\x9f\x2d\x72\x61\xb5\x46\x53" + - "\xe7\xec\xd1\xd3\x6c\x90\x3b\x6a\xa5\x35\xfb\x72\xec\x73\xb6\xc1\x2f\xf3\xff\x53\x5f\x47\x0f\xb0\x77\x16\x30\x73" + - "\x35\xa7\x86\x95\x75\x1d\xf7\x28\xa8\xec\xe8\xa1\xec\x1d\x35\xf2\x7e\xdb\x90\xe6\xf1\x7c\xbd\x86\xe2\xf2\xde\x3b" + - "\xfc\x46\x6c\x83\x13\xc4\xc5\x05\x7a\xac\x90\xa9\xb8\x32\xec\xd1\x08\xfa\x8a\x9a\x60\xb3\x49\x9e\xbd\xb3\x8d\x54" + - "\xb4\x37\x54\xe8\x3a\x35\xa0\x50\x07\xa9\x52\x28\xb9\x5d\x19\x72\x79\x13\x94\xca\x85\x35\xde\x59\x15\x65\x9b\x6c" + - "\x93\x65\xda\xd6\x41\x51\xe2\x1f\x92\x4c\x44\x3b\x1e\xad\xf4\x67\x67\xcc\xcb\xb3\xf9\xbc\x95\xfe\x5d\x2b\xfd\x32" + - "\x54\x85\xd0\x75\x31\x44\xeb\x49\x2c\x0b\x69\xe6\xc3\x17\x69\x1a\x87\x73\x57\x73\xd1\x4a\x1f\x67\x90\xb9\x93\xce" + - "\x1a\x4d\xc6\x0f\x6e\x07\x56\xbf\xdc\x69\x79\x82\xdb\x60\x7d\x5c\x3c\x03\x90\xdb\x28\x4a\x13\xb3\x38\xa8\x3d\x1c" + - "\xdb\xc4\xa5\x47\xe6\x95\x75\xf5\xb8\xcf\x4b\x2e\xd7\x63\xef\xc4\x81\xe5\x23\xed\xa6\xfa\x92\xc3\x77\xf9\x48\x57" + - "\xe6\x53\x95\x94\x81\xc9\x9d\xaa\xfc\x11\x7b\x77\xe6\x66\x00\xf5\xf6\x8e\x4f\x90\x5f\x54\x71\x75\x86\x27\xd0\x81" + - "\xfd\x8d\xfd\xcc\xd6\x24\x88\xd1\xa5\xf4\xd8\x72\x74\xc9\x12\xce\x0d\xa1\xde\x9a\xc6\x8f\xc5\x7e\x74\x03\xc4\x7a" + - "\x9d\x83\x6c\x8e\x0f\x3e\x5f\xf1\x18\xfe\x07\x85\xcc\x49\x8a\x2b\x2e\x9f\x7f\x3f\x31\xd4\x5f\xe6\xdf\xb3\x99\x90" + - "\x44\x88\xf8\x7f\xdf\x9c\x84\xf4\x1e\x45\x17\xfa\x0b\xc9\x58\x29\xaa\x93\x43\x35\xd4\x4a\x47\x9e\x8c\x97\xd6\x94" + - "\x3d\x39\x69\x6b\x58\xc0\x7f\xa3\xbf\x62\x7a\xad\xf7\xed\x31\x16\x63\xfd\x71\x9e\x2f\x41\x79\x79\xfe\x6b\x0a\xa4" + - "\x63\xb1\xc4\x47\x58\x80\x77\x81\xfe\x7a\xc9\x6b\xbe\x55\x1f\x51\x4b\xf5\xb0\x7d\xe7\x7c\xab\xca\x26\x15\x5e\x79" + - "\xe5\x7f\x94\xff\x10\x72\x74\xb9\x34\xad\x34\xf4\x93\x1c\xcb\xf1\xb5\x0d\x18\x34\xd4\xcb\xbb\xed\xc5\xeb\x38\x53" + - "\xa3\xa3\x54\x9b\xec\x77\x00\x00\x00\xff\xff\x57\xd3\xf8\xf1\x07\x06\x00\x00") + "\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\x94\x41\x6f\xd3\x4e\x10\xc5\xef\xfe\x14\xa3\xdc\xed\xfc\xff\xe2\x80" + + "\x54\x29\x12\x85\x16\x54\x24\x50\x05\x85\x03\x17\x6b\xbc\x1e\x3b\x2b\xaf\x77\xdd\x9d\xd9\xa6\x6d\x9a\xef\x8e\xd6" + + "\x9b\x94\x44\x49\x9a\x22\x7c\x4a\xc6\xef\xfd\xf6\xcd\x73\x1c\x21\xef\xb1\x71\xbe\x87\x65\x06\x50\xa1\xea\xc8\xd6" + + "\x30\xe1\x37\x93\x71\x00\x50\x05\xd5\x91\xc0\xee\x35\x83\x89\xc5\x3b\x9d\x57\x68\xbb\xfc\x19\x91\x2b\xd7\xf7\x68" + + "\xeb\x9c\x05\x85\x26\xa3\xdd\x53\xab\x9d\xdd\xb7\xe3\x90\xb3\x0b\x32\xcf\xff\x4f\xba\x8e\x1e\x60\xef\x9a\xc1\xc4" + + "\xd7\x9c\x04\x0b\xe7\x3b\x1e\x50\x51\xd9\xd1\x43\x39\x78\x6a\xf4\xfd\x5a\x90\xce\xe3\xe9\x72\x09\xc5\xe5\xbd\x78" + + "\xfc\x46\xec\x82\x57\xc4\xc5\x05\x0a\x56\xc8\x54\x5c\x59\x16\xb4\x8a\xbe\x62\x4f\xb0\x5a\x25\xe6\xe0\x5d\xa3\x0d" + + "\xed\x1d\xaa\xfa\x3a\x09\x50\x99\x83\xa9\x52\x29\xb9\x5b\x58\xf2\x79\x13\x8c\xc9\x95\xb3\xe2\x9d\x89\xb6\x55\xb6" + + "\xca\xb2\xde\xd5\xc1\x50\xca\x3f\x36\x99\x12\x6d\x31\x5a\x2d\x67\x67\xcc\xf3\xb3\xe9\xb4\xd5\xf2\xae\xd5\x32\x0f" + + "\x55\xa1\xfa\xba\x18\xab\x15\x52\xf3\x42\xdb\xe9\xf8\x45\xdb\xc6\xe3\xd4\xd7\x5c\xb4\x5a\xe2\x19\x64\xef\xb4\x77" + + "\xb6\x27\x2b\x23\xed\xc0\xea\x97\x5b\x92\x27\xb8\x0d\x4e\xe2\xe2\x19\x80\x5e\x57\x51\xda\xd8\xc5\x41\xef\xe1\xda" + + "\x76\x28\x03\x32\x2f\x9c\xaf\x37\xfb\xbc\x44\xb9\xde\x68\x77\x08\xac\x1f\x69\xbb\xd5\x97\x08\xdf\xf5\x23\x5d\xd9" + + "\x4f\x55\x72\x06\x26\xff\x5a\xe7\x8f\xa8\xdd\x3a\x37\x03\xa8\xd7\xf7\xf8\x15\xf6\x8b\x2a\xae\xce\xf0\x04\x7d\x60" + + "\xb9\x71\x9f\xd9\xd9\x14\x62\x43\x29\x05\x5b\x8e\x94\x2c\xc5\xb9\x21\xec\xd7\xd0\xf8\xb1\xd8\xaf\x6e\x0c\x21\x27" + + "\x64\x19\xc0\x72\x99\x83\x6e\x8e\x67\x3b\x5f\xf0\xe6\xf9\x7c\x30\xc8\x9c\xe8\xb8\xe0\xf2\xf9\x11\xab\x71\xfe\xf2" + + "\x8a\x7b\x98\x9d\xb0\x31\x44\xfc\x4b\x78\x5d\xa4\xf7\xa8\xba\x30\x5c\x68\xc6\xca\x50\x9d\x08\xd5\x38\x2b\x3d\x09" + + "\x59\xd1\xce\x96\x03\x79\xed\x6a\x98\xc1\x7f\x1b\xbe\x61\x3a\xa5\x7d\x7b\x2c\x8b\x75\x72\x3c\xcf\x97\x60\x44\x9f" + + "\xff\xda\x0d\xd4\xc7\x61\x89\x8f\x30\x03\xf1\x81\xfe\x7a\xc9\x6b\xbe\x35\x1f\xb1\xd7\xe6\x61\xfd\x2a\xf0\xad\x29" + + "\x9b\x34\x38\xf1\x22\xfc\x71\xfe\x43\xc9\x91\x72\x69\x5b\x6d\xe9\x27\x79\xd6\x9b\x1f\xe4\x18\x83\xc6\x79\x79\xb7" + + "\xbe\x71\x3a\xce\x2e\xe8\x68\xaa\x55\xf6\x3b\x00\x00\xff\xff\xf1\x7c\xe4\x55\x2a\x06\x00\x00") func bindataTemplatesRdstfMaintfBytes() ([]byte, error) { return bindataRead( @@ -239,10 +239,10 @@ func bindataTemplatesRdstfMaintf() (*asset, error) { info := bindataFileInfo{ name: "templates/rds-tf/main.tf", - size: 1543, + size: 1578, md5checksum: "", - mode: os.FileMode(420), - modTime: time.Unix(1585216252, 0), + mode: os.FileMode(436), + modTime: time.Unix(1585825744, 0), } a := &asset{bytes: bytes, info: info} diff --git a/environment_config.go b/environment_config.go index 465aba7..724731b 100644 --- a/environment_config.go +++ b/environment_config.go @@ -14,7 +14,7 @@ var storageBackendBucketMap = map[string]string{ "cmd": "navi-bank-terraform-command-state", "dev": "navi-bank-terraform-nonprod-state", "qa": "navi-bank-terraform-nonprod-state", - "automation": "navi-bank-terraform-nonprod-state", + "automation": "navi-bank-terraform-nonprod-state", "spike": "navi-bank-terraform-nonprod-state", } diff --git a/templates/rds-tf/main.tf b/templates/rds-tf/main.tf index 12f4734..683c5ee 100644 --- a/templates/rds-tf/main.tf +++ b/templates/rds-tf/main.tf @@ -22,6 +22,8 @@ module "rds" { Team = {{ .Team.Name | quote }} } + team = {{ .Team.Name | quote }} + {{- if .ExtraResources.Database.AwsInstanceClass }} aws_instance_class = {{ .ExtraResources.Database.AwsInstanceClass | quote }} {{- end }}