Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing deployment_account_id and initial deployment global IAM bootstrap #686

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Makefile.tox
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ all: test lint

test:
# Run unit tests
( \
for config in $(TEST_CONFIGS); do \
pytest $$(dirname $$config) -vvv -s -c $$config; \
done \
@ $(foreach config,$(TEST_CONFIGS), \
pytest $$(dirname $(config)) -vvv -s -c $(config) || exit 1; \
)

lint:
Expand Down
1 change: 1 addition & 0 deletions src/lambda_codebase/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ def create_output_object(self, account_path):
'master_account_id': organization_information.get(
"organization_master_account_id"
),
'deployment_account_id': self.deployment_account_id,
'notification_endpoint': self.main_notification_endpoint,
'notification_type': self.notification_type,
'cross_account_access_role': self.cross_account_access_role,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@ def prepare_deployment_account(sts, deployment_account_id, config):
deployment_account_parameter_store.put_parameter(
'deployment_account_bucket', DEPLOYMENT_ACCOUNT_S3_BUCKET_NAME
)
deployment_account_parameter_store.put_parameter(
'deployment_account_id',
deployment_account_id,
)
deployment_account_parameter_store.put_parameter(
'default_scm_branch',
config.config.get('scm', {}).get(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def test_prepare_deployment_account_defaults(param_store_cls, cls, sts):
)
for param_store in parameter_store_list:
assert param_store.put_parameter.call_count == (
12 if param_store == deploy_param_store else 2
13 if param_store == deploy_param_store else 2
)
param_store.put_parameter.assert_has_calls(
[
Expand All @@ -147,6 +147,7 @@ def test_prepare_deployment_account_defaults(param_store_cls, cls, sts):
call('adf_version', '1.0.0'),
call('adf_log_level', 'CRITICAL'),
call('deployment_account_bucket', 'some_deployment_account_bucket'),
call('deployment_account_id', deployment_account_id),
call('default_scm_branch', 'master'),
call('/adf/org/stage', 'none'),
call('cross_account_access_role', 'some_role'),
Expand Down Expand Up @@ -225,7 +226,7 @@ def test_prepare_deployment_account_specific_config(param_store_cls, cls, sts):
)
for param_store in parameter_store_list:
assert param_store.put_parameter.call_count == (
14 if param_store == deploy_param_store else 2
15 if param_store == deploy_param_store else 2
)
param_store.put_parameter.assert_has_calls(
[
Expand All @@ -239,6 +240,7 @@ def test_prepare_deployment_account_specific_config(param_store_cls, cls, sts):
call('adf_version', '1.0.0'),
call('adf_log_level', 'CRITICAL'),
call('deployment_account_bucket', 'some_deployment_account_bucket'),
call('deployment_account_id', deployment_account_id),
call('default_scm_branch', 'main'),
call('/adf/org/stage', 'test-stage'),
call('auto_create_repositories', 'disabled'),
Expand Down
3 changes: 3 additions & 0 deletions src/lambda_codebase/initial_commit/initial_commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
"bootstrap_repository/adf-bootstrap/example-global-iam.yml": (
"adf-bootstrap/global-iam.yml"
),
"bootstrap_repository/adf-bootstrap/deployment/example-global-iam.yml": (
"adf-bootstrap/deployment/global-iam.yml"
),
"adf.yml.j2": "adf-accounts/adf.yml",
"adfconfig.yml.j2": "adfconfig.yml",
}
Expand Down