INFRA-2562 | Ankit Bhardwaj | fix terraform destroy issue

This commit is contained in:
Ankit Bhardwaj
2023-12-07 22:49:00 +05:30
parent b5a76f86af
commit cb238c83b4
5 changed files with 233 additions and 359 deletions

File diff suppressed because one or more lines are too long

1
go.mod
View File

@@ -14,5 +14,6 @@ require (
require (
github.com/huandu/xstrings v1.2.1 // indirect
github.com/imdario/mergo v0.3.8 // indirect
github.com/shuLhan/go-bindata v4.0.0+incompatible // indirect
golang.org/x/crypto v0.1.0 // indirect
)

2
go.sum
View File

@@ -39,6 +39,8 @@ github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
github.com/shuLhan/go-bindata v4.0.0+incompatible h1:xD8LkuVZLV5OOn/IEuFdt6EEAW7deWiqgwaaSGhjAJc=
github.com/shuLhan/go-bindata v4.0.0+incompatible/go.mod h1:pkcPAATLBDD2+SpAPnX5vEM90F7fcwHCvvLCMXcmw3g=
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8=

View File

@@ -21,7 +21,7 @@ terraform15 $terraform_action -target=module.rds.module.rds_aurora_instance -tar
terraform_action=destroy
terraform15 $terraform_action -target=module.rds.module.rds_aurora_instance $additional_terraform_options
terraform15 $terraform_action -target=module.rds.data.aws_subnet_ids.command_private_subnets $additional_terraform_options
terraform15 state rm $(terraform15 state list | grep 'module.rds.module.postgres_db')
terraform15 state list | grep 'module.rds.module.postgres_db' && terraform15 state rm $(terraform15 state list | grep 'module.rds.module.postgres_db')
{{- end }}
{{- if .Actions.Apply }}
terraform_action=apply

View File

@@ -49,7 +49,7 @@ state_migration
terraform_action=destroy
terraform $terraform_action -target=module.rds.module.rds_instance -target=module.rds.module.rds_instance_replica $additional_terraform_options
terraform $terraform_action -target=module.rds.data.aws_subnet_ids.command_private_subnets -target=module.rds.data.aws_subnets.command_private_subnets $additional_terraform_options
terraform state rm $(terraform state list | grep 'module.rds.module.postgres_db')
terraform state list | grep 'module.rds.module.postgres_db' && terraform state rm $(terraform state list | grep 'module.rds.module.postgres_db')
{{- else }}
terraform_action=apply
terraform $terraform_action -target=module.rds.data.aws_subnet_ids.command_private_subnets -target=module.rds.data.aws_subnets.command_private_subnets $additional_terraform_options