-
Notifications
You must be signed in to change notification settings - Fork 9.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
S3 bucket force_destroy error: MalformedXML #4168
Conversation
AWS provider was not checking whether DeleteMarkers are left in S3 bucket causing s3.DeleteObjectsInput to send empty XML which resulted in 400 error and MalformedXML message.
Add a pipeline to destroy environments. It currently consists of 2 jobs - one to destroy VPC which then triggers a job to destroy S3 bucket. We used default/recommended pipeline/task/script distribution with this pipeline. We include taks from file, because this task repeats. Never- theless, in this case, the pipeline needs to contain quite chunky config definitions (params), because they can't be included in the task itself, due to fly only expanding params in the pipeline. In comparison with deploy pipeline, we don't use terraform's ability to pull remote state file, due to bug encountered with `bucket.tfstate`: hashicorp/terraform#4154 The remote state file worked with VPC, but we wanted to unify both tasks on same code to demonstrate default concourse pipeline file organization. We also use fake/dummy `trigger-bucket-destroy` resource here to trigger bucket destroy job after vpc destroy job. The terraform bucket destroy job currently doesnt't work, due to bugs: hashicorp/terraform#3981 and missing functionality - the old file versions are actually not removed. @combor has risen PR to add this functionality here: hashicorp/terraform#4168
Due to bug in Terraform ( hashicorp/terraform#4168 ) we have to use our patched fork to be able to delete S3 buckets. Also, we need to reduce size of this contaier so it is using Alipne linux now instead Ubuntu.
Checks out, thanks! |
whoops, didn't mean to close.. |
S3 bucket force_destroy error: MalformedXML
Just curious, is there maybe an ETA for the next release containing this fix? Thanks! And happy new year! |
Sorry @aviflax , we don't give ETAs really. I can say that we had meant to release before the holidays but hid a blocker, so we had to delay. I expect a release soon, hopefully this week 😄 |
Thanks, no worries! Happy new year!
|
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
While doing forced destroy and if versioning is enabled for a bucket, AWS provider is not checking whether DeleteMarkers and versions of objects are left resulting in following error:
s3conn.ListObjects
is checking only wheter there are objects (not versions) in the bucket causings3.DeleteObjects
to send empty XML which results in 400 error and MalformedXML message.In this PR I'm using
ListObjectVersions
to get Versions and DeleteMarkers slice and createobjectsToDelete
slice that is passed tos3conn.DeleteObjects
After this change AWS provider is able to delete all versions and delete markers for versioned S3 bucket and finally properly delete versioned bucket.