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

Handle NoSuchBucket error from AWS on location request. #366

Closed genevieve closed 6 years ago

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 100.0% when pulling ebd46ed14e45c5a2d57c56fc2560dcccc4bdb1d6 on genevievelesperance:location-of-no-such-bucket into f4e30400ae61381077b6c78b00b02ddc4642a331 on dtan4:master.

dtan4 commented 6 years ago

Sorry for late review.

Please let me confirm... is Aws::S3::Errors::NoSuchBucketPolicy really occured in this method? #bucket_location_of is called from retrieved bucket lists, so the bucket should exist.

I checked with the buckets at different regions, and it worked fine.

[12] pry(main)> client.config.region
=> "ap-northeast-1"
[13] pry(main)> client.get_bucket_location(bucket: "BUCKET_IN_AP_NORTHEAST_1")
=> #<struct Aws::S3::Types::GetBucketLocationOutput location_constraint="ap-northeast-1">
[14] pry(main)> client.get_bucket_location(bucket: "BUCKET_IN_US_WEST_2")
=> #<struct Aws::S3::Types::GetBucketLocationOutput location_constraint="us-west-2">

Even if there is a case error occurs, your change is still wrong. Aws::S3::Errors::NoSuchBucket is correct.