cloud-automation icon indicating copy to clipboard operation
cloud-automation copied to clipboard

Terraform is not cleaning all the AWS resources

Open grugna opened this issue 5 years ago • 1 comments

In the gen3 workon cdistest commons-test when you execute gen3 tfplan --destroy and gen3 tfapply some services are not freed/destroyed.

These are not removed:

- aws_db_instance.db_fence

  - aws_db_instance.db_gdcapi

  - aws_db_instance.db_indexd

  - aws_db_parameter_group.rds-cdis-pg

  - aws_db_subnet_group.private_group

  - aws_s3_bucket.kube_bucket

  - aws_subnet.private_db_alt

  - aws_subnet.private_kube

  - module.cdis_vpc.aws_security_group.local

  - module.cdis_vpc.aws_vpc.main

  - module.cdis_vpc.module.data-bucket.aws_s3_bucket.log_bucket

and the reasons are here:

5 errors occurred:


* module.cdis_vpc.module.data-bucket.aws_s3_bucket.log_bucket (destroy): 1 error occurred:
* aws_s3_bucket.log_bucket: error deleting S3 Bucket (commons-test-data-bucket-logs): BucketNotEmpty: The bucket you tried to delete is not empty
status code: 409, request id: 83F06481B95A68B1, host id: JGIfvY2mbLC25esL0vMCy5+OmUTzmkB5oG4ZCovifp9gxkx9Bq/mzFtYN2i6v45rbM04WuJawMQ=

* aws_s3_bucket.kube_bucket (destroy): 1 error occurred:
* aws_s3_bucket.kube_bucket: error deleting S3 Bucket (kube-commons-test-gen3): BucketNotEmpty: The bucket you tried to delete is not empty
status code: 409, request id: 9187CC392FF6CB6D, host id: peyg0PyEdbexbWXkidUltZRoQnxvfN/TGe/Qtw4XSfncRuoahyBkh+OCPfPxKMMAQ4bzsPUHIis=

* aws_db_instance.db_fence (destroy): 1 error occurred:
* aws_db_instance.db_fence: error deleting Database Instance "commons-test-fencedb": DBSnapshotAlreadyExists: Cannot create the snapshot because a snapshot with the identifier commons-test-fencedb already exists.
status code: 400, request id: 61e8ba17-4b49-434e-a134-545b28087aae

* aws_db_instance.db_gdcapi (destroy): 1 error occurred:
* aws_db_instance.db_gdcapi: error deleting Database Instance "commons-test-gdcapidb": DBSnapshotAlreadyExists: Cannot create the snapshot because a snapshot with the identifier commons-test-gdcapidb already exists.
status code: 400, request id: 16bb5d56-a157-4060-9575-3bb0e6825d75

* aws_db_instance.db_indexd (destroy): 1 error occurred:
* aws_db_instance.db_indexd: error deleting Database Instance "commons-test-indexddb": DBSnapshotAlreadyExists: Cannot create the snapshot because a snapshot with the identifier commons-test-indexddb already exists.
status code: 400, request id: 4f80adf2-9d93-4dfe-8a42-c562b0ce98b8

grugna avatar Jul 11 '19 19:07 grugna