dtan4 / terraforming

Export existing AWS resources to Terraform style (tf, tfstate) / No longer actively maintained
http://terraforming.dtan4.net/
MIT License
4.3k stars 658 forks source link

Fixed undefined method 'role_name' when running iamip #451

Open Avolynsk opened 5 years ago

Avolynsk commented 5 years ago

This error appears because sometimes AWS can return to you a list of instance profiles including deleted ones (as I understood this).

So, if an instance profile is actually deleted - it can't be matched with any IAM role and we getting "undefined method 'role_name'" then.

My fix is checking if profile.roles list is empty. If not - well, this profile really exists and we can get an IAM role for it, so we should add it to .tf file.

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.5%) to 99.494% when pulling ce754d06cf3d228c4adb52a57ce087da7590bf65 on Avolynsk:fix-iamip-exception into 1ba96b958123087dc1454e284ce34cc9c00b69a0 on dtan4:master.

coveralls commented 5 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling c13ad6189f5bdb6d6692cc66d69467662581bcb1 on Avolynsk:fix-iamip-exception into 50e09f973ec01ccb0751741eed4d78acb1c3cdb3 on dtan4:master.

Avolynsk commented 5 years ago

Please merge the current master branch, then resolve conflicts

done