ecs_composex.secrets package

Submodules

ecs_composex.secrets.compose_secrets module

Represent a service from the docker-compose services

class ecs_composex.secrets.compose_secrets. ComposeSecret ( name , definition , settings ) [source]

Bases: object

Class to represent a Compose secret.

add_json_keys ( ) [source]

Method to add secrets definitions based on JSON secret keys

allowed_keys = ['Name', 'Lookup']
define_names_from_import ( ) [source]

Method to define the names from docker-compose file content

define_names_from_lookup ( session ) [source]

Method to Lookup the secret based on its tags. :return:

json_keys_key = 'JsonKeys'
main_key = 'secrets'
map_arn_name = 'Arn'
map_kms_name = 'KmsKeyId'
map_name = 'secrets'
map_name_name = 'Name'
valid_keys = ['JsonKeys', 'LinksTo', 'Name', 'Lookup']
x_key = 'x-secrets'
ecs_composex.secrets.compose_secrets. define_env_var_name ( secret_key ) [source]

Function to determine what the VarName key for secret will be

Parameters

secret_key ( dict ) – Key definition as defined in compose file

Returns

VarName value

Return type

str

ecs_composex.secrets.compose_secrets. get_name_from_arn ( secret_arn ) [source]
ecs_composex.secrets.compose_secrets. match_secrets_services_config ( service , s_secret , secrets ) [source]

Function to match the services and secrets :param service: :param s_secret: :param secrets: :return:

ecs_composex.secrets.compose_secrets. to_capitalize ( name ) [source]

Function to capitalize/upper all letters and leave the rest empty

Parameters

name

Returns

ecs_composex.secrets.compose_secrets. to_java_properties ( name ) [source]

Replaces . with _ and set all cases to upper

Parameters

name ( str ) –

Returns

transformed test

Return type

str

ecs_composex.secrets.compose_secrets. to_title ( name ) [source]

Function to title the name

Parameters

name ( str ) –

Returns

ecs_composex.secrets.secrets_aws module

Module to find the Secrets from AWS Tags

ecs_composex.secrets.secrets_aws. get_secret_config ( logical_name , secret_arn , session ) [source]

Function to get the secret config used to define its mapping

Parameters
  • logical_name ( str ) –

  • secret_arn ( str ) –

  • session ( boto3.session.Session ) –

Returns

ecs_composex.secrets.secrets_aws. lookup_secret_config ( logical_name , lookup , session ) [source]

Function to find the DB in AWS account

Parameters
  • logical_name ( str ) – Logical name of the resource

  • lookup ( dict ) – The Lookup definition

  • session ( boto3.session.Session ) – Boto3 session for clients

Returns

ecs_composex.secrets.secrets_params module

Module for Secrets parameters

Module contents

Package to handle recurring Secrets tasks

ecs_composex.secrets. add_db_dependency ( resource , secret ) [source]
ecs_composex.secrets. add_db_secret ( template , resource_title ) [source]

Function to add a Secrets Manager secret that will be associated with the DB

Parameters
  • template ( template.Template ) – The template to add the secret to.

  • resource_title ( str ) – The Logical name of the resource associated to that secret

ecs_composex.secrets. attach_to_secret_to_resource ( template , resource , secret ) [source]

Function to associate a secret to a resource :param troposphere.Template template: :param resource: The resource we can link the secret to. :param secret: The secret to attach to the resource :return: