dbt-platform-helper 15.5.0__py3-none-any.whl → 15.6.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.

@@ -78,11 +78,42 @@ class VpcProvider:
78
78
 
79
79
  def _get_security_groups(self, app: str, env: str, vpc_id: str) -> list:
80
80
  vpc_filter = {"Name": "vpc-id", "Values": [vpc_id]}
81
- # TODO Handle terraformed environment SG https://uktrade.atlassian.net/browse/DBTP-2074
82
- tag_filter = {"Name": f"tag:Name", "Values": [f"copilot-{app}-{env}-env"]}
83
- response = self.ec2_client.describe_security_groups(Filters=[vpc_filter, tag_filter])
84
-
85
- return [sg.get("GroupId") for sg in response.get("SecurityGroups")]
81
+ platform_sg_name = f"platform-{app}-{env}-env-sg"
82
+ copilot_sg_name = f"copilot-{app}-{env}-env"
83
+ tag_filter = {"Name": f"tag:Name", "Values": [copilot_sg_name, platform_sg_name]}
84
+
85
+ filtered_security_groups = self.ec2_client.describe_security_groups(
86
+ Filters=[vpc_filter, tag_filter]
87
+ )
88
+
89
+ platform_security_groups = self._get_matching_security_groups(
90
+ filtered_security_groups, platform_sg_name
91
+ )
92
+
93
+ if platform_security_groups:
94
+ print(
95
+ f"using {platform_security_groups}"
96
+ ) # TODO remove this once decopilotiing has been completed
97
+ return platform_security_groups
98
+
99
+ copilot_security_groups = self._get_matching_security_groups(
100
+ filtered_security_groups, copilot_sg_name
101
+ )
102
+
103
+ print(
104
+ f"using {copilot_security_groups}"
105
+ ) # TODO remove this once decopilotiing has been completed
106
+ return copilot_security_groups
107
+
108
+ def _get_matching_security_groups(
109
+ self, filtered_security_groups: list[dict], security_group_name: str
110
+ ):
111
+ matching_sec_groups = filtered_security_groups.get("SecurityGroups")
112
+ return [
113
+ sg.get("GroupId")
114
+ for sg in matching_sec_groups
115
+ if {"Key": "Name", "Value": security_group_name} in sg.get("Tags", [])
116
+ ]
86
117
 
87
118
  def get_vpc(self, app: str, env: str, vpc_name: str) -> Vpc:
88
119
 
@@ -158,7 +158,17 @@ def get_ssm_secrets(app, env, session=None, path=None):
158
158
  secrets = []
159
159
 
160
160
  while True:
161
- response = client.get_parameters_by_path(**params)
161
+ try:
162
+ response = client.get_parameters_by_path(**params)
163
+ except ClientError as e:
164
+ if e.response["Error"]["Code"] == "AccessDeniedException":
165
+ click.secho(
166
+ "Access denied on SSM, due to missing permissions. Please update your environment infrastructure.",
167
+ fg="magenta",
168
+ )
169
+ break
170
+ else:
171
+ raise e
162
172
 
163
173
  for secret in response["Parameters"]:
164
174
  secrets.append((secret["Name"], secret["Value"]))
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: dbt-platform-helper
3
- Version: 15.5.0
3
+ Version: 15.6.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
@@ -62,7 +62,7 @@ dbt_platform_helper/providers/terraform_manifest.py,sha256=Qst0GwLyOgHgmli3gVciV
62
62
  dbt_platform_helper/providers/validation.py,sha256=i2g-Mrd4hy_fGIfGa6ZQy4vTJ40OM44Fe_XpEifGWxs,126
63
63
  dbt_platform_helper/providers/version.py,sha256=QNGrV5nyJi0JysXowYUU4OrXGDn27WmFezlV8benpdY,4251
64
64
  dbt_platform_helper/providers/version_status.py,sha256=qafnhZrEc9k1cvXJpvJhkGj6WtkzcsoQhqS_Y6JXy48,929
65
- dbt_platform_helper/providers/vpc.py,sha256=V8kXXzy-JuRpuzZhI9xyfcNky-eD42K0v_uM2WejLoo,3048
65
+ dbt_platform_helper/providers/vpc.py,sha256=KdgwyHv2RwNpq16Sa2FtWm7DMJlTNmsPbXkbMNMYiQo,4082
66
66
  dbt_platform_helper/providers/yaml_file.py,sha256=LZ8eCPDQRr1wlck13My5hQa0eE2OVhSomm-pOIuZ9h0,2881
67
67
  dbt_platform_helper/templates/.copilot/config.yml,sha256=J_bA9sCtBdCPBRImpCBRnYvhQd4vpLYIXIU-lq9vbkA,158
68
68
  dbt_platform_helper/templates/.copilot/image_build_run.sh,sha256=adYucYXEB-kAgZNjTQo0T6EIAY8sh_xCEvVhWKKQ8mw,164
@@ -92,7 +92,7 @@ dbt_platform_helper/utilities/decorators.py,sha256=rS6ohsuo0bc6fkZP98Qwaeh0c_v2M
92
92
  dbt_platform_helper/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
93
93
  dbt_platform_helper/utils/application.py,sha256=414czQmCUMDohoz38cY8FjoitJolCmRxCqc9TMJTsE4,6951
94
94
  dbt_platform_helper/utils/arn_parser.py,sha256=BaXzIxSOLdFmP_IfAxRq-0j-0Re1iCN7L4j2Zi5-CRQ,1304
95
- dbt_platform_helper/utils/aws.py,sha256=O3L5Lg2idq597WYNe0GQiW9gHfoeL5XiQbtJ1r_1K-o,12710
95
+ dbt_platform_helper/utils/aws.py,sha256=mnffVJzvXojfmYh1waeUWwHYo24jRu95rXg8LiuogtA,13096
96
96
  dbt_platform_helper/utils/click.py,sha256=Fx4y4bbve1zypvog_sgK7tJtCocmzheoEFLBRv1lfdM,2943
97
97
  dbt_platform_helper/utils/git.py,sha256=9jyLhv37KKE6r-_hb3zvjhTbluA81kdrOdNeG6MB-_M,384
98
98
  dbt_platform_helper/utils/messages.py,sha256=nWA7BWLb7ND0WH5TejDN4OQUJSKYBxU4tyCzteCrfT0,142
@@ -102,8 +102,8 @@ platform_helper.py,sha256=_YNNGtMkH5BcpC_mQQYJrmlf2mt7lkxTYeH7ZgflPoA,1925
102
102
  terraform/elasticache-redis/plans.yml,sha256=efJfkLuLC_5TwhLb9DalKHOuZFO79y6iei6Dg_tqKjI,1831
103
103
  terraform/opensearch/plans.yml,sha256=lQbUSNMGfvUeDMcGx8mSwzGQhMJU3EZ4J4tPzPKaq6c,1471
104
104
  terraform/postgres/plans.yml,sha256=plwCklW1VB_tNJFyUduRMZx9UANgiWH_7TGLWUaUEus,2553
105
- dbt_platform_helper-15.5.0.dist-info/LICENSE,sha256=dP79lN73--7LMApnankTGLqDbImXg8iYFqWgnExGkGk,1090
106
- dbt_platform_helper-15.5.0.dist-info/METADATA,sha256=1RI8g5Z8DCJITAgBzSjUo-8Pf2eTDF1u8oDIj_0yW9I,3293
107
- dbt_platform_helper-15.5.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
108
- dbt_platform_helper-15.5.0.dist-info/entry_points.txt,sha256=QhbY8F434A-onsg0-FsdMd2U6HKh6Q7yCFFZrGUh5-M,67
109
- dbt_platform_helper-15.5.0.dist-info/RECORD,,
105
+ dbt_platform_helper-15.6.0.dist-info/LICENSE,sha256=dP79lN73--7LMApnankTGLqDbImXg8iYFqWgnExGkGk,1090
106
+ dbt_platform_helper-15.6.0.dist-info/METADATA,sha256=t3DF_0fn1sT4hseK6F1MZ4H-GaMClJKiU2RaS5ZK_Gc,3293
107
+ dbt_platform_helper-15.6.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
108
+ dbt_platform_helper-15.6.0.dist-info/entry_points.txt,sha256=QhbY8F434A-onsg0-FsdMd2U6HKh6Q7yCFFZrGUh5-M,67
109
+ dbt_platform_helper-15.6.0.dist-info/RECORD,,