Open LiranV opened 12 months ago
Hi @int128 . I ran into this too. Could you merge this PR to fix this please? Thanks.
Edit: actually, it doesn't fix the original problem https://github.com/int128/terraform-aws-nat-instance/issues/57. If interface is not attached for some reason, this change will wait for 3 mins and fail and user will have to handle it using var.user_data_runcmd
.
Adding retries in runonce.sh
is a better solution imo. Created https://github.com/int128/terraform-aws-nat-instance/pull/72 for this.
Inside the
runonce.sh
script there is theaws ec2 attach-network-interface
command, If it fails (in my case when the interface was not yet released after system check failure and instance termination) the script goes on and thensnat.sh
will run.There the
while
loop will hand as eth1 will never be available due to the previous failure.This fix will allow the control flow to continue and reach a user provided script which is given via the
user_data
variable of this module.