dtan4 / terraforming

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

`credentials_set?': undefined method `access_key_id' for nil:NilClass (NoMethodError) #471

Open RanjitRajput opened 5 years ago

RanjitRajput commented 5 years ago

terraforming sg --profile admin

Getting error "credentials_set?': undefined methodaccess_key_id' for nil:NilClass (NoMethodError)" while trying to use terraforming.

My config and credentials files as below -

$ cat .aws/config [default] region = us-east-1

[profile admin] region = us-east-1 role_arn = arn:aws:iam::AccountID:role/admin source_profile = default

[profile readonly] region = us-east-1 role_arn = arn:aws:iam::AccountID:role/readonly source_profile = default

$ cat .aws/credentials [default] aws_access_key_id = Access key aws_secret_access_key = Secret key

The same configuration is working fine in another account where I don't have any profile,only changing access key and secret key.

ruby --version ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]

Tried terraforming sg --profile admin --assume arn:aws:iam::accountID:role/admin but getting same error.

aws cli working fine with these credentials. aws iam list-users --profile admin

Is there any way to fix this ?

fauzan-n commented 4 years ago

me too

djtecha commented 4 years ago

I found if you use what's set in the source_profile part it works