dbt-platform-helper 11.1.0__tar.gz → 11.2.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 (106) hide show
  1. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/PKG-INFO +1 -1
  2. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/COMMANDS.md +23 -1
  3. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/commands/pipeline.py +103 -12
  4. dbt_platform_helper-11.2.0/dbt_platform_helper/templates/environment-pipelines/main.tf +52 -0
  5. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/pyproject.toml +1 -1
  6. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/LICENSE +0 -0
  7. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/README.md +0 -0
  8. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/__init__.py +0 -0
  9. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/addon-plans.yml +0 -0
  10. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/addons-template-map.yml +0 -0
  11. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/commands/__init__.py +0 -0
  12. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/commands/application.py +0 -0
  13. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/commands/check_cloudformation.py +0 -0
  14. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/commands/codebase.py +0 -0
  15. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/commands/conduit.py +0 -0
  16. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/commands/config.py +0 -0
  17. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/commands/copilot.py +0 -0
  18. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/commands/database.py +0 -0
  19. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/commands/dns.py +0 -0
  20. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/commands/environment.py +0 -0
  21. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/commands/generate.py +0 -0
  22. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/commands/notify.py +0 -0
  23. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/commands/secrets.py +0 -0
  24. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/commands/version.py +0 -0
  25. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/constants.py +0 -0
  26. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/custom_resources/__init__.py +0 -0
  27. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/custom_resources/s3_object.py +0 -0
  28. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/default-extensions.yml +0 -0
  29. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/domain/__init__.py +0 -0
  30. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/domain/database_copy.py +0 -0
  31. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/domain/maintenance_page.py +0 -0
  32. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/exceptions.py +0 -0
  33. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/jinja2_tags.py +0 -0
  34. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/providers/load_balancers.py +0 -0
  35. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/.copilot/config.yml +0 -0
  36. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/.copilot/image_build_run.sh +0 -0
  37. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/.copilot/phases/build.sh +0 -0
  38. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/.copilot/phases/install.sh +0 -0
  39. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/.copilot/phases/post_build.sh +0 -0
  40. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/.copilot/phases/pre_build.sh +0 -0
  41. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/COMMANDS.md.jinja +0 -0
  42. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/addon-instructions.txt +0 -0
  43. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/addons/README.md +0 -0
  44. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/addons/env/addons.parameters.yml +0 -0
  45. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/addons/env/aurora-postgres.yml +0 -0
  46. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/addons/env/monitoring.yml +0 -0
  47. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/addons/env/opensearch.yml +0 -0
  48. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/addons/env/rds-postgres.yml +0 -0
  49. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/addons/env/redis-cluster.yml +0 -0
  50. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/addons/env/s3.yml +0 -0
  51. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/addons/env/vpc.yml +0 -0
  52. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/addons/svc/appconfig-ipfilter.yml +0 -0
  53. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/addons/svc/prometheus-policy.yml +0 -0
  54. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/addons/svc/s3-policy.yml +0 -0
  55. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/addons/svc/subscription-filter.yml +0 -0
  56. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/ci-codebuild-role-policy.json +0 -0
  57. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/create-codebuild-role.json +0 -0
  58. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/custom-codebuild-role-policy.json +0 -0
  59. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/env/manifest.yml +0 -0
  60. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/env/overrides/.gitignore +0 -0
  61. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/env/overrides/README.md +0 -0
  62. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/env/overrides/bin/override.ts +0 -0
  63. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/env/overrides/cdk.json +0 -0
  64. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/env/overrides/log_resource_policy.json +0 -0
  65. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/env/overrides/package-lock.json +0 -0
  66. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/env/overrides/package.json +0 -0
  67. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/env/overrides/stack.ts +0 -0
  68. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/env/overrides/tsconfig.json +0 -0
  69. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/env/terraform-overrides/cfn.patches.yml +0 -0
  70. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/environments/main.tf +0 -0
  71. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/pipelines/codebase/manifest.yml +0 -0
  72. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/.gitignore +0 -0
  73. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/bin/override.ts +0 -0
  74. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/buildspec.deploy.yml +0 -0
  75. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/buildspec.image.yml +0 -0
  76. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/cdk.json +0 -0
  77. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/package-lock.json +0 -0
  78. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/package.json +0 -0
  79. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/stack.ts +0 -0
  80. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/tsconfig.json +0 -0
  81. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/pipelines/codebase/overrides/types.ts +0 -0
  82. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/pipelines/environments/buildspec.yml +0 -0
  83. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/pipelines/environments/manifest.yml +0 -0
  84. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/pipelines/environments/overrides/cfn.patches.yml +0 -0
  85. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/svc/maintenance_pages/default.html +0 -0
  86. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/svc/maintenance_pages/dmas-migration.html +0 -0
  87. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/svc/maintenance_pages/migration.html +0 -0
  88. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/svc/manifest-backend.yml +0 -0
  89. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/svc/manifest-public.yml +0 -0
  90. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/templates/svc/overrides/cfn.patches.yml +0 -0
  91. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/utils/__init__.py +0 -0
  92. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/utils/application.py +0 -0
  93. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/utils/arn_parser.py +0 -0
  94. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/utils/aws.py +0 -0
  95. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/utils/click.py +0 -0
  96. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/utils/cloudformation.py +0 -0
  97. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/utils/cloudfoundry.py +0 -0
  98. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/utils/files.py +0 -0
  99. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/utils/git.py +0 -0
  100. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/utils/manifests.py +0 -0
  101. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/utils/messages.py +0 -0
  102. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/utils/platform_config.py +0 -0
  103. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/utils/template.py +0 -0
  104. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/utils/validation.py +0 -0
  105. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/dbt_platform_helper/utils/versioning.py +0 -0
  106. {dbt_platform_helper-11.1.0 → dbt_platform_helper-11.2.0}/platform_helper.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbt-platform-helper
3
- Version: 11.1.0
3
+ Version: 11.2.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
6
  Author: Department for Business and Trade Platform Team
@@ -793,14 +793,36 @@ platform-helper pipeline generate
793
793
  Given a platform-config.yml file, generate environment and service
794
794
  deployment pipelines.
795
795
 
796
+ This command does the following in relation to the environment pipelines:
797
+ - Reads contents of `platform-config.yml/environment-pipelines` configuration.
798
+ The `terraform/environment-pipelines/<aws_account>/main.tf` file is generated using this configuration.
799
+ The `main.tf` file is then used to generate Terraform for creating an environment pipeline resource.
800
+
801
+ This command does the following in relation to the codebase pipelines:
802
+ - Generates the copilot pipeline manifest.yml for copilot/pipelines/<codebase_pipeline_name>
803
+
804
+ (Deprecated) This command does the following for non terraform projects (legacy AWS Copilot):
805
+ - Generates the copilot manifest.yml for copilot/environments/<environment>
806
+
796
807
  ## Usage
797
808
 
798
809
  ```
799
- platform-helper pipeline generate
810
+ platform-helper pipeline generate [--terraform-platform-modules-version <terraform_platform_modules_version>]
811
+ [--deploy-branch <deploy_branch>]
800
812
  ```
801
813
 
802
814
  ## Options
803
815
 
816
+ - `--terraform-platform-modules-version <text>`
817
+ - Override the default version of terraform-platform-modules with a specific version or branch.
818
+ Precedence of version used is version supplied via CLI, then the version found in
819
+ platform-config.yml/default_versions/terraform-platform-modules.
820
+ In absence of these inputs, defaults to version '5'.
821
+ - `--deploy-branch <text>`
822
+ - Specify the branch of <application>-deploy used to configure the source stage in the environment-pipeline resource.
823
+ This is generated from the terraform/environments-pipeline/<aws_account>/main.tf file.
824
+ (Default <application>-deploy branch is specified in
825
+ <application>-deploy/platform-config.yml/environment_pipelines/<environment-pipeline>/branch).
804
826
  - `--help <boolean>` _Defaults to False._
805
827
  - Show this message and exit.
806
828
 
@@ -5,6 +5,7 @@ from shutil import rmtree
5
5
 
6
6
  import click
7
7
 
8
+ from dbt_platform_helper.constants import DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION
8
9
  from dbt_platform_helper.utils.application import get_application_name
9
10
  from dbt_platform_helper.utils.aws import get_account_details
10
11
  from dbt_platform_helper.utils.aws import get_codestar_connection_arn
@@ -24,6 +25,7 @@ from dbt_platform_helper.utils.versioning import (
24
25
 
25
26
  CODEBASE_PIPELINES_KEY = "codebase_pipelines"
26
27
  ENVIRONMENTS_KEY = "environments"
28
+ ENVIRONMENT_PIPELINES_KEY = "environment_pipelines"
27
29
 
28
30
 
29
31
  @click.group(chain=True, cls=ClickDocOptGroup)
@@ -33,18 +35,55 @@ def pipeline():
33
35
 
34
36
 
35
37
  @pipeline.command()
36
- def generate():
37
- """Given a platform-config.yml file, generate environment and service
38
- deployment pipelines."""
38
+ @click.option(
39
+ "--terraform-platform-modules-version",
40
+ help=f"""Override the default version of terraform-platform-modules with a specific version or branch.
41
+ Precedence of version used is version supplied via CLI, then the version found in
42
+ platform-config.yml/default_versions/terraform-platform-modules.
43
+ In absence of these inputs, defaults to version '{DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION}'.""",
44
+ )
45
+ @click.option(
46
+ "--deploy-branch",
47
+ help="""Specify the branch of <application>-deploy used to configure the source stage in the environment-pipeline resource.
48
+ This is generated from the terraform/environments-pipeline/<aws_account>/main.tf file.
49
+ (Default <application>-deploy branch is specified in
50
+ <application>-deploy/platform-config.yml/environment_pipelines/<environment-pipeline>/branch).""",
51
+ default=None,
52
+ )
53
+ def generate(terraform_platform_modules_version, deploy_branch):
54
+ """
55
+ Given a platform-config.yml file, generate environment and service
56
+ deployment pipelines.
57
+
58
+ This command does the following in relation to the environment pipelines:
59
+ - Reads contents of `platform-config.yml/environment-pipelines` configuration.
60
+ The `terraform/environment-pipelines/<aws_account>/main.tf` file is generated using this configuration.
61
+ The `main.tf` file is then used to generate Terraform for creating an environment pipeline resource.
62
+
63
+ This command does the following in relation to the codebase pipelines:
64
+ - Generates the copilot pipeline manifest.yml for copilot/pipelines/<codebase_pipeline_name>
65
+
66
+ (Deprecated) This command does the following for non terraform projects (legacy AWS Copilot):
67
+ - Generates the copilot manifest.yml for copilot/environments/<environment>
68
+ """
39
69
  pipeline_config = load_and_validate_platform_config()
40
70
 
41
- no_codebase_pipelines = CODEBASE_PIPELINES_KEY not in pipeline_config
42
- no_environment_pipelines = ENVIRONMENTS_KEY not in pipeline_config
71
+ has_codebase_pipelines = CODEBASE_PIPELINES_KEY in pipeline_config
72
+ has_legacy_environment_pipelines = ENVIRONMENTS_KEY in pipeline_config
73
+ has_environment_pipelines = ENVIRONMENT_PIPELINES_KEY in pipeline_config
43
74
 
44
- if no_codebase_pipelines and no_environment_pipelines:
75
+ if (
76
+ not has_codebase_pipelines
77
+ and not has_legacy_environment_pipelines
78
+ and not has_environment_pipelines
79
+ ):
45
80
  click.secho("No pipelines defined: nothing to do.", err=True, fg="yellow")
46
81
  return
47
82
 
83
+ platform_config_terraform_modules_default_version = pipeline_config.get(
84
+ "default_versions", {}
85
+ ).get("terraform-platform-modules", "")
86
+
48
87
  templates = setup_templates()
49
88
  app_name = get_application_name()
50
89
 
@@ -57,22 +96,34 @@ def generate():
57
96
  abort_with_error(f'There is no CodeStar Connection named "{app_name}" to use')
58
97
 
59
98
  base_path = Path(".")
60
- pipelines_dir = base_path / f"copilot/pipelines"
99
+ copilot_pipelines_dir = base_path / f"copilot/pipelines"
61
100
 
62
- _clean_pipeline_config(pipelines_dir)
101
+ _clean_pipeline_config(copilot_pipelines_dir)
63
102
 
64
- if not is_terraform_project() and ENVIRONMENTS_KEY in pipeline_config:
103
+ if is_terraform_project() and has_environment_pipelines:
104
+ environment_pipelines = pipeline_config[ENVIRONMENT_PIPELINES_KEY]
105
+
106
+ for config in environment_pipelines.values():
107
+ aws_account = config.get("account")
108
+ _generate_terraform_environment_pipeline_manifest(
109
+ pipeline_config["application"],
110
+ aws_account,
111
+ terraform_platform_modules_version,
112
+ platform_config_terraform_modules_default_version,
113
+ deploy_branch,
114
+ )
115
+ if not is_terraform_project() and has_legacy_environment_pipelines:
65
116
  _generate_copilot_environments_pipeline(
66
117
  app_name,
67
118
  codestar_connection_arn,
68
119
  git_repo,
69
120
  apply_environment_defaults(pipeline_config)[ENVIRONMENTS_KEY],
70
121
  base_path,
71
- pipelines_dir,
122
+ copilot_pipelines_dir,
72
123
  templates,
73
124
  )
74
125
 
75
- if CODEBASE_PIPELINES_KEY in pipeline_config:
126
+ if has_codebase_pipelines:
76
127
  account_id, _ = get_account_details()
77
128
 
78
129
  for codebase in pipeline_config[CODEBASE_PIPELINES_KEY]:
@@ -83,7 +134,7 @@ def generate():
83
134
  git_repo,
84
135
  codebase,
85
136
  base_path,
86
- pipelines_dir,
137
+ copilot_pipelines_dir,
87
138
  templates,
88
139
  )
89
140
 
@@ -170,3 +221,43 @@ def _create_file_from_template(
170
221
  ).render(template_data)
171
222
  message = mkfile(base_path, pipelines_dir / file_name, contents, overwrite=True)
172
223
  click.echo(message)
224
+
225
+
226
+ def _generate_terraform_environment_pipeline_manifest(
227
+ application,
228
+ aws_account,
229
+ cli_terraform_platform_modules_version,
230
+ platform_config_terraform_modules_default_version,
231
+ deploy_branch,
232
+ ):
233
+ env_pipeline_template = setup_templates().get_template("environment-pipelines/main.tf")
234
+
235
+ terraform_platform_modules_version = _determine_terraform_platform_modules_version(
236
+ cli_terraform_platform_modules_version, platform_config_terraform_modules_default_version
237
+ )
238
+
239
+ contents = env_pipeline_template.render(
240
+ {
241
+ "application": application,
242
+ "aws_account": aws_account,
243
+ "terraform_platform_modules_version": terraform_platform_modules_version,
244
+ "deploy_branch": deploy_branch,
245
+ }
246
+ )
247
+
248
+ dir_path = f"terraform/environment-pipelines/{aws_account}"
249
+ makedirs(dir_path, exist_ok=True)
250
+
251
+ click.echo(mkfile(".", f"{dir_path}/main.tf", contents, overwrite=True))
252
+
253
+
254
+ def _determine_terraform_platform_modules_version(
255
+ cli_terraform_platform_modules_version, platform_config_terraform_modules_default_version
256
+ ):
257
+
258
+ version_preference_order = [
259
+ cli_terraform_platform_modules_version,
260
+ platform_config_terraform_modules_default_version,
261
+ DEFAULT_TERRAFORM_PLATFORM_MODULES_VERSION,
262
+ ]
263
+ return [version for version in version_preference_order if version][0]
@@ -0,0 +1,52 @@
1
+ # {% extra_header %}
2
+ # {% version_info %}
3
+ locals {
4
+ platform_config = yamldecode(file("../../../platform-config.yml"))
5
+ all_pipelines = local.platform_config["environment_pipelines"]
6
+ pipelines = { for pipeline, config in local.platform_config["environment_pipelines"] : pipeline => config if config.account == "{{ aws_account }}" }
7
+ environment_config = local.platform_config["environments"]
8
+ }
9
+
10
+ provider "aws" {
11
+ region = "eu-west-2"
12
+ profile = "{{ aws_account }}"
13
+ alias = "{{ aws_account }}"
14
+ shared_credentials_files = ["~/.aws/config"]
15
+ }
16
+
17
+ terraform {
18
+ required_version = "~> 1.8"
19
+ backend "s3" {
20
+ bucket = "terraform-platform-state-{{ aws_account }}"
21
+ key = "tfstate/application/{{ application }}-pipelines.tfstate"
22
+ region = "eu-west-2"
23
+ encrypt = true
24
+ kms_key_id = "alias/terraform-platform-state-s3-key-{{ aws_account }}"
25
+ dynamodb_table = "terraform-platform-lockdb-{{ aws_account }}"
26
+ }
27
+ required_providers {
28
+ aws = {
29
+ source = "hashicorp/aws"
30
+ version = "~> 5"
31
+ }
32
+ }
33
+ }
34
+
35
+
36
+ module "environment-pipelines" {
37
+ source = "git::https://github.com/uktrade/terraform-platform-modules.git//environment-pipelines?depth=1&ref={{ terraform_platform_modules_version }}"
38
+
39
+ for_each = local.pipelines
40
+
41
+ application = "{{ application }}"
42
+ pipeline_name = each.key
43
+ repository = "uktrade/{{ application }}-deploy"
44
+
45
+ environments = each.value.environments
46
+ all_pipelines = local.all_pipelines
47
+ environment_config = local.environment_config
48
+ branch = {% if deploy_branch %}"{{ deploy_branch }}"{% else %}each.value.branch{% endif %}
49
+ slack_channel = each.value.slack_channel
50
+ trigger_on_push = each.value.trigger_on_push
51
+ pipeline_to_trigger = lookup(each.value, "pipeline_to_trigger", null)
52
+ }
@@ -3,7 +3,7 @@ line-length = 100
3
3
 
4
4
  [tool.poetry]
5
5
  name = "dbt-platform-helper"
6
- version = "11.1.0"
6
+ version = "11.2.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"