jckuester / awsweeper

A tool for cleaning your AWS account
Mozilla Public License 2.0
480 stars 46 forks source link

Docker Image Problems with 0.11.1 #124

Open ekristen opened 3 years ago

ekristen commented 3 years ago

Attempting to build a docker image that contains this tool, however looks like 0.11.1 with the updated terraform provider runs into errors not being able to download the terraform provider even though there are no problems with the network.

failed to install provider (aws): registry service is unreachable

If the terraform provider is downloaded manually the following error occurs ...

failed to install provider (aws): open /root/.awsweeper/terraform-provider-aws_v3.16.0_x5: text file busy
Error: failed to launch provider (): fork/exec : no such file or directory

If I run 0.11.0 instead, everything works as expected.

ekristen commented 3 years ago

Scratch that, can't get it to work with 0.11.0, I end up getting the following error even with the provider pre-downloaded

failed to install provider (aws): registry service is unreachable, check https://status.hashicorp.com/ for status updates
Error: failed to launch provider (): fork/exec : no such file or directory
jckuester commented 3 years ago

Hi @ekristen,

thanks for opening this issue.

can't get it to work with 0.11.0

v0.11.0 has a bug of using the wrong Terraform AWS Provider version v2.68.0; that's why I created v0.11.0 as a fix. This means that's awsweeper is not working with your pre-downloaded provider version v3.16.0, as it tries to download v2.68.0.

Using awsweeper v0.11.1 is correct and the error failed to install provider (aws): open /root/.awsweeper/terraform-provider-aws_v3.16.0_x5 is a current bug that I need to fix. It occurs as awsweeper doesn't close the running provider plugin binary properly in some cases so that it keeps running in the background. The current workaround is to kill the process manually with pkill terraform and then run awsweeper again.

TL;DR

Let me know if this helps!

showerlee commented 3 years ago

Hi @jckuester, looks I got this failed to install provider (aws): open /root/.awsweeper/terraform-provider-aws_v3.16.0_x5 intermittently for a few aws regions since I make a loop to perform the awsweeper v0.11.1 to each of specific regions in my Dockerfile.

for region in ${SWEEP_REGION[@]}
do
    echo ">>> Start sweeping in $region  <<<" 2>&1 | tee -a ${AWSWEEPER_LOG}
    ./bin/awsweeper --region $region ${!ACTION_MODE} ${AWSWEEPER_CFG} 2>&1 | tee -a ${AWSWEEPER_LOG}
    echo ">>> Finished sweeping in $region <<<" 2>&1 | tee -a ${AWSWEEPER_LOG}
done
>>> Start sweeping in ap-east-1  <<<

failed to install provider (aws): open /home/appuser/.awsweeper/terraform-provider-aws_v3.16.0_x5: text file busy
Error: failed to launch provider (): fork/exec : no such file or directory

>>> Finished sweeping in ap-east-1 <<<
>>> Start sweeping in ap-south-1  <<<

failed to install provider (aws): open /home/appuser/.awsweeper/terraform-provider-aws_v3.16.0_x5: text file busy
Error: failed to launch provider (): fork/exec : no such file or directory

>>> Finished sweeping in ap-south-1 <<<
...

Use pkill terraform would break the loop with exit 1, not sure if any alternative would fit my parttern.

Hope it gets fixed soon in the next release

Thanks in advance.