CDKHelpers¶
tag_all(stack, env, application)
¶
Apply standardized organizational tags to a CDK stack and all its resources.
This function applies a consistent set of tags to a CDK stack, which will be inherited by all resources within that stack. The tags follow organizational standards for resource identification, cost allocation, and governance.
The following tags are applied: - Project: The project identifier - Organization: The organization name - Environment: The deployment environment (dev, prod, test, etc.) - Technology: The technology stack identifier - Owner: The project or team owner
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
stack
|
Construct
|
The CDK stack or construct to apply tags to. All child resources will inherit these tags automatically. |
required |
env
|
str
|
The deployment environment name (e.g., 'dev', 'prod', 'test', 'staging'). This should match the environment context used throughout the application. |
required |
application
|
Dict[str, Any]
|
Dictionary containing application metadata with
the following required keys:
- 'project': Project identifier
- 'organization': Organization name |
required |
Returns:
| Name | Type | Description |
|---|---|---|
None |
None
|
This function modifies the stack in-place and does not return a value. |
Raises:
| Type | Description |
|---|---|
KeyError
|
If any required keys are missing from the application dictionary. |
AttributeError
|
If the stack parameter is not a valid CDK construct. |
Note
Tags applied at the stack level are automatically inherited by all resources created within that stack. This provides a consistent tagging strategy without requiring manual tagging of individual resources.
Source code in mare_aws_common_lib/helpers/cdk_helpers.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |