dbt-platform-helper 10.9.1__py3-none-any.whl → 10.11.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.
- dbt_platform_helper/commands/copilot.py +5 -0
- dbt_platform_helper/commands/environment.py +64 -18
- dbt_platform_helper/custom_resources/s3_object.py +2 -0
- dbt_platform_helper/templates/addons/env/redis-cluster.yml +0 -14
- dbt_platform_helper/templates/addons/env/s3.yml +3 -0
- dbt_platform_helper/utils/validation.py +3 -7
- {dbt_platform_helper-10.9.1.dist-info → dbt_platform_helper-10.11.0.dist-info}/METADATA +1 -1
- {dbt_platform_helper-10.9.1.dist-info → dbt_platform_helper-10.11.0.dist-info}/RECORD +11 -11
- {dbt_platform_helper-10.9.1.dist-info → dbt_platform_helper-10.11.0.dist-info}/LICENSE +0 -0
- {dbt_platform_helper-10.9.1.dist-info → dbt_platform_helper-10.11.0.dist-info}/WHEEL +0 -0
- {dbt_platform_helper-10.9.1.dist-info → dbt_platform_helper-10.11.0.dist-info}/entry_points.txt +0 -0
|
@@ -222,6 +222,9 @@ def _get_s3_kms_alias_arns(session, application_name, config):
|
|
|
222
222
|
if environment_name not in config:
|
|
223
223
|
continue
|
|
224
224
|
|
|
225
|
+
if "bucket_name" not in config[environment_name]:
|
|
226
|
+
continue
|
|
227
|
+
|
|
225
228
|
bucket_name = config[environment_name]["bucket_name"]
|
|
226
229
|
kms_client = application.environments[environment_name].session.client("kms")
|
|
227
230
|
alias_name = f"alias/{application_name}-{environment_name}-{bucket_name}-key"
|
|
@@ -313,6 +316,8 @@ def make_addons():
|
|
|
313
316
|
log_destination_arns = get_log_destination_arn()
|
|
314
317
|
|
|
315
318
|
if addon_type in ["s3", "s3-policy"]:
|
|
319
|
+
if config[addon_name].get("serve_static_content"):
|
|
320
|
+
continue
|
|
316
321
|
if is_terraform:
|
|
317
322
|
s3_kms_arns = _get_s3_kms_alias_arns(session, application_name, environments)
|
|
318
323
|
for environment_name in environments:
|
|
@@ -250,7 +250,7 @@ def get_cert_arn(session, application, env_name):
|
|
|
250
250
|
return arn
|
|
251
251
|
|
|
252
252
|
|
|
253
|
-
def get_env_ips(vpc: str, application_environment: Environment):
|
|
253
|
+
def get_env_ips(vpc: str, application_environment: Environment) -> List[str]:
|
|
254
254
|
account_name = f"{application_environment.session.profile_name}-vpc"
|
|
255
255
|
vpc_name = vpc if vpc else account_name
|
|
256
256
|
ssm_client = application_environment.session.client("ssm")
|
|
@@ -275,8 +275,6 @@ def generate(name, vpc_name):
|
|
|
275
275
|
)
|
|
276
276
|
raise click.Abort
|
|
277
277
|
|
|
278
|
-
session = get_aws_session_or_abort()
|
|
279
|
-
|
|
280
278
|
try:
|
|
281
279
|
conf = load_and_validate_platform_config()
|
|
282
280
|
except SchemaError as ex:
|
|
@@ -284,6 +282,9 @@ def generate(name, vpc_name):
|
|
|
284
282
|
raise click.Abort
|
|
285
283
|
|
|
286
284
|
env_config = apply_environment_defaults(conf)["environments"][name]
|
|
285
|
+
profile_for_environment = env_config.get("accounts", {}).get("deploy", {}).get("name")
|
|
286
|
+
click.secho(f"Using {profile_for_environment} for this AWS session")
|
|
287
|
+
session = get_aws_session_or_abort(profile_for_environment)
|
|
287
288
|
|
|
288
289
|
_generate_copilot_environment_manifests(name, conf["application"], env_config, session)
|
|
289
290
|
|
|
@@ -482,11 +483,8 @@ def delete_listener_rule(tag_descriptions: list, tag_name: str, lb_client: boto3
|
|
|
482
483
|
tags = {t["Key"]: t["Value"] for t in description["Tags"]}
|
|
483
484
|
if tags.get("name") == tag_name:
|
|
484
485
|
current_rule_arn = description["ResourceArn"]
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
return current_rule_arn
|
|
488
|
-
|
|
489
|
-
lb_client.delete_rule(RuleArn=current_rule_arn)
|
|
486
|
+
if current_rule_arn:
|
|
487
|
+
lb_client.delete_rule(RuleArn=current_rule_arn)
|
|
490
488
|
|
|
491
489
|
return current_rule_arn
|
|
492
490
|
|
|
@@ -500,7 +498,7 @@ def remove_maintenance_page(session: boto3.Session, listener_arn: str):
|
|
|
500
498
|
"TagDescriptions"
|
|
501
499
|
]
|
|
502
500
|
|
|
503
|
-
for name in ["MaintenancePage", "AllowedIps", "BypassIpFilter"]:
|
|
501
|
+
for name in ["MaintenancePage", "AllowedIps", "BypassIpFilter", "AllowedSourceIps"]:
|
|
504
502
|
deleted = delete_listener_rule(tag_descriptions, name, lb_client)
|
|
505
503
|
|
|
506
504
|
if name == "MaintenancePage" and not deleted:
|
|
@@ -520,15 +518,7 @@ def get_rules_tag_descriptions(rules: list, lb_client):
|
|
|
520
518
|
return tag_descriptions
|
|
521
519
|
|
|
522
520
|
|
|
523
|
-
def
|
|
524
|
-
lb_client: boto3.client,
|
|
525
|
-
listener_arn: str,
|
|
526
|
-
target_group_arn: str,
|
|
527
|
-
header_name: str,
|
|
528
|
-
values: list,
|
|
529
|
-
rule_name: str,
|
|
530
|
-
priority: int,
|
|
531
|
-
):
|
|
521
|
+
def get_host_conditions(lb_client: boto3.client, listener_arn: str, target_group_arn: str):
|
|
532
522
|
rules = lb_client.describe_rules(ListenerArn=listener_arn)["Rules"]
|
|
533
523
|
|
|
534
524
|
# Get current set of forwarding conditions for the target group
|
|
@@ -549,6 +539,20 @@ def create_header_rule(
|
|
|
549
539
|
v for v in conditions[0]["HostHeaderConfig"]["Values"]
|
|
550
540
|
]
|
|
551
541
|
|
|
542
|
+
return conditions
|
|
543
|
+
|
|
544
|
+
|
|
545
|
+
def create_header_rule(
|
|
546
|
+
lb_client: boto3.client,
|
|
547
|
+
listener_arn: str,
|
|
548
|
+
target_group_arn: str,
|
|
549
|
+
header_name: str,
|
|
550
|
+
values: list,
|
|
551
|
+
rule_name: str,
|
|
552
|
+
priority: int,
|
|
553
|
+
):
|
|
554
|
+
conditions = get_host_conditions(lb_client, listener_arn, target_group_arn)
|
|
555
|
+
|
|
552
556
|
# add new condition to existing conditions
|
|
553
557
|
combined_conditions = [
|
|
554
558
|
{
|
|
@@ -573,6 +577,40 @@ def create_header_rule(
|
|
|
573
577
|
)
|
|
574
578
|
|
|
575
579
|
|
|
580
|
+
def create_source_ip_rule(
|
|
581
|
+
lb_client: boto3.client,
|
|
582
|
+
listener_arn: str,
|
|
583
|
+
target_group_arn: str,
|
|
584
|
+
values: list,
|
|
585
|
+
rule_name: str,
|
|
586
|
+
priority: int,
|
|
587
|
+
):
|
|
588
|
+
conditions = get_host_conditions(lb_client, listener_arn, target_group_arn)
|
|
589
|
+
|
|
590
|
+
# add new condition to existing conditions
|
|
591
|
+
combined_conditions = [
|
|
592
|
+
{
|
|
593
|
+
"Field": "source-ip",
|
|
594
|
+
"SourceIpConfig": {"Values": [value + "/32" for value in values]},
|
|
595
|
+
}
|
|
596
|
+
] + conditions
|
|
597
|
+
|
|
598
|
+
lb_client.create_rule(
|
|
599
|
+
ListenerArn=listener_arn,
|
|
600
|
+
Priority=priority,
|
|
601
|
+
Conditions=combined_conditions,
|
|
602
|
+
Actions=[{"Type": "forward", "TargetGroupArn": target_group_arn}],
|
|
603
|
+
Tags=[
|
|
604
|
+
{"Key": "name", "Value": rule_name},
|
|
605
|
+
],
|
|
606
|
+
)
|
|
607
|
+
|
|
608
|
+
click.secho(
|
|
609
|
+
f"Creating listener rule {rule_name} for HTTPS Listener with arn {listener_arn}.\n\nIf request source ip matches one of the values {values}, the request will be forwarded to target group with arn {target_group_arn}.",
|
|
610
|
+
fg="green",
|
|
611
|
+
)
|
|
612
|
+
|
|
613
|
+
|
|
576
614
|
def add_maintenance_page(
|
|
577
615
|
session: boto3.Session,
|
|
578
616
|
listener_arn: str,
|
|
@@ -608,6 +646,14 @@ def add_maintenance_page(
|
|
|
608
646
|
"AllowedIps",
|
|
609
647
|
forwarded_rule_priority,
|
|
610
648
|
)
|
|
649
|
+
create_source_ip_rule(
|
|
650
|
+
lb_client,
|
|
651
|
+
listener_arn,
|
|
652
|
+
target_group_arn,
|
|
653
|
+
[ip],
|
|
654
|
+
"AllowedSourceIps",
|
|
655
|
+
forwarded_rule_priority + 1,
|
|
656
|
+
)
|
|
611
657
|
|
|
612
658
|
bypass_rule_priority = service_number
|
|
613
659
|
create_header_rule(
|
|
@@ -72,10 +72,12 @@ def handler(event, context):
|
|
|
72
72
|
Key=properties["S3ObjectKey"],
|
|
73
73
|
)
|
|
74
74
|
else:
|
|
75
|
+
content_type = properties.get("S3ObjectContentType", "binary/octet-stream")
|
|
75
76
|
s3_client.put_object(
|
|
76
77
|
Bucket=properties["S3Bucket"],
|
|
77
78
|
Key=properties["S3ObjectKey"],
|
|
78
79
|
Body=properties["S3ObjectBody"].encode("utf-8"),
|
|
80
|
+
ContentType=content_type,
|
|
79
81
|
)
|
|
80
82
|
|
|
81
83
|
send_response(event, context, "SUCCESS", f"{request_type}d")
|
|
@@ -35,20 +35,6 @@ Mappings:
|
|
|
35
35
|
CacheParameterGroupFamily: 'redis7.x'
|
|
36
36
|
'6.2':
|
|
37
37
|
CacheParameterGroupFamily: 'redis6.x'
|
|
38
|
-
'6.0':
|
|
39
|
-
CacheParameterGroupFamily: 'redis6.x'
|
|
40
|
-
'5.0.6':
|
|
41
|
-
CacheParameterGroupFamily: 'redis5.0'
|
|
42
|
-
'5.0.4':
|
|
43
|
-
CacheParameterGroupFamily: 'redis5.0'
|
|
44
|
-
'5.0.3':
|
|
45
|
-
CacheParameterGroupFamily: 'redis5.0'
|
|
46
|
-
'5.0.0':
|
|
47
|
-
CacheParameterGroupFamily: 'redis5.0'
|
|
48
|
-
'4.0.10':
|
|
49
|
-
CacheParameterGroupFamily: 'redis4.0'
|
|
50
|
-
'3.2.6':
|
|
51
|
-
CacheParameterGroupFamily: 'redis3.2'
|
|
52
38
|
|
|
53
39
|
Conditions:
|
|
54
40
|
{{ addon_config.prefix }}HasAutomaticFailoverEnabled: !Not [!Equals [!FindInMap [{{ addon_config.prefix }}EnvironmentConfigMap, !Ref Env, NumReplicas], 0]]
|
|
@@ -201,6 +201,9 @@ Resources:
|
|
|
201
201
|
S3Bucket: !Ref {{ addon_config.prefix }}Bucket
|
|
202
202
|
S3ObjectKey: {{ s3object.key }}
|
|
203
203
|
S3ObjectBody: {{ s3object.body }}
|
|
204
|
+
{% if s3object.content_type %}
|
|
205
|
+
S3ObjectContentType: {{ s3object.content_type }}
|
|
206
|
+
{% endif %}
|
|
204
207
|
{% endfor %}
|
|
205
208
|
{% endif %}
|
|
206
209
|
|
|
@@ -180,7 +180,7 @@ REDIS_PLANS = Or(
|
|
|
180
180
|
"x-large-ha",
|
|
181
181
|
)
|
|
182
182
|
|
|
183
|
-
REDIS_ENGINE_VERSIONS = Or("
|
|
183
|
+
REDIS_ENGINE_VERSIONS = Or("6.2", "7.0", "7.1")
|
|
184
184
|
|
|
185
185
|
REDIS_DEFINITION = {
|
|
186
186
|
"type": "redis",
|
|
@@ -308,6 +308,7 @@ DATA_MIGRATION = {
|
|
|
308
308
|
|
|
309
309
|
S3_BASE = {
|
|
310
310
|
Optional("readonly"): bool,
|
|
311
|
+
Optional("serve_static_content"): bool,
|
|
311
312
|
Optional("services"): Or("__all__", [str]),
|
|
312
313
|
Optional("environments"): {
|
|
313
314
|
ENV_NAME: {
|
|
@@ -328,12 +329,7 @@ S3_DEFINITION = dict(S3_BASE)
|
|
|
328
329
|
S3_DEFINITION.update(
|
|
329
330
|
{
|
|
330
331
|
"type": "s3",
|
|
331
|
-
Optional("objects"): [
|
|
332
|
-
{
|
|
333
|
-
"key": str,
|
|
334
|
-
Optional("body"): str,
|
|
335
|
-
}
|
|
336
|
-
],
|
|
332
|
+
Optional("objects"): [{"key": str, Optional("body"): str, Optional("content_type"): str}],
|
|
337
333
|
}
|
|
338
334
|
)
|
|
339
335
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dbt-platform-helper
|
|
3
|
-
Version: 10.
|
|
3
|
+
Version: 10.11.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
|
|
@@ -9,10 +9,10 @@ dbt_platform_helper/commands/check_cloudformation.py,sha256=aLif3yMHKuZO0uvdUjTH
|
|
|
9
9
|
dbt_platform_helper/commands/codebase.py,sha256=NchJzH-yxv5mXCe2rPyXVNHmXGEvjFUv0KhMKYsLNNQ,11380
|
|
10
10
|
dbt_platform_helper/commands/conduit.py,sha256=M_-Lrcph4c4PFivfEzDEL2_PW_OzZaOtZXpgo_Ao3DU,14882
|
|
11
11
|
dbt_platform_helper/commands/config.py,sha256=NOHea7OAjrl6XHlW6HMLn0m0T5lFPyNH3HXoyCOWsJk,12070
|
|
12
|
-
dbt_platform_helper/commands/copilot.py,sha256=
|
|
12
|
+
dbt_platform_helper/commands/copilot.py,sha256=euid0FTlVtwKmBQ6vxt_HxtBdRYiVQvb-9CyrK1-MWc,16724
|
|
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=VNr7G1QstM8INGs8jOxL1jQRqDcWx2Q0jaaBXtbHhys,24819
|
|
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
|
|
@@ -20,7 +20,7 @@ dbt_platform_helper/commands/secrets.py,sha256=2NtV5FGx-ErkMg2QMiDvFOp03cKVbLzgm
|
|
|
20
20
|
dbt_platform_helper/commands/version.py,sha256=2r6c3-PSMMY_VAU32UNaPJJXOsouX1MQDWXnx3ZpGJI,1474
|
|
21
21
|
dbt_platform_helper/constants.py,sha256=fzN2VZt81mspNfdYpNef5_eEjDVsh8GUYmhBMTIfPvI,232
|
|
22
22
|
dbt_platform_helper/custom_resources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
-
dbt_platform_helper/custom_resources/s3_object.py,sha256=
|
|
23
|
+
dbt_platform_helper/custom_resources/s3_object.py,sha256=0mhLuKD0-vwuN1qmnLCrLo2qL58FvtCjNNjH34kac6Y,2526
|
|
24
24
|
dbt_platform_helper/default-extensions.yml,sha256=SU1ZitskbuEBpvE7efc3s56eAUF11j70brhj_XrNMMo,493
|
|
25
25
|
dbt_platform_helper/exceptions.py,sha256=BeqhBQHXS57ROwEEGCnd9qcMDbuKvsdeiYRUuTlhe4w,499
|
|
26
26
|
dbt_platform_helper/jinja2_tags.py,sha256=jFyN_Sxmko1GSfvrqRIGQ80CCW8EwlCV3su0ahJPfoE,541
|
|
@@ -38,8 +38,8 @@ dbt_platform_helper/templates/addons/env/aurora-postgres.yml,sha256=El0jTaWqWy5C
|
|
|
38
38
|
dbt_platform_helper/templates/addons/env/monitoring.yml,sha256=ZjvKhrhg6hIoQ51n0jl94z5I8ue_XQp-sypsDVQLiwY,6085
|
|
39
39
|
dbt_platform_helper/templates/addons/env/opensearch.yml,sha256=Ay0IAE8AWMEUjBRpMWyI4qLFmdwNkQwAN1ciTnuKb5c,10874
|
|
40
40
|
dbt_platform_helper/templates/addons/env/rds-postgres.yml,sha256=uz7I9u8c-25ergwzNe1EQTT9TadlekeRyhgdpyNbCOo,25645
|
|
41
|
-
dbt_platform_helper/templates/addons/env/redis-cluster.yml,sha256=
|
|
42
|
-
dbt_platform_helper/templates/addons/env/s3.yml,sha256=
|
|
41
|
+
dbt_platform_helper/templates/addons/env/redis-cluster.yml,sha256=lUqoNgomx5FzoAplRcqT1BDMeXHTXZ16Or5Xd0Sz2eg,7236
|
|
42
|
+
dbt_platform_helper/templates/addons/env/s3.yml,sha256=E0ikzN7ztk61rPjUXoKbAujgWcm6MRiDfHzShflBQPA,7758
|
|
43
43
|
dbt_platform_helper/templates/addons/env/vpc.yml,sha256=Bi-RDr58u-X5J6VHRUxSKDCJ0ddbY79gec6kB69sz8w,3679
|
|
44
44
|
dbt_platform_helper/templates/addons/svc/appconfig-ipfilter.yml,sha256=nBIXV4um4jIvXs3Q5QycHqVpJODK5yg_M-xJT6AOBKE,977
|
|
45
45
|
dbt_platform_helper/templates/addons/svc/prometheus-policy.yml,sha256=cxt0N_MVs-29IX213B6H64-5aWVQNDUR5UnYbLlhX2I,1032
|
|
@@ -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=2XMizmCGk4oTVU67q72cdc8eyOzL0wxhe7DframhQ8Q,23699
|
|
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.11.0.dist-info/LICENSE,sha256=dP79lN73--7LMApnankTGLqDbImXg8iYFqWgnExGkGk,1090
|
|
100
|
+
dbt_platform_helper-10.11.0.dist-info/METADATA,sha256=R2rfcAwazxqT20_XZoW-CZeaGjBLSuHIJSchxQJ4Kh4,3127
|
|
101
|
+
dbt_platform_helper-10.11.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
102
|
+
dbt_platform_helper-10.11.0.dist-info/entry_points.txt,sha256=QhbY8F434A-onsg0-FsdMd2U6HKh6Q7yCFFZrGUh5-M,67
|
|
103
|
+
dbt_platform_helper-10.11.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
{dbt_platform_helper-10.9.1.dist-info → dbt_platform_helper-10.11.0.dist-info}/entry_points.txt
RENAMED
|
File without changes
|