dbt-platform-helper 11.3.0__py3-none-any.whl → 12.0.0__py3-none-any.whl

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 (33) hide show
  1. dbt_platform_helper/COMMANDS.md +3 -252
  2. dbt_platform_helper/addons-template-map.yml +7 -33
  3. dbt_platform_helper/commands/application.py +8 -7
  4. dbt_platform_helper/commands/conduit.py +1 -4
  5. dbt_platform_helper/commands/copilot.py +14 -110
  6. dbt_platform_helper/commands/environment.py +0 -5
  7. dbt_platform_helper/commands/pipeline.py +1 -13
  8. dbt_platform_helper/domain/database_copy.py +2 -2
  9. dbt_platform_helper/domain/maintenance_page.py +0 -3
  10. dbt_platform_helper/templates/addon-instructions.txt +1 -1
  11. dbt_platform_helper/templates/addons/svc/s3-policy.yml +0 -8
  12. dbt_platform_helper/utils/aws.py +3 -1
  13. dbt_platform_helper/utils/platform_config.py +2 -7
  14. dbt_platform_helper/utils/validation.py +3 -78
  15. {dbt_platform_helper-11.3.0.dist-info → dbt_platform_helper-12.0.0.dist-info}/METADATA +1 -1
  16. {dbt_platform_helper-11.3.0.dist-info → dbt_platform_helper-12.0.0.dist-info}/RECORD +20 -33
  17. platform_helper.py +0 -8
  18. dbt_platform_helper/commands/check_cloudformation.py +0 -87
  19. dbt_platform_helper/commands/dns.py +0 -952
  20. dbt_platform_helper/custom_resources/__init__.py +0 -0
  21. dbt_platform_helper/custom_resources/s3_object.py +0 -85
  22. dbt_platform_helper/templates/addons/env/addons.parameters.yml +0 -19
  23. dbt_platform_helper/templates/addons/env/aurora-postgres.yml +0 -604
  24. dbt_platform_helper/templates/addons/env/monitoring.yml +0 -121
  25. dbt_platform_helper/templates/addons/env/opensearch.yml +0 -257
  26. dbt_platform_helper/templates/addons/env/rds-postgres.yml +0 -603
  27. dbt_platform_helper/templates/addons/env/redis-cluster.yml +0 -171
  28. dbt_platform_helper/templates/addons/env/s3.yml +0 -219
  29. dbt_platform_helper/templates/addons/env/vpc.yml +0 -120
  30. dbt_platform_helper/utils/cloudformation.py +0 -34
  31. {dbt_platform_helper-11.3.0.dist-info → dbt_platform_helper-12.0.0.dist-info}/LICENSE +0 -0
  32. {dbt_platform_helper-11.3.0.dist-info → dbt_platform_helper-12.0.0.dist-info}/WHEEL +0 -0
  33. {dbt_platform_helper-11.3.0.dist-info → dbt_platform_helper-12.0.0.dist-info}/entry_points.txt +0 -0
@@ -11,12 +11,10 @@ from dbt_platform_helper.utils.aws import get_account_details
11
11
  from dbt_platform_helper.utils.aws import get_codestar_connection_arn
12
12
  from dbt_platform_helper.utils.aws import get_public_repository_arn
13
13
  from dbt_platform_helper.utils.click import ClickDocOptGroup
14
- from dbt_platform_helper.utils.files import apply_environment_defaults
15
14
  from dbt_platform_helper.utils.files import generate_override_files_from_template
16
15
  from dbt_platform_helper.utils.files import mkfile
17
16
  from dbt_platform_helper.utils.git import git_remote
18
17
  from dbt_platform_helper.utils.messages import abort_with_error
19
- from dbt_platform_helper.utils.platform_config import is_terraform_project
20
18
  from dbt_platform_helper.utils.template import setup_templates
21
19
  from dbt_platform_helper.utils.validation import load_and_validate_platform_config
22
20
  from dbt_platform_helper.utils.versioning import (
@@ -100,7 +98,7 @@ def generate(terraform_platform_modules_version, deploy_branch):
100
98
 
101
99
  _clean_pipeline_config(copilot_pipelines_dir)
102
100
 
103
- if is_terraform_project() and has_environment_pipelines:
101
+ if has_environment_pipelines:
104
102
  environment_pipelines = pipeline_config[ENVIRONMENT_PIPELINES_KEY]
105
103
 
106
104
  for config in environment_pipelines.values():
@@ -112,16 +110,6 @@ def generate(terraform_platform_modules_version, deploy_branch):
112
110
  platform_config_terraform_modules_default_version,
113
111
  deploy_branch,
114
112
  )
115
- if not is_terraform_project() and has_legacy_environment_pipelines:
116
- _generate_copilot_environments_pipeline(
117
- app_name,
118
- codestar_connection_arn,
119
- git_repo,
120
- apply_environment_defaults(pipeline_config)[ENVIRONMENTS_KEY],
121
- base_path,
122
- copilot_pipelines_dir,
123
- templates,
124
- )
125
113
 
126
114
  if has_codebase_pipelines:
127
115
  account_id, _ = get_account_details()
@@ -51,7 +51,7 @@ class DatabaseCopy:
51
51
  if not Path(PLATFORM_CONFIG_FILE).exists():
52
52
  self.abort_fn("You must either be in a deploy repo, or provide the --app option.")
53
53
 
54
- config = load_and_validate_platform_config(disable_aws_validation=True)
54
+ config = load_and_validate_platform_config()
55
55
  self.app = config["application"]
56
56
 
57
57
  try:
@@ -110,7 +110,7 @@ class DatabaseCopy:
110
110
  self.abort_fn(
111
111
  "You must either be in a deploy repo, or provide the vpc name option."
112
112
  )
113
- config = load_and_validate_platform_config(disable_aws_validation=True)
113
+ config = load_and_validate_platform_config()
114
114
  vpc_name = config.get("environments", {}).get(env, {}).get("vpc")
115
115
  return vpc_name
116
116
 
@@ -172,9 +172,6 @@ def remove_maintenance_page(session: boto3.Session, listener_arn: str):
172
172
  lb_client = session.client("elbv2")
173
173
 
174
174
  rules = lb_client.describe_rules(ListenerArn=listener_arn)["Rules"]
175
- # TODO: The next line doesn't appear to do anything.
176
- tag_descriptions = get_rules_tag_descriptions(rules, lb_client)
177
- # TODO: In fact the following line seems to do the same but better.
178
175
  tag_descriptions = lb_client.describe_tags(ResourceArns=[r["RuleArn"] for r in rules])[
179
176
  "TagDescriptions"
180
177
  ]
@@ -5,7 +5,7 @@ Secret references:
5
5
  REDIS_ENDPOINT: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/{{ service.secret_name }}
6
6
  {%- elif service.addon_type == "opensearch" %}
7
7
  OPENSEARCH_CREDENTIALS: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/{{ service.secret_name }}
8
- {%- elif service.addon_type in ["aurora-postgres", "postgres"] %}
8
+ {%- elif service.addon_type == "postgres" %}
9
9
  DATABASE_CREDENTIALS:
10
10
  secretsmanager: /copilot/${COPILOT_APPLICATION_NAME}/${COPILOT_ENVIRONMENT_NAME}/secrets/{{ service.secret_name }}
11
11
  {%- endif -%}
@@ -24,9 +24,7 @@ Mappings:
24
24
  {% for env_name, config in addon_config.environments.items() %}
25
25
  {{ env_name }}:
26
26
  BucketName: '{{ config.bucket_name }}'
27
- {% if is_terraform %}
28
27
  KmsKeyArn: '{{ config.kms_key_arn }}'
29
- {% endif %}
30
28
  {% endfor %}
31
29
 
32
30
  Resources:
@@ -44,13 +42,7 @@ Resources:
44
42
  Action:
45
43
  - kms:Decrypt
46
44
  - kms:GenerateDataKey
47
- {% if is_terraform %}
48
45
  Resource: !FindInMap [{{ addon_config.prefix }}EnvironmentConfigMap, !Ref Env, KmsKeyArn]
49
- {% else %}
50
- Resource:
51
- Fn::ImportValue:
52
- !Sub "${App}-${Env}-{{ addon_config.kms_key_reference }}-KMSKeyARN"
53
- {% endif %}
54
46
  - Sid: S3ObjectActions
55
47
  Effect: Allow
56
48
  Action:
@@ -97,7 +97,9 @@ def get_profile_name_from_account_id(account_id: str):
97
97
  aws_config = ConfigParser()
98
98
  aws_config.read(Path.home().joinpath(".aws/config"))
99
99
  for section in aws_config.sections():
100
- found_account_id = aws_config[section].get("sso_account_id", None)
100
+ found_account_id = aws_config[section].get(
101
+ "sso_account_id", aws_config[section].get("profile_account_id", None)
102
+ )
101
103
  if account_id == found_account_id:
102
104
  return section.removeprefix("profile ")
103
105
 
@@ -1,7 +1,7 @@
1
- import yaml
2
-
3
1
  from pathlib import Path
4
2
 
3
+ import yaml
4
+
5
5
  from dbt_platform_helper.constants import PLATFORM_CONFIG_FILE
6
6
 
7
7
 
@@ -25,8 +25,3 @@ def get_environment_pipeline_names():
25
25
  if pipelines_config:
26
26
  return pipelines_config.keys()
27
27
  return {}
28
-
29
-
30
- def is_terraform_project() -> bool:
31
- config = yaml.safe_load(Path(PLATFORM_CONFIG_FILE).read_text())
32
- return not config.get("legacy_project", False)
@@ -5,7 +5,6 @@ from pathlib import Path
5
5
 
6
6
  import click
7
7
  import yaml
8
- from botocore.exceptions import ClientError
9
8
  from schema import Optional
10
9
  from schema import Or
11
10
  from schema import Regex
@@ -19,7 +18,6 @@ from dbt_platform_helper.constants import CODEBASE_PIPELINES_KEY
19
18
  from dbt_platform_helper.constants import ENVIRONMENTS_KEY
20
19
  from dbt_platform_helper.constants import PLATFORM_CONFIG_FILE
21
20
  from dbt_platform_helper.constants import PLATFORM_HELPER_VERSION_FILE
22
- from dbt_platform_helper.utils.aws import get_aws_session_or_abort
23
21
  from dbt_platform_helper.utils.files import apply_environment_defaults
24
22
  from dbt_platform_helper.utils.messages import abort_with_error
25
23
 
@@ -42,33 +40,6 @@ AVAILABILITY_UNCERTAIN_TEMPLATE = (
42
40
  BUCKET_NAME_IN_USE_TEMPLATE = "Warning: Bucket name '{}' is already in use. Check your AWS accounts to see if this is a problem."
43
41
 
44
42
 
45
- def warn_on_s3_bucket_name_availability(name: str):
46
- """
47
- We try to find the bucket name in AWS.
48
-
49
- The validation logic is:
50
- True: if the response is a 200 (it exists and you have access - this bucket has probably already been deployed)
51
- True: if the response is a 404 (it could not be found)
52
- False: if the response is 40x (the bucket exists but you have no permission)
53
- """
54
- session = get_aws_session_or_abort()
55
- client = session.client("s3")
56
- try:
57
- client.head_bucket(Bucket=name)
58
- return
59
- except ClientError as ex:
60
- if "Error" not in ex.response or not "Code" in ex.response["Error"]:
61
- click.secho(AVAILABILITY_UNCERTAIN_TEMPLATE.format(name), fg="yellow")
62
- return
63
- if ex.response["Error"]["Code"] == "404":
64
- return
65
- if int(ex.response["Error"]["Code"]) > 499:
66
- click.secho(AVAILABILITY_UNCERTAIN_TEMPLATE.format(name), fg="yellow")
67
- return
68
-
69
- click.secho(BUCKET_NAME_IN_USE_TEMPLATE.format(name), fg="yellow")
70
-
71
-
72
43
  def validate_s3_bucket_name(name: str):
73
44
  errors = []
74
45
  if not (2 < len(name) < 64):
@@ -127,8 +98,6 @@ def validate_addons(addons: dict):
127
98
  except SchemaError as ex:
128
99
  errors[addon_name] = f"Error in {addon_name}: {ex.code}"
129
100
 
130
- _validate_s3_bucket_uniqueness({"extensions": addons})
131
-
132
101
  return errors
133
102
 
134
103
 
@@ -254,27 +223,6 @@ POSTGRES_DEFINITION = {
254
223
  ],
255
224
  }
256
225
 
257
- AURORA_DEFINITION = {
258
- "type": "aurora-postgres",
259
- "version": NUMBER,
260
- Optional("deletion_policy"): DB_DELETION_POLICY,
261
- Optional("environments"): {
262
- ENV_NAME: {
263
- Optional("min_capacity"): float_between_with_halfstep(0.5, 128),
264
- Optional("max_capacity"): float_between_with_halfstep(0.5, 128),
265
- Optional("snapshot_id"): str,
266
- Optional("deletion_policy"): DB_DELETION_POLICY,
267
- Optional("deletion_protection"): DELETION_PROTECTION,
268
- }
269
- },
270
- Optional("objects"): [
271
- {
272
- "key": str,
273
- Optional("body"): str,
274
- }
275
- ],
276
- }
277
-
278
226
  LIFECYCLE_RULE = {
279
227
  Optional("filter_prefix"): str,
280
228
  "expiration_days": int,
@@ -519,7 +467,6 @@ PLATFORM_CONFIG_SCHEMA = Schema(
519
467
  Optional("extensions"): {
520
468
  str: Or(
521
469
  REDIS_DEFINITION,
522
- AURORA_DEFINITION,
523
470
  POSTGRES_DEFINITION,
524
471
  S3_DEFINITION,
525
472
  S3_POLICY_DEFINITION,
@@ -534,31 +481,13 @@ PLATFORM_CONFIG_SCHEMA = Schema(
534
481
  )
535
482
 
536
483
 
537
- def _validate_s3_bucket_uniqueness(enriched_config):
538
- extensions = enriched_config.get("extensions", {})
539
- bucket_extensions = [
540
- s3_ext
541
- for s3_ext in extensions.values()
542
- if "type" in s3_ext and s3_ext["type"] in ("s3", "s3-policy")
543
- ]
544
- environments = [
545
- env for ext in bucket_extensions for env in ext.get("environments", {}).values()
546
- ]
547
- bucket_names = [env.get("bucket_name") for env in environments]
548
-
549
- for name in bucket_names:
550
- warn_on_s3_bucket_name_availability(name)
551
-
552
-
553
- def validate_platform_config(config, disable_aws_validation=False):
484
+ def validate_platform_config(config):
554
485
  PLATFORM_CONFIG_SCHEMA.validate(config)
555
486
  enriched_config = apply_environment_defaults(config)
556
487
  _validate_environment_pipelines(enriched_config)
557
488
  _validate_environment_pipelines_triggers(enriched_config)
558
489
  _validate_codebase_pipelines(enriched_config)
559
490
  validate_database_copy_section(enriched_config)
560
- if not disable_aws_validation:
561
- _validate_s3_bucket_uniqueness(enriched_config)
562
491
 
563
492
 
564
493
  def validate_database_copy_section(config):
@@ -700,9 +629,7 @@ rules:
700
629
  return parsed_results
701
630
 
702
631
 
703
- def load_and_validate_platform_config(
704
- path=PLATFORM_CONFIG_FILE, disable_aws_validation=False, disable_file_check=False
705
- ):
632
+ def load_and_validate_platform_config(path=PLATFORM_CONFIG_FILE, disable_file_check=False):
706
633
  if not disable_file_check:
707
634
  config_file_check(path)
708
635
  try:
@@ -714,7 +641,7 @@ def load_and_validate_platform_config(
714
641
  + os.linesep
715
642
  + os.linesep.join(duplicate_keys)
716
643
  )
717
- validate_platform_config(conf, disable_aws_validation)
644
+ validate_platform_config(conf)
718
645
  return conf
719
646
  except ParserError:
720
647
  abort_with_error(f"{PLATFORM_CONFIG_FILE} is not valid YAML")
@@ -763,7 +690,6 @@ def config_file_check(path=PLATFORM_CONFIG_FILE):
763
690
 
764
691
  S3_SCHEMA = Schema(S3_DEFINITION)
765
692
  S3_POLICY_SCHEMA = Schema(S3_POLICY_DEFINITION)
766
- AURORA_SCHEMA = Schema(AURORA_DEFINITION)
767
693
  POSTGRES_SCHEMA = Schema(POSTGRES_DEFINITION)
768
694
  REDIS_SCHEMA = Schema(REDIS_DEFINITION)
769
695
 
@@ -817,7 +743,6 @@ def no_param_schema(schema_type):
817
743
  SCHEMA_MAP = {
818
744
  "s3": S3_SCHEMA,
819
745
  "s3-policy": S3_POLICY_SCHEMA,
820
- "aurora-postgres": AURORA_SCHEMA,
821
746
  "postgres": POSTGRES_SCHEMA,
822
747
  "redis": REDIS_SCHEMA,
823
748
  "opensearch": OPENSEARCH_SCHEMA,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dbt-platform-helper
3
- Version: 11.3.0
3
+ Version: 12.0.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
@@ -1,30 +1,26 @@
1
- dbt_platform_helper/COMMANDS.md,sha256=e4_kYpZLidhQB18sYT7O1FQYDljicJvoWGhYz-1RkeY,27580
1
+ dbt_platform_helper/COMMANDS.md,sha256=UA9HrZHbWXLvLzZZHxfpdfjcIy8ZsHYQRgpZbhVd5Vk,21801
2
2
  dbt_platform_helper/README.md,sha256=B0qN2_u_ASqqgkGDWY2iwNGZt_9tUgMb9XqtaTuzYjw,1530
3
3
  dbt_platform_helper/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  dbt_platform_helper/addon-plans.yml,sha256=O46a_ODsGG9KXmQY_1XbSGqrpSaHSLDe-SdROzHx8Go,4545
5
- dbt_platform_helper/addons-template-map.yml,sha256=oG-kj-jTpU70LebW8uaYG2febcysdsIO_NaWks8OQhE,1426
5
+ dbt_platform_helper/addons-template-map.yml,sha256=kYv_ZoZGWNeNBCnR_9wSeLhJuWOTHx-vn7ub74MgGb4,546
6
6
  dbt_platform_helper/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- dbt_platform_helper/commands/application.py,sha256=1XTBfdZBDj1vOFkAWjTxxTNFtko4YB9Q0_tVdxavwAo,9957
8
- dbt_platform_helper/commands/check_cloudformation.py,sha256=aLif3yMHKuZO0uvdUjTH9FdRZNIpCqtWvE3aFQMozoc,3226
7
+ dbt_platform_helper/commands/application.py,sha256=idHLbEIJ3DH_7oL2_5ZID3BInLZjPYLSdFST0x7kvFE,10076
9
8
  dbt_platform_helper/commands/codebase.py,sha256=NchJzH-yxv5mXCe2rPyXVNHmXGEvjFUv0KhMKYsLNNQ,11380
10
- dbt_platform_helper/commands/conduit.py,sha256=BC2cxIX14e7_BEdvuMiq8z85k_4OWL-RwX0QJFJrUak,15436
9
+ dbt_platform_helper/commands/conduit.py,sha256=cuD1obH_daebnLIsouDJNlxKXVmVjYJ0d3XZudqy1JM,15291
11
10
  dbt_platform_helper/commands/config.py,sha256=NOHea7OAjrl6XHlW6HMLn0m0T5lFPyNH3HXoyCOWsJk,12070
12
- dbt_platform_helper/commands/copilot.py,sha256=euid0FTlVtwKmBQ6vxt_HxtBdRYiVQvb-9CyrK1-MWc,16724
11
+ dbt_platform_helper/commands/copilot.py,sha256=i7FLSF-p9P5JQ36e_V8THXxdXG_g1hI7fHxemxQG82A,12927
13
12
  dbt_platform_helper/commands/database.py,sha256=_HnuOxlfVIFGkDotGv0SGb6oWrnm517FSvLv0aGcLJQ,3542
14
- dbt_platform_helper/commands/dns.py,sha256=o7PkvHktZo0jmqbx0krJTL0R4GtWSf1rF2KDEWor8Ts,35211
15
- dbt_platform_helper/commands/environment.py,sha256=QrG2ewchP2D1BmG067QpO-rR77F9lbNn2oVlM_zVS-g,7953
13
+ dbt_platform_helper/commands/environment.py,sha256=3HALcatJMJ1-7WmHwnfazh6ulBlwtz0L7cfifDVVPtQ,7751
16
14
  dbt_platform_helper/commands/generate.py,sha256=YLCPb-xcPapGcsLn-7d1Am7BpGp5l0iecIDTOdNGjHk,722
17
15
  dbt_platform_helper/commands/notify.py,sha256=kVJ0s78QMiaEWPVKu_bbMko4DW2uJy2fu8-HNJsglyk,3748
18
- dbt_platform_helper/commands/pipeline.py,sha256=Rw7JTKDxF3sv1dv-8_o-ofq5YBW0Pf-q2e7dFqbhH5U,9993
16
+ dbt_platform_helper/commands/pipeline.py,sha256=_52bDSDa8DoyOA4VFxFJhwaiKCPHKqPtK2LWDLFaKlA,9452
19
17
  dbt_platform_helper/commands/secrets.py,sha256=2NtV5FGx-ErkMg2QMiDvFOp03cKVbLzgmY8Y504EKJw,3860
20
18
  dbt_platform_helper/commands/version.py,sha256=RcgOu04MzO5qohs8HLqFcGgwfel56rl_MV8cVNqaQYk,1572
21
19
  dbt_platform_helper/constants.py,sha256=fzN2VZt81mspNfdYpNef5_eEjDVsh8GUYmhBMTIfPvI,232
22
- dbt_platform_helper/custom_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
- dbt_platform_helper/custom_resources/s3_object.py,sha256=0mhLuKD0-vwuN1qmnLCrLo2qL58FvtCjNNjH34kac6Y,2526
24
20
  dbt_platform_helper/default-extensions.yml,sha256=SU1ZitskbuEBpvE7efc3s56eAUF11j70brhj_XrNMMo,493
25
21
  dbt_platform_helper/domain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
26
- dbt_platform_helper/domain/database_copy.py,sha256=OY7X5wmlb-s0kOn77X24-QWLD13ru27xi9_2gV-st2k,8586
27
- dbt_platform_helper/domain/maintenance_page.py,sha256=g9rYOeV7-AOMGJL9J8EdB--1xhl8pihOGDcbNK2IKV8,15729
22
+ dbt_platform_helper/domain/database_copy.py,sha256=OS4vcAjsn7x9NI8LdxrU2HjcERySFrwC50SSt2Pd9lQ,8532
23
+ dbt_platform_helper/domain/maintenance_page.py,sha256=qIaM4CXOefOwt-Nfjx_I66vSvwxMHKlcBuKaRRkcoDk,15532
28
24
  dbt_platform_helper/exceptions.py,sha256=dCQkqmlt5yycZgblwTtpkwGrP7ANQB_1MRORUWIYI-U,541
29
25
  dbt_platform_helper/jinja2_tags.py,sha256=jFyN_Sxmko1GSfvrqRIGQ80CCW8EwlCV3su0ahJPfoE,541
30
26
  dbt_platform_helper/providers/load_balancers.py,sha256=e1SPrWbBWq95paSVd3Y5yORIrHAZxcVabBYDjPyUTsU,1430
@@ -35,19 +31,11 @@ dbt_platform_helper/templates/.copilot/phases/install.sh,sha256=pNkEnZBnM4-n1MBz
35
31
  dbt_platform_helper/templates/.copilot/phases/post_build.sh,sha256=qdfaViaaPpnjHxI2Uap9DffM0OcV-FYXk7slT51b_vU,126
36
32
  dbt_platform_helper/templates/.copilot/phases/pre_build.sh,sha256=rzyjyf7Y7LHH7h-Vv_J--QaR7-dTS_5G-R4iE_9mpQI,836
37
33
  dbt_platform_helper/templates/COMMANDS.md.jinja,sha256=Chfpkr8MfrZg_Y2Oskwqk3uVw-KKOBdGjsts3-KGno8,1081
38
- dbt_platform_helper/templates/addon-instructions.txt,sha256=UBBfCp3mIOXB-gdc-CKB0uf8Vv6gYfZUENIFG-TVbYo,618
34
+ dbt_platform_helper/templates/addon-instructions.txt,sha256=Dhd1xDbFKnX7xjfCz0W52P6PqPI9M8dyoxoSHAY2fao,597
39
35
  dbt_platform_helper/templates/addons/README.md,sha256=UdVydY2ocm1OLKecZ8MAiXet3rKsMiq0PpBrmi0Xrns,412
40
- dbt_platform_helper/templates/addons/env/addons.parameters.yml,sha256=6zo0vtMz1HNlkcRA-B6HQSq35EmvGZbUege96r4Eqsw,755
41
- dbt_platform_helper/templates/addons/env/aurora-postgres.yml,sha256=El0jTaWqWy5CAn0vxnvFiHHxoVXs2nIHtqGrs8githg,26402
42
- dbt_platform_helper/templates/addons/env/monitoring.yml,sha256=ZjvKhrhg6hIoQ51n0jl94z5I8ue_XQp-sypsDVQLiwY,6085
43
- dbt_platform_helper/templates/addons/env/opensearch.yml,sha256=Ay0IAE8AWMEUjBRpMWyI4qLFmdwNkQwAN1ciTnuKb5c,10874
44
- dbt_platform_helper/templates/addons/env/rds-postgres.yml,sha256=uz7I9u8c-25ergwzNe1EQTT9TadlekeRyhgdpyNbCOo,25645
45
- dbt_platform_helper/templates/addons/env/redis-cluster.yml,sha256=lUqoNgomx5FzoAplRcqT1BDMeXHTXZ16Or5Xd0Sz2eg,7236
46
- dbt_platform_helper/templates/addons/env/s3.yml,sha256=E0ikzN7ztk61rPjUXoKbAujgWcm6MRiDfHzShflBQPA,7758
47
- dbt_platform_helper/templates/addons/env/vpc.yml,sha256=Bi-RDr58u-X5J6VHRUxSKDCJ0ddbY79gec6kB69sz8w,3679
48
36
  dbt_platform_helper/templates/addons/svc/appconfig-ipfilter.yml,sha256=nBIXV4um4jIvXs3Q5QycHqVpJODK5yg_M-xJT6AOBKE,977
49
37
  dbt_platform_helper/templates/addons/svc/prometheus-policy.yml,sha256=cxt0N_MVs-29IX213B6H64-5aWVQNDUR5UnYbLlhX2I,1032
50
- dbt_platform_helper/templates/addons/svc/s3-policy.yml,sha256=mqztPA_vB9ZaPLzTkkHsi9XsQmX8B89wn1kuMTZoKAM,2424
38
+ dbt_platform_helper/templates/addons/svc/s3-policy.yml,sha256=jwTpFNmm8CaP0c6VXXBJvEm_YLA17Nf-S1xyU1ahLJ8,2164
51
39
  dbt_platform_helper/templates/addons/svc/subscription-filter.yml,sha256=irD0AjPc38xTRzEday2Ko-KrjK4hPlyLxUFvUITjMkU,914
52
40
  dbt_platform_helper/templates/ci-codebuild-role-policy.json,sha256=hNE-wGrraWxsJAWE9ahtL7Bkw7PEz-CXBQnM3DR70vQ,1836
53
41
  dbt_platform_helper/templates/create-codebuild-role.json,sha256=THJgIKi8rWwDzhg5ZxT8a0UkXKBfXZ-zsXm8St_ixPg,197
@@ -88,21 +76,20 @@ dbt_platform_helper/templates/svc/overrides/cfn.patches.yml,sha256=W7-d017akuUq9
88
76
  dbt_platform_helper/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
89
77
  dbt_platform_helper/utils/application.py,sha256=FzEoyTUlRJ7bt01cZAg-JHRQM4CqosVLOojdfwaDl6w,4113
90
78
  dbt_platform_helper/utils/arn_parser.py,sha256=1jY0elpAe4YL3ulrrCf1YiKmjI-7YXz4gJASqkIFHTc,1294
91
- dbt_platform_helper/utils/aws.py,sha256=_NM76HOT2EvPwPe0ltuZ2_WH0NYdNLPWEnw7HgVQ6K8,14332
79
+ dbt_platform_helper/utils/aws.py,sha256=Liu-Mup3lYQp0KSPNXTZI7VN0sk1cHvOtctyKav6DeU,14401
92
80
  dbt_platform_helper/utils/click.py,sha256=Fx4y4bbve1zypvog_sgK7tJtCocmzheoEFLBRv1lfdM,2943
93
- dbt_platform_helper/utils/cloudformation.py,sha256=A1z12IYpapCOngAvZUCc_Ig7S7tuSP3ceeVzVR-5BGY,1053
94
81
  dbt_platform_helper/utils/cloudfoundry.py,sha256=GnQ4fVLnDfOdNSrsJjI6ElZHqpgwINeoPn77cUH2UFY,484
95
82
  dbt_platform_helper/utils/files.py,sha256=wKDPLZSC3tIZrto-0xGYPmemN8Fsn4spdUsNtYQVVcY,3084
96
83
  dbt_platform_helper/utils/git.py,sha256=9jyLhv37KKE6r-_hb3zvjhTbluA81kdrOdNeG6MB-_M,384
97
84
  dbt_platform_helper/utils/manifests.py,sha256=ji3UYHCxq9tTpkm4MlRa2y0-JOYYqq1pWZ2h_zpj0UU,507
98
85
  dbt_platform_helper/utils/messages.py,sha256=aLx6s9utt__IqlDdeIYq4n82ERwludu2Zfqy0Q2t-x8,115
99
- dbt_platform_helper/utils/platform_config.py,sha256=zJYCIsgUk5kNerocTzD7Q2XIrkYhiCu65sx8KQ-d-o8,833
86
+ dbt_platform_helper/utils/platform_config.py,sha256=2RfIxBAT5fv7WR4YuP3yomUK7sKZFL77xevuHnUALdg,676
100
87
  dbt_platform_helper/utils/template.py,sha256=raRx4QUCVJtKfvJK08Egg6gwWcs3r3V4nPWcJW4xNhA,574
101
- dbt_platform_helper/utils/validation.py,sha256=SCX4W-fBXM8CXBV16xy_4QejXJg1tsSkj7ZW3QWQ4fI,27599
88
+ dbt_platform_helper/utils/validation.py,sha256=htEcvFNnqO9OPCrvvl_Emo0bUsN9f_ThBG5aomVfKIE,24919
102
89
  dbt_platform_helper/utils/versioning.py,sha256=IBxdocJ8ZyJib38d1ja87tTuFE0iJ4npaDcAHQAKQ58,10825
103
- platform_helper.py,sha256=1lvPwynKODyi2U-ePKzJyFwRdKPs6_6zAYUPDYzDKMo,2300
104
- dbt_platform_helper-11.3.0.dist-info/LICENSE,sha256=dP79lN73--7LMApnankTGLqDbImXg8iYFqWgnExGkGk,1090
105
- dbt_platform_helper-11.3.0.dist-info/METADATA,sha256=ud-AUP-U_4-Ps9e6BsGZ7GnhgDWNDhv0FAQbtKn9cyA,3161
106
- dbt_platform_helper-11.3.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
107
- dbt_platform_helper-11.3.0.dist-info/entry_points.txt,sha256=QhbY8F434A-onsg0-FsdMd2U6HKh6Q7yCFFZrGUh5-M,67
108
- dbt_platform_helper-11.3.0.dist-info/RECORD,,
90
+ platform_helper.py,sha256=bly3JkwbfwnWTZSZziu40dbgzQItsK-DIMMvL6ArFDY,1893
91
+ dbt_platform_helper-12.0.0.dist-info/LICENSE,sha256=dP79lN73--7LMApnankTGLqDbImXg8iYFqWgnExGkGk,1090
92
+ dbt_platform_helper-12.0.0.dist-info/METADATA,sha256=ad4UIfaHgL6gLHC8zFGcyfC9yk7wUAsqr3WK0D2rLL0,3161
93
+ dbt_platform_helper-12.0.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
94
+ dbt_platform_helper-12.0.0.dist-info/entry_points.txt,sha256=QhbY8F434A-onsg0-FsdMd2U6HKh6Q7yCFFZrGUh5-M,67
95
+ dbt_platform_helper-12.0.0.dist-info/RECORD,,
platform_helper.py CHANGED
@@ -5,16 +5,11 @@ from importlib.metadata import version
5
5
  import click
6
6
 
7
7
  from dbt_platform_helper.commands.application import application as application_commands
8
- from dbt_platform_helper.commands.check_cloudformation import (
9
- check_cloudformation as check_cloudformation_commands,
10
- )
11
8
  from dbt_platform_helper.commands.codebase import codebase as codebase_commands
12
9
  from dbt_platform_helper.commands.conduit import conduit as conduit_commands
13
10
  from dbt_platform_helper.commands.config import config as config_commands
14
11
  from dbt_platform_helper.commands.copilot import copilot as copilot_commands
15
12
  from dbt_platform_helper.commands.database import database as database_commands
16
- from dbt_platform_helper.commands.dns import cdn as cdn_commands
17
- from dbt_platform_helper.commands.dns import domain as domain_commands
18
13
  from dbt_platform_helper.commands.environment import environment as environment_commands
19
14
  from dbt_platform_helper.commands.generate import generate as generate_commands
20
15
  from dbt_platform_helper.commands.notify import notify as notify_commands
@@ -34,13 +29,10 @@ def platform_helper():
34
29
 
35
30
 
36
31
  platform_helper.add_command(application_commands)
37
- platform_helper.add_command(cdn_commands)
38
- platform_helper.add_command(check_cloudformation_commands)
39
32
  platform_helper.add_command(codebase_commands)
40
33
  platform_helper.add_command(conduit_commands)
41
34
  platform_helper.add_command(config_commands)
42
35
  platform_helper.add_command(copilot_commands)
43
- platform_helper.add_command(domain_commands)
44
36
  platform_helper.add_command(environment_commands)
45
37
  platform_helper.add_command(generate_commands)
46
38
  platform_helper.add_command(pipeline_commands)
@@ -1,87 +0,0 @@
1
- #!/usr/bin/env python
2
- from pathlib import Path
3
-
4
- import click
5
-
6
- from dbt_platform_helper.utils.click import ClickDocOptGroup
7
- from dbt_platform_helper.utils.cloudformation import get_check_security_result
8
- from dbt_platform_helper.utils.cloudformation import get_lint_result
9
-
10
- BASE_DIR = Path(__file__).parent.parent.parent
11
-
12
-
13
- @click.group(invoke_without_command=True, chain=True, cls=ClickDocOptGroup)
14
- @click.option("-d", "--directory", type=str, default="copilot")
15
- @click.pass_context
16
- def check_cloudformation(ctx: click.Context, directory: str) -> None:
17
- """
18
- Runs the checks passed in the command arguments.
19
-
20
- If no argument is passed, it will run all the checks.
21
- """
22
- ctx.ensure_object(dict)
23
-
24
- if ctx.invoked_subcommand is None:
25
- click.secho(f"\n>>> Running all checks", fg="yellow")
26
- for command in ctx.command.commands.values():
27
- ctx.invoke(command)
28
-
29
-
30
- @check_cloudformation.command()
31
- @click.option("-d", "--directory", type=str, default="copilot")
32
- @click.pass_context
33
- def lint(ctx: click.Context, directory: str) -> bool:
34
- """Runs cfn-lint against the generated CloudFormation templates."""
35
- addons_manifests = f"{directory}/**/addons/*.yml"
36
- # addons.parameters.yml is not a CloudFormation template file
37
- ignore_addons_params = f"{directory}/**/addons/addons.parameters.yml"
38
- # "W2001 Parameter Env not used" is ignored becomes Copilot addons require
39
- # parameters even if they are not used in the Cloudformation template.
40
- ignore_checks = "W2001"
41
-
42
- result = get_lint_result(addons_manifests, ignore_addons_params, ignore_checks)
43
- success = result.returncode == 0
44
-
45
- ctx.obj["lint"] = {
46
- "success": success,
47
- "message": result.stdout.decode() if not success else None,
48
- }
49
-
50
- return success
51
-
52
-
53
- @check_cloudformation.command()
54
- @click.option("-d", "--directory", type=str, default="copilot")
55
- @click.pass_context
56
- def check_security(ctx: click.Context, directory: str) -> bool:
57
- addons_manifests = f"{directory}/**/addons/*.yml"
58
- # # addons.parameters.yml is not a CloudFormation template file
59
- ignore_addons_params = f"{directory}/**/addons/addons.parameters.yml"
60
-
61
- result = get_check_security_result(addons_manifests, ignore_addons_params)
62
- success = result.returncode == 0
63
-
64
- ctx.obj["check-security"] = {
65
- "success": success,
66
- "message": result.stdout.decode() if not success else None,
67
- }
68
-
69
- return success
70
-
71
-
72
- @check_cloudformation.result_callback()
73
- @click.pass_context
74
- def process_result(ctx: click.Context, result, directory) -> None:
75
- successful = {k: v for k, v in ctx.obj.items() if v["success"]}
76
- failed = {k: v for k, v in ctx.obj.items() if not v["success"]}
77
- if successful:
78
- click.secho("\nThe CloudFormation templates passed the following checks:", fg="green")
79
- for subcommand_name in successful:
80
- click.secho(f" - {subcommand_name}", fg="white")
81
- if failed:
82
- click.secho("\nThe CloudFormation templates failed the following checks:", fg="red")
83
- for subcommand_name in failed:
84
- message = failed[subcommand_name]["message"]
85
- click.secho(f" - {subcommand_name} [{message}]", fg="white")
86
- exit(1)
87
- exit(0)