cloudtools / cloudtools/stacker

stacker bucket will always be created with default aws profile regardless of -p option

Open
#673 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
707
Forks
162
PR merge metrics
No merged PRs in 30d

Description

[stacker.log](https://github.com/cloudtools/stacker/files/2508933/stacker.log)
Running `stacker build -p dronen1 ./config/environments/prod/us-east-1.env ./config/capabilities/zone/avm/custom_resources.yaml`
Stacker errored out:
` [2018-10-23T23:44:08] Using default AWS provider mode
[2018-10-23T23:44:09] Access denied for bucket stacker-templates-us-east-1-1540336332. Did you remember to use a globally unique name?
Traceback (most recent call last):
File "/Users/dronen/workspace/stacker/stacker/util.py", line 495, in ensure_s3_bucket
s3_client.head_bucket(Bucket=bucket_name)
File "/Users/dronen/workspace/mufg-infrastructure/venv3/lib/python3.6/site-packages/botocore/client.py", line 314, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/Users/dronen/workspace/mufg-infrastructure/venv3/lib/python3.6/site-packages/botocore/client.py", line 612, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (403) when calling the HeadBucket operation: Forbidden
Traceback (most recent call last):
File "/Users/dronen/workspace/mufg-infrastructure/venv3/bin/stacker", line 7, in
exec(compile(f.read(), __file__, 'exec'))
File "/Users/dronen/workspace/stacker/scripts/stacker", line 10, in
args.run(args)
File "/Users/dronen/workspace/stacker/stacker/commands/stacker/build.py", line 58, in run
dump=options.dump)
File "/Users/dronen/workspace/stacker/stacker/actions/base.py", line 199, in execute
self.pre_run(*args, **kwargs)
File "/Users/dronen/workspace/stacker/stacker/actions/build.py", line 396, in pre_run
self.ensure_cfn_bucket()
File "/Users/dronen/workspace/stacker/stacker/actions/base.py", line 159, in ensure_cfn_bucket
self.bucket_region)
File "/Users/dronen/workspace/stacker/stacker/util.py", line 495, in ensure_s3_bucket
s3_client.head_bucket(Bucket=bucket_name)
File "/Users/dronen/workspace/mufg-infrastructure/venv3/lib/python3.6/site-packages/botocore/client.py", line 314, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/Users/dronen/workspace/mufg-infrastructure/venv3/lib/python3.6/site-packages/botocore/client.py", line 612, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (403) when calling the HeadBucket operation: Forbidden`
The problem is in the constructor of `actions.base.BaseAction.__init__()`, the session is built without the profile:
`self.s3_conn = get_session(self.bucket_region).client('s3')`
The profile is not passed to this constructor, so I have no idea how this might be solved other than adding karg to the constructor.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.