dbt-platform-helper 10.8.1__py3-none-any.whl → 10.9.1__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.
- dbt_platform_helper/commands/environment.py +33 -11
- dbt_platform_helper/utils/validation.py +33 -0
- {dbt_platform_helper-10.8.1.dist-info → dbt_platform_helper-10.9.1.dist-info}/METADATA +1 -1
- {dbt_platform_helper-10.8.1.dist-info → dbt_platform_helper-10.9.1.dist-info}/RECORD +7 -7
- {dbt_platform_helper-10.8.1.dist-info → dbt_platform_helper-10.9.1.dist-info}/LICENSE +0 -0
- {dbt_platform_helper-10.8.1.dist-info → dbt_platform_helper-10.9.1.dist-info}/WHEEL +0 -0
- {dbt_platform_helper-10.8.1.dist-info → dbt_platform_helper-10.9.1.dist-info}/entry_points.txt +0 -0
|
@@ -238,15 +238,16 @@ def get_subnet_ids(session, vpc_id):
|
|
|
238
238
|
return public, private
|
|
239
239
|
|
|
240
240
|
|
|
241
|
-
def get_cert_arn(session, env_name):
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
241
|
+
def get_cert_arn(session, application, env_name):
|
|
242
|
+
try:
|
|
243
|
+
arn = find_https_certificate(session, application, env_name)
|
|
244
|
+
except:
|
|
245
|
+
click.secho(
|
|
246
|
+
f"No certificate found with domain name matching environment {env_name}.", fg="red"
|
|
247
|
+
)
|
|
248
|
+
raise click.Abort
|
|
247
249
|
|
|
248
|
-
|
|
249
|
-
raise click.Abort
|
|
250
|
+
return arn
|
|
250
251
|
|
|
251
252
|
|
|
252
253
|
def get_env_ips(vpc: str, application_environment: Environment):
|
|
@@ -284,7 +285,7 @@ def generate(name, vpc_name):
|
|
|
284
285
|
|
|
285
286
|
env_config = apply_environment_defaults(conf)["environments"][name]
|
|
286
287
|
|
|
287
|
-
_generate_copilot_environment_manifests(name, env_config, session)
|
|
288
|
+
_generate_copilot_environment_manifests(name, conf["application"], env_config, session)
|
|
288
289
|
|
|
289
290
|
|
|
290
291
|
@environment.command(help="Generate terraform manifest for the specified environment.")
|
|
@@ -308,12 +309,12 @@ def generate_terraform(name, terraform_platform_modules_version):
|
|
|
308
309
|
)
|
|
309
310
|
|
|
310
311
|
|
|
311
|
-
def _generate_copilot_environment_manifests(name, env_config, session):
|
|
312
|
+
def _generate_copilot_environment_manifests(name, application, env_config, session):
|
|
312
313
|
env_template = setup_templates().get_template("env/manifest.yml")
|
|
313
314
|
vpc_name = env_config.get("vpc", None)
|
|
314
315
|
vpc_id = get_vpc_id(session, name, vpc_name)
|
|
315
316
|
pub_subnet_ids, priv_subnet_ids = get_subnet_ids(session, vpc_id)
|
|
316
|
-
cert_arn = get_cert_arn(session, name)
|
|
317
|
+
cert_arn = get_cert_arn(session, application, name)
|
|
317
318
|
contents = env_template.render(
|
|
318
319
|
{
|
|
319
320
|
"name": name,
|
|
@@ -398,6 +399,23 @@ def find_https_listener(session: boto3.Session, app: str, env: str) -> str:
|
|
|
398
399
|
return listener_arn
|
|
399
400
|
|
|
400
401
|
|
|
402
|
+
def find_https_certificate(session: boto3.Session, app: str, env: str) -> str:
|
|
403
|
+
listener_arn = find_https_listener(session, app, env)
|
|
404
|
+
cert_client = session.client("elbv2")
|
|
405
|
+
certificates = cert_client.describe_listener_certificates(ListenerArn=listener_arn)[
|
|
406
|
+
"Certificates"
|
|
407
|
+
]
|
|
408
|
+
|
|
409
|
+
certificate_arn = None
|
|
410
|
+
|
|
411
|
+
try:
|
|
412
|
+
certificate_arn = next(c["CertificateArn"] for c in certificates if c["IsDefault"])
|
|
413
|
+
except StopIteration:
|
|
414
|
+
raise CertificateNotFoundError()
|
|
415
|
+
|
|
416
|
+
return certificate_arn
|
|
417
|
+
|
|
418
|
+
|
|
401
419
|
def find_target_group(app: str, env: str, svc: str, session: boto3.Session) -> str:
|
|
402
420
|
rg_tagging_client = session.client("resourcegroupstaggingapi")
|
|
403
421
|
response = rg_tagging_client.get_resources(
|
|
@@ -650,6 +668,10 @@ def get_maintenance_page_template(template) -> str:
|
|
|
650
668
|
return re.sub(r"[^\S]\s+", "", template_contents)
|
|
651
669
|
|
|
652
670
|
|
|
671
|
+
class CertificateNotFoundError(Exception):
|
|
672
|
+
pass
|
|
673
|
+
|
|
674
|
+
|
|
653
675
|
class LoadBalancerNotFoundError(Exception):
|
|
654
676
|
pass
|
|
655
677
|
|
|
@@ -274,6 +274,38 @@ LIFECYCLE_RULE = {
|
|
|
274
274
|
"enabled": bool,
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
+
|
|
278
|
+
def kms_key_arn_regex(key):
|
|
279
|
+
return Regex(
|
|
280
|
+
r"^arn:aws:kms:.*:\d{12}:(key|alias).*",
|
|
281
|
+
error=f"{key} must contain a valid ARN for a KMS key",
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
def s3_bucket_arn_regex(key):
|
|
286
|
+
return Regex(
|
|
287
|
+
r"^arn:aws:s3::.*",
|
|
288
|
+
error=f"{key} must contain a valid ARN for an S3 bucket",
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
def iam_role_arn_regex(key):
|
|
293
|
+
return Regex(
|
|
294
|
+
r"^arn:aws:iam::\d{12}:role/.*",
|
|
295
|
+
error=f"{key} must contain a valid ARN for an IAM role",
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
DATA_IMPORT = {
|
|
300
|
+
Optional("source_kms_key_arn"): kms_key_arn_regex("source_kms_key_arn"),
|
|
301
|
+
"source_bucket_arn": s3_bucket_arn_regex("source_bucket_arn"),
|
|
302
|
+
"worker_role_arn": iam_role_arn_regex("worker_role_arn"),
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
DATA_MIGRATION = {
|
|
306
|
+
"import": DATA_IMPORT,
|
|
307
|
+
}
|
|
308
|
+
|
|
277
309
|
S3_BASE = {
|
|
278
310
|
Optional("readonly"): bool,
|
|
279
311
|
Optional("services"): Or("__all__", [str]),
|
|
@@ -284,6 +316,7 @@ S3_BASE = {
|
|
|
284
316
|
Optional("retention_policy"): RETENTION_POLICY,
|
|
285
317
|
Optional("versioning"): bool,
|
|
286
318
|
Optional("lifecycle_rules"): [LIFECYCLE_RULE],
|
|
319
|
+
Optional("data_migration"): DATA_MIGRATION,
|
|
287
320
|
}
|
|
288
321
|
},
|
|
289
322
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dbt-platform-helper
|
|
3
|
-
Version: 10.
|
|
3
|
+
Version: 10.9.1
|
|
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
|
|
@@ -12,7 +12,7 @@ dbt_platform_helper/commands/config.py,sha256=NOHea7OAjrl6XHlW6HMLn0m0T5lFPyNH3H
|
|
|
12
12
|
dbt_platform_helper/commands/copilot.py,sha256=hGaF3631BCx9SKyY7BB-xK0B9cENK9UKffGiDO2Cp0Q,16556
|
|
13
13
|
dbt_platform_helper/commands/database.py,sha256=-DacXZ2LhwV3CRukG35urEU2TuNVZHppUA3EhbBNjUs,4840
|
|
14
14
|
dbt_platform_helper/commands/dns.py,sha256=o7PkvHktZo0jmqbx0krJTL0R4GtWSf1rF2KDEWor8Ts,35211
|
|
15
|
-
dbt_platform_helper/commands/environment.py,sha256=
|
|
15
|
+
dbt_platform_helper/commands/environment.py,sha256=MJcqYBGxMl3oZIJqnbUNNBbwi5WCShLujMUFgGlmzy8,23147
|
|
16
16
|
dbt_platform_helper/commands/generate.py,sha256=YLCPb-xcPapGcsLn-7d1Am7BpGp5l0iecIDTOdNGjHk,722
|
|
17
17
|
dbt_platform_helper/commands/notify.py,sha256=kVJ0s78QMiaEWPVKu_bbMko4DW2uJy2fu8-HNJsglyk,3748
|
|
18
18
|
dbt_platform_helper/commands/pipeline.py,sha256=jQGwCRpJ_hXK988XmLHzRBHDWmhFzZb37wa75KuSd0M,5945
|
|
@@ -93,11 +93,11 @@ dbt_platform_helper/utils/manifests.py,sha256=ji3UYHCxq9tTpkm4MlRa2y0-JOYYqq1pWZ
|
|
|
93
93
|
dbt_platform_helper/utils/messages.py,sha256=aLx6s9utt__IqlDdeIYq4n82ERwludu2Zfqy0Q2t-x8,115
|
|
94
94
|
dbt_platform_helper/utils/platform_config.py,sha256=dEGB6peHB1ywYSdS71JGxbWIuTFRaeQfWelksX9v6bQ,608
|
|
95
95
|
dbt_platform_helper/utils/template.py,sha256=raRx4QUCVJtKfvJK08Egg6gwWcs3r3V4nPWcJW4xNhA,574
|
|
96
|
-
dbt_platform_helper/utils/validation.py,sha256=
|
|
96
|
+
dbt_platform_helper/utils/validation.py,sha256=HhBBDEhvw0hExVRG2d4QiUCXSje_rwcuzlIlEuGIKPQ,23719
|
|
97
97
|
dbt_platform_helper/utils/versioning.py,sha256=h3veQpFoiOjYY9dRVppcBDzVfgZerT0lXuE9QCTo5-c,10710
|
|
98
98
|
platform_helper.py,sha256=zjsZKcbyrEQbKfERi0JG8JEL-MgG6EjxIMiWT66kCVg,2299
|
|
99
|
-
dbt_platform_helper-10.
|
|
100
|
-
dbt_platform_helper-10.
|
|
101
|
-
dbt_platform_helper-10.
|
|
102
|
-
dbt_platform_helper-10.
|
|
103
|
-
dbt_platform_helper-10.
|
|
99
|
+
dbt_platform_helper-10.9.1.dist-info/LICENSE,sha256=dP79lN73--7LMApnankTGLqDbImXg8iYFqWgnExGkGk,1090
|
|
100
|
+
dbt_platform_helper-10.9.1.dist-info/METADATA,sha256=QwBeXbo-g5zBnm8jfaDk8NaRBIcK_1V8aVFeU2PodB8,3126
|
|
101
|
+
dbt_platform_helper-10.9.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
102
|
+
dbt_platform_helper-10.9.1.dist-info/entry_points.txt,sha256=QhbY8F434A-onsg0-FsdMd2U6HKh6Q7yCFFZrGUh5-M,67
|
|
103
|
+
dbt_platform_helper-10.9.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{dbt_platform_helper-10.8.1.dist-info → dbt_platform_helper-10.9.1.dist-info}/entry_points.txt
RENAMED
|
File without changes
|