in lib/configuration.py [0:0]
def get_local_configuration(environment: str) -> dict:
"""
Provides manually configured variables that are validated for quality and safety.
@param: environment str: The environment used to retrieve corresponding configuration
@raises: Exception: Throws an exception if the resource_name_prefix does not conform
@raises: Exception: Throws an exception if the requested environment does not exist
@returns: dict:
"""
local_mapping = {
DEPLOYMENT: {
ACCOUNT_ID: '',
REGION: 'us-east-2',
GITHUB_REPOSITORY_OWNER_NAME: '',
# If you use GitHub / GitHub Enterprise, this will be the organization name
GITHUB_REPOSITORY_NAME: '',
# Use your forked repo here!
# This is used in the Logical Id of CloudFormation resources
# We recommend capital case for consistency. e.g. DataLakeCdkBlog
LOGICAL_ID_PREFIX: '',
# This is used in resources that must be globally unique!
# It may only contain alphanumeric characters, hyphens, and cannot contain trailing hyphens
# E.g. unique-identifier-data-lake
RESOURCE_NAME_PREFIX: '',
},
DEV: {
ACCOUNT_ID: '',
REGION: 'us-east-2',
VPC_CIDR: '10.20.0.0/24'
},
TEST: {
ACCOUNT_ID: '',
REGION: 'us-east-2',
VPC_CIDR: '10.10.0.0/24'
},
PROD: {
ACCOUNT_ID: '',
REGION: 'us-east-2',
VPC_CIDR: '10.0.0.0/24'
}
}
resource_prefix = local_mapping[DEPLOYMENT][RESOURCE_NAME_PREFIX]
if (
not re.fullmatch('^[a-z|0-9|-]+', resource_prefix)
or '-' in resource_prefix[-1:] or '-' in resource_prefix[1]
):
raise Exception('Resource names may only contain lowercase Alphanumeric and hyphens '
'and cannot contain leading or trailing hyphens')
if environment not in local_mapping:
raise Exception(f'The requested environment: {environment} does not exist in local mappings')
return local_mapping[environment]