dbt-platform-helper 15.8.0__tar.gz → 15.10.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of dbt-platform-helper might be problematic. Click here for more details.

Files changed (112) hide show
  1. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/PKG-INFO +7 -15
  2. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/COMMANDS.md +41 -0
  3. dbt_platform_helper-15.10.0/dbt_platform_helper/commands/internal.py +23 -0
  4. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/constants.py +2 -2
  5. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/domain/maintenance_page.py +25 -3
  6. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/domain/pipelines.py +25 -8
  7. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/domain/service.py +61 -1
  8. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/entities/platform_config_schema.py +4 -2
  9. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/entities/service.py +1 -1
  10. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/terraform_manifest.py +22 -7
  11. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/yaml_file.py +27 -0
  12. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/environment-pipelines/main.tf +2 -2
  13. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/platform_helper.py +2 -0
  14. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/pyproject.toml +9 -14
  15. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/LICENSE +0 -0
  16. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/README.md +0 -0
  17. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/__init__.py +0 -0
  18. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/commands/__init__.py +0 -0
  19. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/commands/application.py +0 -0
  20. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/commands/codebase.py +0 -0
  21. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/commands/conduit.py +0 -0
  22. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/commands/config.py +0 -0
  23. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/commands/copilot.py +0 -0
  24. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/commands/database.py +0 -0
  25. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/commands/environment.py +0 -0
  26. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/commands/generate.py +0 -0
  27. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/commands/notify.py +0 -0
  28. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/commands/pipeline.py +0 -0
  29. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/commands/secrets.py +0 -0
  30. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/commands/service.py +0 -0
  31. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/commands/version.py +0 -0
  32. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/default-extensions.yml +0 -0
  33. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/domain/__init__.py +0 -0
  34. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/domain/codebase.py +0 -0
  35. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/domain/conduit.py +0 -0
  36. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/domain/config.py +0 -0
  37. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/domain/copilot.py +0 -0
  38. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/domain/copilot_environment.py +0 -0
  39. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/domain/database_copy.py +0 -0
  40. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/domain/notify.py +0 -0
  41. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/domain/plans.py +0 -0
  42. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/domain/terraform_environment.py +0 -0
  43. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/domain/versioning.py +0 -0
  44. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/entities/semantic_version.py +0 -0
  45. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/jinja2_tags.py +0 -0
  46. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/platform_exception.py +0 -0
  47. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/__init__.py +0 -0
  48. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/aws/__init__.py +0 -0
  49. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/aws/exceptions.py +0 -0
  50. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/aws/interfaces.py +0 -0
  51. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/aws/opensearch.py +0 -0
  52. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/aws/redis.py +0 -0
  53. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/aws/sso_auth.py +0 -0
  54. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/cache.py +0 -0
  55. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/cloudformation.py +0 -0
  56. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/config.py +0 -0
  57. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/config_validator.py +0 -0
  58. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/copilot.py +0 -0
  59. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/ecr.py +0 -0
  60. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/ecs.py +0 -0
  61. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/environment_variable.py +0 -0
  62. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/files.py +0 -0
  63. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/io.py +0 -0
  64. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/kms.py +0 -0
  65. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/load_balancers.py +0 -0
  66. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/parameter_store.py +0 -0
  67. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/schema_migrations/__init__.py +0 -0
  68. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/schema_migrations/schema_v0_to_v1_migration.py +0 -0
  69. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/schema_migrator.py +0 -0
  70. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/secrets.py +0 -0
  71. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/slack_channel_notifier.py +0 -0
  72. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/validation.py +0 -0
  73. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/version.py +0 -0
  74. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/version_status.py +0 -0
  75. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/providers/vpc.py +0 -0
  76. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/.copilot/config.yml +0 -0
  77. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/.copilot/image_build_run.sh +0 -0
  78. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/.copilot/phases/build.sh +0 -0
  79. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/.copilot/phases/install.sh +0 -0
  80. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/.copilot/phases/post_build.sh +0 -0
  81. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/.copilot/phases/pre_build.sh +0 -0
  82. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/COMMANDS.md.jinja +0 -0
  83. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/addon-instructions.txt +0 -0
  84. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/addons/README.md +0 -0
  85. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/addons/svc/appconfig-ipfilter.yml +0 -0
  86. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/addons/svc/prometheus-policy.yml +0 -0
  87. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/addons/svc/s3-cross-account-policy.yml +0 -0
  88. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/addons/svc/s3-policy.yml +0 -0
  89. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/addons/svc/subscription-filter.yml +0 -0
  90. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/ci-codebuild-role-policy.json +0 -0
  91. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/create-codebuild-role.json +0 -0
  92. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/custom-codebuild-role-policy.json +0 -0
  93. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/env/manifest.yml +0 -0
  94. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/env/terraform-overrides/cfn.patches.yml +0 -0
  95. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/svc/maintenance_pages/default.html +0 -0
  96. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/svc/maintenance_pages/dmas-migration.html +0 -0
  97. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/svc/maintenance_pages/migration.html +0 -0
  98. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/templates/svc/overrides/cfn.patches.yml +0 -0
  99. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/utilities/decorators.py +0 -0
  100. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/utils/__init__.py +0 -0
  101. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/utils/application.py +0 -0
  102. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/utils/arn_parser.py +0 -0
  103. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/utils/aws.py +0 -0
  104. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/utils/click.py +0 -0
  105. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/utils/deep_merge.py +0 -0
  106. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/utils/git.py +0 -0
  107. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/utils/messages.py +0 -0
  108. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/utils/template.py +0 -0
  109. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/dbt_platform_helper/utils/validation.py +0 -0
  110. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/terraform/elasticache-redis/plans.yml +0 -0
  111. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/terraform/opensearch/plans.yml +0 -0
  112. {dbt_platform_helper-15.8.0 → dbt_platform_helper-15.10.0}/terraform/postgres/plans.yml +0 -0
@@ -1,8 +1,9 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: dbt-platform-helper
3
- Version: 15.8.0
3
+ Version: 15.10.0
4
4
  Summary: Set of tools to help transfer applications/services from GOV.UK PaaS to DBT PaaS augmenting AWS Copilot.
5
5
  License: MIT
6
+ License-File: LICENSE
6
7
  Author: Department for Business and Trade Platform Team
7
8
  Author-email: sre-team@digital.trade.gov.uk
8
9
  Requires-Python: >3.9.1,<4.0
@@ -12,28 +13,19 @@ Classifier: Programming Language :: Python :: 3.10
12
13
  Classifier: Programming Language :: Python :: 3.11
13
14
  Classifier: Programming Language :: Python :: 3.12
14
15
  Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
15
17
  Requires-Dist: Jinja2 (==3.1.6)
16
- Requires-Dist: PyYAML (==6.0.2)
17
- Requires-Dist: aiohttp (>=3.11.16,<4.0.0)
18
18
  Requires-Dist: boto3 (>=1.35.2,<2.0.0)
19
- Requires-Dist: boto3-stubs (>=1.26.148,<2.0.0)
20
19
  Requires-Dist: botocore (>=1.34.85,<2.0.0)
21
- Requires-Dist: certifi (>=2023.7.22,<2025.0.0)
22
- Requires-Dist: cfn-flip (==1.3.0)
23
- Requires-Dist: cfn-lint (>=1.4.2,<2.0.0)
24
- Requires-Dist: checkov (>=3.2.405,<4.0.0)
20
+ Requires-Dist: cfn-flip (>=1.3.0,<2.0.0)
25
21
  Requires-Dist: click (>=8.1.3,<9.0.0)
26
- Requires-Dist: cryptography (>=44.0.1,<45)
27
- Requires-Dist: jinja2-simple-tags (>=0.5.0,<0.6.0)
28
- Requires-Dist: jsonschema (>=4.17.0,<4.18.0)
29
- Requires-Dist: mypy-boto3-codebuild (>=1.26.0.post1,<2.0.0)
22
+ Requires-Dist: jinja2-simple-tags (>=0.5,<0.7)
30
23
  Requires-Dist: prettytable (>=3.9.0,<4.0.0)
31
24
  Requires-Dist: psycopg2-binary (>=2.9.9,<3.0.0)
25
+ Requires-Dist: pydantic (>=2.11.7,<3.0.0)
32
26
  Requires-Dist: requests (>=2.31.0,<3.0.0)
33
27
  Requires-Dist: schema (==0.7.5)
34
- Requires-Dist: semver (>=3.0.2,<4.0.0)
35
28
  Requires-Dist: slack-sdk (>=3.27.1,<4.0.0)
36
- Requires-Dist: tomlkit (>=0.12.2,<0.14.0)
37
29
  Requires-Dist: yamllint (>=1.35.1,<2.0.0)
38
30
  Description-Content-Type: text/markdown
39
31
 
@@ -22,6 +22,8 @@
22
22
  - [platform-helper environment generate](#platform-helper-environment-generate)
23
23
  - [platform-helper environment generate-terraform](#platform-helper-environment-generate-terraform)
24
24
  - [platform-helper generate](#platform-helper-generate)
25
+ - [platform-helper internal](#platform-helper-internal)
26
+ - [platform-helper internal migrate-service-manifests](#platform-helper-internal-migrate-service-manifests)
25
27
  - [platform-helper pipeline](#platform-helper-pipeline)
26
28
  - [platform-helper pipeline generate](#platform-helper-pipeline-generate)
27
29
  - [platform-helper secrets](#platform-helper-secrets)
@@ -65,6 +67,7 @@ platform-helper <command> [--version]
65
67
  - [`database` ↪](#platform-helper-database)
66
68
  - [`environment` ↪](#platform-helper-environment)
67
69
  - [`generate` ↪](#platform-helper-generate)
70
+ - [`internal` ↪](#platform-helper-internal)
68
71
  - [`notify` ↪](#platform-helper-notify)
69
72
  - [`pipeline` ↪](#platform-helper-pipeline)
70
73
  - [`secrets` ↪](#platform-helper-secrets)
@@ -539,6 +542,44 @@ platform-helper generate
539
542
 
540
543
  ## Options
541
544
 
545
+ - `--help <boolean>` _Defaults to False._
546
+ - Show this message and exit.
547
+
548
+ # platform-helper internal
549
+
550
+ [↩ Parent](#platform-helper)
551
+
552
+ Internal commands for use within pipelines or by Platform Team.
553
+
554
+ ## Usage
555
+
556
+ ```
557
+ platform-helper internal migrate-service-manifests
558
+ ```
559
+
560
+ ## Options
561
+
562
+ - `--help <boolean>` _Defaults to False._
563
+ - Show this message and exit.
564
+
565
+ ## Commands
566
+
567
+ - [`migrate-service-manifests` ↪](#platform-helper-internal-migrate-service-manifests)
568
+
569
+ # platform-helper internal migrate-service-manifests
570
+
571
+ [↩ Parent](#platform-helper-internal)
572
+
573
+ Migrate copilot manifests to service manifests.
574
+
575
+ ## Usage
576
+
577
+ ```
578
+ platform-helper internal migrate-service-manifests
579
+ ```
580
+
581
+ ## Options
582
+
542
583
  - `--help <boolean>` _Defaults to False._
543
584
  - Show this message and exit.
544
585
 
@@ -0,0 +1,23 @@
1
+ import click
2
+
3
+ from dbt_platform_helper.domain.service import ServiceManager
4
+ from dbt_platform_helper.platform_exception import PlatformException
5
+ from dbt_platform_helper.providers.io import ClickIOProvider
6
+ from dbt_platform_helper.utils.click import ClickDocOptGroup
7
+
8
+
9
+ @click.group(cls=ClickDocOptGroup)
10
+ def internal():
11
+ """Internal commands for use within pipelines or by Platform Team."""
12
+
13
+
14
+ @internal.command()
15
+ def migrate_service_manifests():
16
+ """Migrate copilot manifests to service manifests."""
17
+ click_io = ClickIOProvider()
18
+
19
+ try:
20
+ service_manager = ServiceManager()
21
+ service_manager.migrate_copilot_manifests()
22
+ except PlatformException as error:
23
+ click_io.abort_with_error(str(error))
@@ -16,8 +16,8 @@ TERRAFORM_ECS_SERVICE_MODULE_SOURCE_OVERRIDE_ENV_VAR = (
16
16
  TERRAFORM_MODULE_SOURCE_TYPE_ENV_VAR = "TERRAFORM_MODULE_SOURCE_TYPE" # "LOCAL", "SSH", "OVERRIDE"
17
17
  IMAGE_TAG_ENV_VAR = "IMAGE_TAG"
18
18
  PLATFORM_HELPER_PACKAGE_NAME = "dbt-platform-helper"
19
- SUPPORTED_TERRAFORM_VERSION = "~> 1.8"
20
- SUPPORTED_AWS_PROVIDER_VERSION = "~> 5"
19
+ SUPPORTED_TERRAFORM_VERSION = "~> 1.11"
20
+ SUPPORTED_AWS_PROVIDER_VERSION = "~> 6"
21
21
  FIRST_UPGRADABLE_PLATFORM_HELPER_MAJOR_VERSION = 13
22
22
 
23
23
  MERGED_TPM_PLATFORM_HELPER_VERSION = 14
@@ -199,7 +199,13 @@ class MaintenancePage:
199
199
  "AllowedIps",
200
200
  next(rule_priority),
201
201
  service_conditions,
202
- [{"Key": "service", "Value": svc.name}],
202
+ [
203
+ {"Key": "application", "Value": app},
204
+ {"Key": "environment", "Value": env},
205
+ {"Key": "reason", "Value": "MaintenancePage"},
206
+ {"Key": "managed-by", "Value": "DBT Platform"},
207
+ {"Key": "service", "Value": svc.name},
208
+ ],
203
209
  )
204
210
  self.load_balancer.create_source_ip_rule(
205
211
  listener_arn,
@@ -208,7 +214,13 @@ class MaintenancePage:
208
214
  "AllowedSourceIps",
209
215
  next(rule_priority),
210
216
  service_conditions,
211
- [{"Key": "service", "Value": svc.name}],
217
+ [
218
+ {"Key": "application", "Value": app},
219
+ {"Key": "environment", "Value": env},
220
+ {"Key": "reason", "Value": "MaintenancePage"},
221
+ {"Key": "managed-by", "Value": "DBT Platform"},
222
+ {"Key": "service", "Value": svc.name},
223
+ ],
212
224
  )
213
225
 
214
226
  self.load_balancer.create_header_rule(
@@ -219,7 +231,13 @@ class MaintenancePage:
219
231
  "BypassIpFilter",
220
232
  next(rule_priority),
221
233
  service_conditions,
222
- [{"Key": "service", "Value": svc.name}],
234
+ [
235
+ {"Key": "application", "Value": app},
236
+ {"Key": "environment", "Value": env},
237
+ {"Key": "reason", "Value": "MaintenancePage"},
238
+ {"Key": "managed-by", "Value": "DBT Platform"},
239
+ {"Key": "service", "Value": svc.name},
240
+ ],
223
241
  )
224
242
 
225
243
  # add to accumilating list of conditions for maintenace page rule
@@ -267,8 +285,12 @@ class MaintenancePage:
267
285
  }
268
286
  ],
269
287
  tags=[
288
+ {"Key": "application", "Value": app},
289
+ {"Key": "environment", "Value": env},
290
+ {"Key": "reason", "Value": "MaintenancePage"},
270
291
  {"Key": "name", "Value": "MaintenancePage"},
271
292
  {"Key": "type", "Value": template},
293
+ {"Key": "managed-by", "Value": "DBT Platform"},
272
294
  ],
273
295
  )
274
296
  except Exception as e:
@@ -54,6 +54,25 @@ class Pipelines:
54
54
  or self.environment_variable_provider.get(PLATFORM_HELPER_VERSION_OVERRIDE_KEY)
55
55
  )
56
56
 
57
+ def _map_environment_pipeline_accounts(self, platform_config) -> list[tuple[str, str]]:
58
+ environment_pipelines_config = platform_config[ENVIRONMENT_PIPELINES_KEY]
59
+ environment_config = platform_config["environments"]
60
+
61
+ account_id_lookup = {
62
+ env["accounts"]["deploy"]["name"]: env["accounts"]["deploy"]["id"]
63
+ for env in environment_config.values()
64
+ if env is not None and "accounts" in env and "deploy" in env["accounts"]
65
+ }
66
+
67
+ accounts = set()
68
+
69
+ for config in environment_pipelines_config.values():
70
+ account = config.get("account")
71
+ deploy_account_id = account_id_lookup.get(account)
72
+ accounts.add((account, deploy_account_id))
73
+
74
+ return list(accounts)
75
+
57
76
  def generate(
58
77
  self,
59
78
  deploy_branch: str,
@@ -107,20 +126,16 @@ class Pipelines:
107
126
  )
108
127
 
109
128
  if has_environment_pipelines:
110
- environment_pipelines = platform_config[ENVIRONMENT_PIPELINES_KEY]
111
- accounts = {
112
- config.get("account")
113
- for config in environment_pipelines.values()
114
- if "account" in config
115
- }
129
+ accounts = self._map_environment_pipeline_accounts(platform_config)
116
130
 
117
- for account in accounts:
131
+ for account_name, account_id in accounts:
118
132
  self._generate_terraform_environment_pipeline_manifest(
119
133
  platform_config["application"],
120
134
  deploy_repository,
121
- account,
135
+ account_name,
122
136
  env_pipeline_module_source,
123
137
  deploy_branch,
138
+ account_id,
124
139
  )
125
140
 
126
141
  if has_codebase_pipelines:
@@ -163,6 +178,7 @@ class Pipelines:
163
178
  aws_account: str,
164
179
  module_source: str,
165
180
  deploy_branch: str,
181
+ aws_account_id: str,
166
182
  ):
167
183
  env_pipeline_template = setup_templates().get_template("environment-pipelines/main.tf")
168
184
 
@@ -175,6 +191,7 @@ class Pipelines:
175
191
  "deploy_branch": deploy_branch,
176
192
  "terraform_version": SUPPORTED_TERRAFORM_VERSION,
177
193
  "aws_provider_version": SUPPORTED_AWS_PROVIDER_VERSION,
194
+ "deploy_account_id": aws_account_id,
178
195
  }
179
196
  )
180
197
 
@@ -1,8 +1,12 @@
1
+ import os
2
+ from collections import OrderedDict
3
+ from copy import deepcopy
1
4
  from datetime import datetime
2
5
  from importlib.metadata import version
3
6
  from pathlib import Path
4
7
 
5
8
  from dbt_platform_helper.constants import IMAGE_TAG_ENV_VAR
9
+ from dbt_platform_helper.constants import PLATFORM_HELPER_PACKAGE_NAME
6
10
  from dbt_platform_helper.constants import PLATFORM_HELPER_VERSION_OVERRIDE_KEY
7
11
  from dbt_platform_helper.constants import SERVICE_CONFIG_FILE
8
12
  from dbt_platform_helper.constants import SERVICE_DIRECTORY
@@ -21,15 +25,18 @@ from dbt_platform_helper.providers.config_validator import ConfigValidator
21
25
  from dbt_platform_helper.providers.environment_variable import (
22
26
  EnvironmentVariableProvider,
23
27
  )
28
+ from dbt_platform_helper.providers.files import FileProvider
24
29
  from dbt_platform_helper.providers.io import ClickIOProvider
25
30
  from dbt_platform_helper.providers.terraform_manifest import TerraformManifestProvider
31
+ from dbt_platform_helper.providers.version import InstalledVersionProvider
26
32
  from dbt_platform_helper.providers.yaml_file import YamlFileProvider
27
33
  from dbt_platform_helper.utils.application import load_application
28
34
  from dbt_platform_helper.utils.deep_merge import deep_merge
29
35
 
30
- # TODO add schema version too service config
36
+ SERVICE_TYPES = ["Load Balanced Web Service", "Backend Service"]
31
37
 
32
38
 
39
+ # TODO add schema version to service config
33
40
  class ServiceManager:
34
41
  def __init__(
35
42
  self,
@@ -41,6 +48,7 @@ class ServiceManager:
41
48
  manifest_provider: TerraformManifestProvider = None,
42
49
  platform_helper_version_override: str = None,
43
50
  load_application=load_application,
51
+ installed_version_provider: InstalledVersionProvider = InstalledVersionProvider(),
44
52
  ):
45
53
 
46
54
  self.file_provider = file_provider
@@ -56,6 +64,7 @@ class ServiceManager:
56
64
  or self.environment_variable_provider.get(PLATFORM_HELPER_VERSION_OVERRIDE_KEY)
57
65
  )
58
66
  self.load_application = load_application
67
+ self.installed_version_provider = installed_version_provider
59
68
 
60
69
  def generate(self, environments: list[str], services: list[str], image_tag_flag: str = None):
61
70
 
@@ -151,3 +160,54 @@ class ServiceManager:
151
160
  config,
152
161
  module_source_override,
153
162
  )
163
+
164
+ def migrate_copilot_manifests(self) -> None:
165
+ service_directory = Path("services/")
166
+ service_directory.mkdir(parents=True, exist_ok=True)
167
+
168
+ for dirname, _, filenames in os.walk("copilot"):
169
+ if "manifest.yml" in filenames and "environments" not in dirname:
170
+ copilot_manifest = self.file_provider.load(f"{dirname}/manifest.yml")
171
+ service_manifest = OrderedDict(deepcopy(copilot_manifest))
172
+
173
+ if service_manifest["type"] not in SERVICE_TYPES:
174
+ continue
175
+
176
+ if "environments" in service_manifest:
177
+ for env in service_manifest["environments"]:
178
+ env_config = service_manifest["environments"][env]
179
+ if "http" in env_config:
180
+ if "alb" in env_config["http"]:
181
+ del env_config["http"]["alb"]
182
+
183
+ service_manifest = self.file_provider.find_and_replace(
184
+ service_manifest,
185
+ "${COPILOT_APPLICATION_NAME}",
186
+ "${PLATFORM_APPLICATION_NAME}",
187
+ )
188
+
189
+ service_manifest = self.file_provider.find_and_replace(
190
+ service_manifest,
191
+ "${COPILOT_ENVIRONMENT_NAME}",
192
+ "${PLATFORM_ENVIRONMENT_NAME}",
193
+ )
194
+
195
+ service_manifest = self.file_provider.remove_empty_keys(service_manifest)
196
+
197
+ service_path = service_directory / service_manifest["name"]
198
+
199
+ self.io.info(
200
+ FileProvider.mkfile(
201
+ service_path,
202
+ "service-config.yml",
203
+ "",
204
+ overwrite=True,
205
+ )
206
+ )
207
+
208
+ current_date = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
209
+ message = f"# Generated by platform-helper {self.installed_version_provider.get_semantic_version(PLATFORM_HELPER_PACKAGE_NAME)} / {current_date}.\n\n"
210
+
211
+ self.file_provider.write(
212
+ f"{service_path}/service-config.yml", dict(service_manifest), message
213
+ )
@@ -114,7 +114,6 @@ class PlatformConfigSchema:
114
114
  Optional("default_waf"): str,
115
115
  Optional("domain_prefix"): str,
116
116
  Optional("enable_logging"): bool,
117
- Optional("env_root"): str,
118
117
  Optional("forwarded_values_forward"): str,
119
118
  Optional("forwarded_values_headers"): [str],
120
119
  Optional("forwarded_values_query_string"): bool,
@@ -293,6 +292,7 @@ class PlatformConfigSchema:
293
292
  @staticmethod
294
293
  def __postgres_schema() -> dict:
295
294
  _valid_postgres_plans = Or(*plan_manager.get_plan_names("postgres"))
295
+ _valid_postgres_version = Or(int, float)
296
296
 
297
297
  # TODO: DBTP-1943: Move to Postgres provider?
298
298
  _valid_postgres_storage_types = Or("gp2", "gp3", "io1", "io2")
@@ -305,11 +305,13 @@ class PlatformConfigSchema:
305
305
 
306
306
  return {
307
307
  "type": "postgres",
308
- "version": (Or(int, float)),
308
+ Optional("version"): _valid_postgres_version,
309
309
  Optional("deletion_policy"): PlatformConfigSchema.__valid_postgres_deletion_policy(),
310
310
  Optional("environments"): {
311
311
  PlatformConfigSchema.__valid_environment_name(): {
312
+ Optional("apply_immediately"): bool,
312
313
  Optional("plan"): _valid_postgres_plans,
314
+ Optional("version"): (Or(int, float)),
313
315
  Optional("volume_size"): PlatformConfigSchema.is_integer_between(20, 10000),
314
316
  Optional("iops"): PlatformConfigSchema.is_integer_between(1000, 9950),
315
317
  Optional("snapshot_id"): str,
@@ -54,7 +54,7 @@ class SidecarOverride(BaseModel):
54
54
  class Image(BaseModel):
55
55
  build: Optional[str] = Field(default=None)
56
56
  location: Optional[str] = Field(default=None)
57
- port: int = Field()
57
+ port: Optional[int] = Field(default=None)
58
58
 
59
59
 
60
60
  class VPC(BaseModel):
@@ -30,6 +30,7 @@ class TerraformManifestProvider:
30
30
  service_dir = f"terraform/services/{environment}/{config_object.name}"
31
31
  platform_config = ConfigProvider.apply_environment_defaults(platform_config)
32
32
  account = self._get_account_for_env(environment, platform_config)
33
+ deploy_to_account_id = self._get_account_id_for_account(account, platform_config)
33
34
  state_key_suffix = f"{config_object.name}-{environment}"
34
35
 
35
36
  terraform = {}
@@ -37,7 +38,7 @@ class TerraformManifestProvider:
37
38
 
38
39
  self._add_service_locals(terraform, environment, image_tag)
39
40
 
40
- self._add_provider(terraform, account)
41
+ self._add_provider(terraform, account, deploy_to_account_id)
41
42
  self._add_backend(
42
43
  terraform, platform_config, account, f"tfstate/services/{state_key_suffix}.tfstate"
43
44
  )
@@ -54,11 +55,13 @@ class TerraformManifestProvider:
54
55
  "application": '${local.platform_config["application"]}',
55
56
  "environments": '${local.platform_config["environments"]}',
56
57
  "env_config": '${{for name, config in local.environments: name => merge(lookup(local.environments, "*", {}), config)}}',
57
- "service_config": '${yamldecode(templatefile("./service-config.yml", {COPILOT_ENVIRONMENT_NAME = local.environment, IMAGE_TAG = local.image_tag}))}',
58
+ "service_config": '${yamldecode(templatefile("./service-config.yml", {PLATFORM_ENVIRONMENT_NAME = local.environment, IMAGE_TAG = local.image_tag}))}',
58
59
  "raw_env_config": '${local.platform_config["environments"]}',
59
60
  "combined_env_config": '${{for name, config in local.raw_env_config: name => merge(lookup(local.raw_env_config, "*", {}), config)}}',
60
61
  "service_deployment_mode": '${lookup(local.combined_env_config[local.environment], "service-deployment-mode", "copilot")}',
61
62
  "non_copilot_service_deployment_mode": '${local.service_deployment_mode == "dual-deploy-copilot-traffic" || local.service_deployment_mode == "dual-deploy-platform-traffic" || local.service_deployment_mode == "platform" ? 1 : 0}',
63
+ "custom_iam_policy_path": '${abspath(format("%s/../../../../services/%s/custom-iam-policy/%s.yml", path.module, local.service_config.name, local.environment))}',
64
+ "custom_iam_policy_json": "${fileexists(local.custom_iam_policy_path) ? jsonencode(yamldecode(file(local.custom_iam_policy_path))) : null}",
62
65
  }
63
66
 
64
67
  def _add_service_module(
@@ -76,6 +79,8 @@ class TerraformManifestProvider:
76
79
  "environment": "${local.environment}",
77
80
  "service_config": "${local.service_config}",
78
81
  "env_config": "${local.env_config}",
82
+ "platform_extensions": '${local.platform_config["extensions"]}',
83
+ "custom_iam_policy_json": "${local.custom_iam_policy_json}",
79
84
  }
80
85
  }
81
86
 
@@ -88,12 +93,13 @@ class TerraformManifestProvider:
88
93
  module_source: str,
89
94
  ):
90
95
  default_account = self._get_account_for_env("*", platform_config)
96
+ deploy_to_account_id = self._get_account_id_for_account(default_account, platform_config)
91
97
  state_key_suffix = f"{platform_config['application']}-codebase-pipelines"
92
98
 
93
99
  terraform = {}
94
100
  self._add_header(terraform)
95
101
  self._add_codebase_pipeline_locals(terraform)
96
- self._add_provider(terraform, default_account)
102
+ self._add_provider(terraform, default_account, deploy_to_account_id)
97
103
  self._add_backend(
98
104
  terraform,
99
105
  platform_config,
@@ -142,6 +148,16 @@ class TerraformManifestProvider:
142
148
  )
143
149
  return account
144
150
 
151
+ @staticmethod
152
+ def _get_account_id_for_account(account_name, platform_config):
153
+ environment_config = platform_config["environments"]
154
+ account_id_lookup = {
155
+ env["accounts"]["deploy"]["name"]: env["accounts"]["deploy"]["id"]
156
+ for env in environment_config.values()
157
+ if env is not None and "accounts" in env and "deploy" in env["accounts"]
158
+ }
159
+ return account_id_lookup.get(account_name)
160
+
145
161
  @staticmethod
146
162
  def _add_header(terraform: dict):
147
163
  time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
@@ -160,12 +176,11 @@ class TerraformManifestProvider:
160
176
  }
161
177
 
162
178
  @staticmethod
163
- def _add_provider(terraform: dict, default_account: str):
179
+ def _add_provider(terraform: dict, deploy_to_account: str, deploy_to_account_id: str):
164
180
  terraform["provider"] = {"aws": {}}
165
181
  terraform["provider"]["aws"]["region"] = "eu-west-2"
166
- terraform["provider"]["aws"]["profile"] = default_account
167
- terraform["provider"]["aws"]["alias"] = default_account
168
- terraform["provider"]["aws"]["shared_credentials_files"] = ["~/.aws/config"]
182
+ terraform["provider"]["aws"]["profile"] = deploy_to_account
183
+ terraform["provider"]["aws"]["allowed_account_ids"] = [deploy_to_account_id]
169
184
 
170
185
  @staticmethod
171
186
  def _add_backend(terraform: dict, platform_config: dict, account: str, state_key: str):
@@ -1,3 +1,4 @@
1
+ from collections import OrderedDict
1
2
  from pathlib import Path
2
3
 
3
4
  import yaml
@@ -84,6 +85,32 @@ class YamlFileProvider:
84
85
  if duplicate_keys:
85
86
  raise DuplicateKeysException(",".join(duplicate_keys))
86
87
 
88
+ @staticmethod
89
+ def remove_empty_keys(config: (dict, OrderedDict)) -> (dict, OrderedDict):
90
+ cleaned = config.__class__()
91
+
92
+ for k, v in config.items():
93
+ if isinstance(v, (dict, OrderedDict)):
94
+ v = YamlFileProvider.remove_empty_keys(v)
95
+ if v not in ("", None, [], {}, ()):
96
+ cleaned[k] = v
97
+
98
+ return cleaned
99
+
100
+ @staticmethod
101
+ def find_and_replace(config, string: str, replacement: str):
102
+ if isinstance(config, (dict, OrderedDict)):
103
+ return {
104
+ k: YamlFileProvider.find_and_replace(v, string, replacement)
105
+ for k, v in config.items()
106
+ }
107
+ elif isinstance(config, list):
108
+ return [YamlFileProvider.find_and_replace(item, string, replacement) for item in config]
109
+ elif isinstance(config, str):
110
+ return config.replace(string, replacement)
111
+ else:
112
+ return replacement if config == string else config
113
+
87
114
 
88
115
  def account_number_representer(dumper, data):
89
116
  if data.isdigit():
@@ -10,10 +10,10 @@ locals {
10
10
  provider "aws" {
11
11
  region = "eu-west-2"
12
12
  profile = "{{ aws_account }}"
13
- alias = "{{ aws_account }}"
14
- shared_credentials_files = ["~/.aws/config"]
13
+ allowed_account_ids = ["{{ deploy_account_id }}"]
15
14
  }
16
15
 
16
+
17
17
  terraform {
18
18
  required_version = "{{ terraform_version }}"
19
19
  backend "s3" {
@@ -12,6 +12,7 @@ from dbt_platform_helper.commands.copilot import copilot as copilot_commands
12
12
  from dbt_platform_helper.commands.database import database as database_commands
13
13
  from dbt_platform_helper.commands.environment import environment as environment_commands
14
14
  from dbt_platform_helper.commands.generate import generate as generate_commands
15
+ from dbt_platform_helper.commands.internal import internal as internal_commands
15
16
  from dbt_platform_helper.commands.notify import notify as notify_commands
16
17
  from dbt_platform_helper.commands.pipeline import pipeline as pipeline_commands
17
18
  from dbt_platform_helper.commands.secrets import secrets as secrets_commands
@@ -36,6 +37,7 @@ platform_helper.add_command(config_commands)
36
37
  platform_helper.add_command(copilot_commands)
37
38
  platform_helper.add_command(environment_commands)
38
39
  platform_helper.add_command(generate_commands)
40
+ platform_helper.add_command(internal_commands)
39
41
  platform_helper.add_command(pipeline_commands)
40
42
  platform_helper.add_command(secrets_commands)
41
43
  platform_helper.add_command(service_commands)
@@ -3,7 +3,7 @@ line-length = 100
3
3
 
4
4
  [tool.poetry]
5
5
  name = "dbt-platform-helper"
6
- version = "15.8.0"
6
+ version = "15.10.0"
7
7
  description = "Set of tools to help transfer applications/services from GOV.UK PaaS to DBT PaaS augmenting AWS Copilot."
8
8
  authors = ["Department for Business and Trade Platform Team <sre-team@digital.trade.gov.uk>"]
9
9
  license = "MIT"
@@ -21,31 +21,22 @@ platform-helper = "platform_helper:platform_helper"
21
21
 
22
22
  [tool.poetry.dependencies]
23
23
  Jinja2 = "3.1.6"
24
- PyYAML = "6.0.2"
25
24
  yamllint = "^1.35.1"
26
25
  boto3 = "^1.35.2"
27
- boto3-stubs = "^1.26.148"
28
26
  botocore = "^1.34.85"
29
27
  click = "^8.1.3"
30
- mypy-boto3-codebuild = "^1.26.0.post1"
31
28
  python = ">3.9.1,<4.0"
32
29
  schema = "0.7.5"
33
- cfn-flip = "1.3.0"
34
- aiohttp = "^3.11.16"
35
- certifi = ">=2023.7.22,<2025.0.0"
36
- cryptography = ">=44.0.1, <45"
37
- jinja2-simple-tags = "^0.5.0"
30
+ jinja2-simple-tags = ">=0.5,<0.7"
38
31
  requests = "^2.31.0"
39
32
  prettytable = "^3.9.0"
40
- semver = "^3.0.2"
41
- tomlkit = ">=0.12.2,<0.14.0"
42
33
  slack-sdk = "^3.27.1"
43
- jsonschema = "~=4.17.0"
44
- cfn-lint = "^1.4.2"
45
34
  psycopg2-binary = "^2.9.9"
46
- checkov = "^3.2.405"
35
+ pydantic = "^2.11.7"
36
+ cfn-flip = "^1.3.0"
47
37
 
48
38
  [tool.poetry.group.dev.dependencies]
39
+ checkov = "^3.2.405"
49
40
  moto = {extras = ["all"], version = "^5.0.28"}
50
41
  pyfakefs = "^5.2.2"
51
42
  pytest = "^8.3.5"
@@ -56,6 +47,10 @@ freezegun = "^1.2.2"
56
47
  parameterized = "^0.9.0"
57
48
  pytest-xdist = "^3.5.0"
58
49
  pytest-cov = "^6.0.0"
50
+ mypy-boto3-codebuild = "^1.40.8"
51
+
52
+ python-hcl2 = "^7.3.1"
53
+ boto3-stubs = "^1.26.148"
59
54
 
60
55
  [build-system]
61
56
  requires = ["poetry-core"]