Skip to content
This repository was archived by the owner on Feb 11, 2022. It is now read-only.
This repository was archived by the owner on Feb 11, 2022. It is now read-only.

config.rb:574:in read_aws_files': undefined method []' #521

@iam-decoder

Description

@iam-decoder

looks like the problem is when using aws_profile in the Vagrantfile. when setting up aws configure, mine did not come out as profile nonprod but rather just nonprod so I'm forced to put my Access Key & Access Key ID instead which I can't do for security reasons.

rather than making new aws configs just so this plugin works, I think this section should be changed

# determine section in config ini file
if profile == 'default'
  ini_profile = profile
else
  ini_profile = 'profile ' + profile
end
# get info from config ini file for selected profile
data = File.read(aws_config)
doc_cfg = IniParse.parse(data)

possibly to:

# get info from config ini file for selected profile
data = File.read(aws_config)
doc_cfg = IniParse.parse(data)

# determine section in config ini file
if profile == 'default'  || !doc_cfg[profile].nil?
  ini_profile = profile
else
  ini_profile = 'profile ' + profile
end

OR

# determine section in config ini file
if profile == 'default'
  ini_profile = profile
else
  ini_profile = 'profile ' + profile
end
# get info from config ini file for selected profile
data = File.read(aws_config)
doc_cfg = IniParse.parse(data)
aws_region = doc_cfg[ini_profile]['region']

# determine section in credentials ini file
ini_profile = profile
# get info from credentials ini file for selected profile
data = File.read(aws_creds)
doc_cfg = IniParse.parse(data)
aws_id = doc_cfg[ini_profile]['aws_access_key_id']
aws_secret = doc_cfg[ini_profile]['aws_secret_access_key']
aws_token = doc_cfg[ini_profile]['aws_session_token']

to:

# determine section in credentials ini file
ini_profile = profile
# get info from credentials ini file for selected profile
data = File.read(aws_creds)
doc_cfg = IniParse.parse(data)
aws_region = doc_cfg[ini_profile]['region']
aws_id = doc_cfg[ini_profile]['aws_access_key_id']
aws_secret = doc_cfg[ini_profile]['aws_secret_access_key']
aws_token = doc_cfg[ini_profile]['aws_session_token']

not sure which would work better, but both fix my issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions