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 clean bootstrap of the deployment account #703

Merged
Merged
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
24 changes: 17 additions & 7 deletions src/lambda_codebase/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,10 @@ def _determine_if_deployment_account(self):
1 if self.destination_ou_name == DEPLOYMENT_ACCOUNT_OU_NAME
else 0
)
try:
self.deployment_account_id = (
self.parameter_store.fetch_parameter('deployment_account_id')
)
except ParameterNotFoundError:
self.deployment_account_id = self.account_id
self.deployment_account_id = self._read_parameter(
'deployment_account_id',
self.account_id,
)

def set_destination_ou_name(self):
"""
Expand All @@ -108,6 +106,12 @@ def set_destination_ou_name(self):
finally:
self._determine_if_deployment_account()

def _read_parameter(self, name, default_value_when_missing):
try:
return self.parameter_store.fetch_parameter(name)
except ParameterNotFoundError:
return default_value_when_missing

def create_output_object(self, account_path):
"""
Creates the output object to be passed to the next step
Expand Down Expand Up @@ -140,6 +144,12 @@ def create_output_object(self, account_path):
'cross_account_access_role': self.cross_account_access_role,
'deployment_account_bucket': DEPLOYMENT_ACCOUNT_S3_BUCKET,
'adf_version': ADF_VERSION,
'adf_log_level': ADF_LOG_LEVEL
'adf_log_level': ADF_LOG_LEVEL,
'extensions/terraform/enabled': (
self._read_parameter(
'extensions/terraform/enabled',
'False',
)
),
},
}
Loading