qontract-reconcile 0.10.2.dev152__py3-none-any.whl → 0.10.2.dev154__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.
- {qontract_reconcile-0.10.2.dev152.dist-info → qontract_reconcile-0.10.2.dev154.dist-info}/METADATA +1 -1
- {qontract_reconcile-0.10.2.dev152.dist-info → qontract_reconcile-0.10.2.dev154.dist-info}/RECORD +5 -5
- reconcile/utils/terrascript_aws_client.py +93 -72
- {qontract_reconcile-0.10.2.dev152.dist-info → qontract_reconcile-0.10.2.dev154.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.2.dev152.dist-info → qontract_reconcile-0.10.2.dev154.dist-info}/entry_points.txt +0 -0
{qontract_reconcile-0.10.2.dev152.dist-info → qontract_reconcile-0.10.2.dev154.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: qontract-reconcile
|
3
|
-
Version: 0.10.2.
|
3
|
+
Version: 0.10.2.dev154
|
4
4
|
Summary: Collection of tools to reconcile services with their desired state as defined in the app-interface DB.
|
5
5
|
Project-URL: homepage, https://github.com/app-sre/qontract-reconcile
|
6
6
|
Project-URL: repository, https://github.com/app-sre/qontract-reconcile
|
{qontract_reconcile-0.10.2.dev152.dist-info → qontract_reconcile-0.10.2.dev154.dist-info}/RECORD
RENAMED
@@ -657,7 +657,7 @@ reconcile/utils/state.py,sha256=az4tBmZ0EdbFcAGiBVUxs3cr2-BVWsuDQiNTvjjQq8s,1637
|
|
657
657
|
reconcile/utils/structs.py,sha256=LcbLEg8WxfRqM6nW7NhcWN0YeqF7SQzxOgntmLs1SgY,352
|
658
658
|
reconcile/utils/template.py,sha256=wTvRU4AnAV_o042tD4Mwls2dwWMuk7MKnde3MaCjaYg,331
|
659
659
|
reconcile/utils/terraform_client.py,sha256=IDlrNvGEc2i6ElZIL_fzaJEad1nRC3DkP9_VXhJXmU0,37329
|
660
|
-
reconcile/utils/terrascript_aws_client.py,sha256
|
660
|
+
reconcile/utils/terrascript_aws_client.py,sha256=-knIxxuez_gmaI4OvkMq3YeYdZgzkDIVVorFdS_nw4E,289989
|
661
661
|
reconcile/utils/three_way_diff_strategy.py,sha256=oQcHXd9LVhirJfoaOBoHUYuZVGfyL2voKr6KVI34zZE,4833
|
662
662
|
reconcile/utils/throughput.py,sha256=iP4UWAe2LVhDo69mPPmgo9nQ7RxHD6_GS8MZe-aSiuM,344
|
663
663
|
reconcile/utils/vault.py,sha256=aSA8l9cJlPUHpChFGl27nSY-Mpq9FMjBo7Dcgb1BVfM,15036
|
@@ -797,7 +797,7 @@ tools/saas_promotion_state/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJ
|
|
797
797
|
tools/saas_promotion_state/saas_promotion_state.py,sha256=UfwwRLS5Ya4_Nh1w5n1dvoYtchQvYE9yj1VANt2IKqI,3925
|
798
798
|
tools/sre_checkpoints/__init__.py,sha256=CDaDaywJnmRCLyl_NCcvxi-Zc0hTi_3OdwKiFOyS39I,145
|
799
799
|
tools/sre_checkpoints/util.py,sha256=zEDbGr18ZeHNQwW8pUsr2JRjuXIPz--WAGJxZo9sv_Y,894
|
800
|
-
qontract_reconcile-0.10.2.
|
801
|
-
qontract_reconcile-0.10.2.
|
802
|
-
qontract_reconcile-0.10.2.
|
803
|
-
qontract_reconcile-0.10.2.
|
800
|
+
qontract_reconcile-0.10.2.dev154.dist-info/METADATA,sha256=GeAWXva3akSPG_o0MRXF2OzW9PyOPP-v3_kTGWRcDSw,24627
|
801
|
+
qontract_reconcile-0.10.2.dev154.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
802
|
+
qontract_reconcile-0.10.2.dev154.dist-info/entry_points.txt,sha256=5i9l54La3vQrDLAdwDKQWC0iG4sV9RRfOb1BpvzOWLc,698
|
803
|
+
qontract_reconcile-0.10.2.dev154.dist-info/RECORD,,
|
@@ -4639,11 +4639,14 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
|
|
4639
4639
|
admin_user_secret = auth_options["admin_user_credentials"]
|
4640
4640
|
secret_data = self.secret_reader.read_all(admin_user_secret)
|
4641
4641
|
|
4642
|
-
required_keys = {
|
4643
|
-
|
4642
|
+
required_keys = {
|
4643
|
+
"master_user_name",
|
4644
|
+
"master_user_password",
|
4645
|
+
}
|
4646
|
+
if not (required_keys <= secret_data.keys()):
|
4644
4647
|
raise KeyError(
|
4645
4648
|
f"vault secret '{admin_user_secret['path']}' must "
|
4646
|
-
f"
|
4649
|
+
f"contain these keys: {', '.join(required_keys)}"
|
4647
4650
|
)
|
4648
4651
|
|
4649
4652
|
# AWS requires the admin user password must be at least 8 chars long, contain at least one
|
@@ -4880,10 +4883,11 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
|
|
4880
4883
|
es_values["provider"] = provider
|
4881
4884
|
|
4882
4885
|
auth_options = values.get("auth", {})
|
4886
|
+
advanced_security_options = None
|
4883
4887
|
# TODO: @fishi0x01 make mandatory after migration APPSRE-3409
|
4884
4888
|
if auth_options:
|
4885
|
-
|
4886
|
-
|
4889
|
+
advanced_security_options = self._build_es_advanced_security_options(
|
4890
|
+
auth_options
|
4887
4891
|
)
|
4888
4892
|
|
4889
4893
|
# TODO: @fishi0x01 remove after migration APPSRE-3409
|
@@ -4897,6 +4901,84 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
|
|
4897
4901
|
)
|
4898
4902
|
)
|
4899
4903
|
# ++++++++ END: REMOVE ++++++++++
|
4904
|
+
if advanced_security_options:
|
4905
|
+
master_user_options_with_optional_keys_values = advanced_security_options[
|
4906
|
+
"master_user_options"
|
4907
|
+
]
|
4908
|
+
# this secret can include optional kv pairs which are then saved to secrets manager in AWS
|
4909
|
+
# however this step strips those extra values from `master_user_options` which only expects
|
4910
|
+
# 2 fields https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/elasticsearch_domain#master_user_options-1
|
4911
|
+
advanced_security_options["master_user_options"] = {
|
4912
|
+
k: v
|
4913
|
+
for k, v in master_user_options_with_optional_keys_values.items()
|
4914
|
+
if k in {"master_user_name", "master_user_password"}
|
4915
|
+
}
|
4916
|
+
es_values["advanced_security_options"] = advanced_security_options
|
4917
|
+
if advanced_security_options.get("internal_user_database_enabled", False):
|
4918
|
+
# add master user creds to output and secretsmanager if internal_user_database_enabled
|
4919
|
+
master_user = master_user_options_with_optional_keys_values
|
4920
|
+
secret_name = f"qrtf/es/{identifier}"
|
4921
|
+
secret_identifier = secret_name.replace("/", "-")
|
4922
|
+
secret_values = {"name": secret_name, "tags": tags}
|
4923
|
+
if provider:
|
4924
|
+
secret_values["provider"] = provider
|
4925
|
+
aws_secret_resource = aws_secretsmanager_secret(
|
4926
|
+
secret_identifier, **secret_values
|
4927
|
+
)
|
4928
|
+
tf_resources.append(aws_secret_resource)
|
4929
|
+
|
4930
|
+
version_values = {
|
4931
|
+
"secret_id": "${" + aws_secret_resource.id + "}",
|
4932
|
+
"secret_string": json.dumps(master_user, sort_keys=True),
|
4933
|
+
}
|
4934
|
+
if provider:
|
4935
|
+
version_values["provider"] = provider
|
4936
|
+
aws_version_resource = aws_secretsmanager_secret_version(
|
4937
|
+
secret_identifier, **version_values
|
4938
|
+
)
|
4939
|
+
tf_resources.append(aws_version_resource)
|
4940
|
+
|
4941
|
+
policy = {
|
4942
|
+
"Version": "2012-10-17",
|
4943
|
+
"Statement": [
|
4944
|
+
{
|
4945
|
+
"Effect": "Allow",
|
4946
|
+
"Action": [
|
4947
|
+
"secretsmanager:GetResourcePolicy",
|
4948
|
+
"secretsmanager:GetSecretValue",
|
4949
|
+
"secretsmanager:DescribeSecret",
|
4950
|
+
"secretsmanager:ListSecretVersionIds",
|
4951
|
+
],
|
4952
|
+
"Resource": "${" + aws_secret_resource.id + "}",
|
4953
|
+
}
|
4954
|
+
],
|
4955
|
+
}
|
4956
|
+
iam_policy_resource = aws_iam_policy(
|
4957
|
+
secret_identifier,
|
4958
|
+
name=f"{identifier}-secretsmanager-policy",
|
4959
|
+
policy=json.dumps(policy, sort_keys=True),
|
4960
|
+
tags=tags,
|
4961
|
+
)
|
4962
|
+
tf_resources.append(iam_policy_resource)
|
4963
|
+
|
4964
|
+
output_name = output_prefix + "__secret_name"
|
4965
|
+
output_value = secret_name
|
4966
|
+
tf_resources.append(Output(output_name, value=output_value))
|
4967
|
+
output_name = output_prefix + "__secret_policy_arn"
|
4968
|
+
output_value = "${" + iam_policy_resource.arn + "}"
|
4969
|
+
tf_resources.append(Output(output_name, value=output_value))
|
4970
|
+
# master_user_name
|
4971
|
+
output_name = output_prefix + "__master_user_name"
|
4972
|
+
output_value = master_user["master_user_name"]
|
4973
|
+
tf_resources.append(
|
4974
|
+
Output(output_name, value=output_value, sensitive=True)
|
4975
|
+
)
|
4976
|
+
# master_user_password
|
4977
|
+
output_name = output_prefix + "__master_user_password"
|
4978
|
+
output_value = master_user["master_user_password"]
|
4979
|
+
tf_resources.append(
|
4980
|
+
Output(output_name, value=output_value, sensitive=True)
|
4981
|
+
)
|
4900
4982
|
|
4901
4983
|
es_tf_resource = aws_elasticsearch_domain(identifier, **es_values)
|
4902
4984
|
tf_resources.append(es_tf_resource)
|
@@ -4928,70 +5010,6 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
|
|
4928
5010
|
"${aws_elasticsearch_domain." + identifier + ".vpc_options.0.vpc_id}"
|
4929
5011
|
)
|
4930
5012
|
tf_resources.append(Output(output_name, value=output_value))
|
4931
|
-
# add master user creds to output and secretsmanager if internal_user_database_enabled
|
4932
|
-
security_options = es_values.get("advanced_security_options")
|
4933
|
-
if security_options and security_options.get(
|
4934
|
-
"internal_user_database_enabled", False
|
4935
|
-
):
|
4936
|
-
master_user = security_options["master_user_options"]
|
4937
|
-
secret_name = f"qrtf/es/{identifier}"
|
4938
|
-
secret_identifier = secret_name.replace("/", "-")
|
4939
|
-
secret_values = {"name": secret_name, "tags": tags}
|
4940
|
-
if provider:
|
4941
|
-
secret_values["provider"] = provider
|
4942
|
-
aws_secret_resource = aws_secretsmanager_secret(
|
4943
|
-
secret_identifier, **secret_values
|
4944
|
-
)
|
4945
|
-
tf_resources.append(aws_secret_resource)
|
4946
|
-
|
4947
|
-
version_values = {
|
4948
|
-
"secret_id": "${" + aws_secret_resource.id + "}",
|
4949
|
-
"secret_string": json.dumps(master_user, sort_keys=True),
|
4950
|
-
}
|
4951
|
-
if provider:
|
4952
|
-
version_values["provider"] = provider
|
4953
|
-
aws_version_resource = aws_secretsmanager_secret_version(
|
4954
|
-
secret_identifier, **version_values
|
4955
|
-
)
|
4956
|
-
tf_resources.append(aws_version_resource)
|
4957
|
-
|
4958
|
-
policy = {
|
4959
|
-
"Version": "2012-10-17",
|
4960
|
-
"Statement": [
|
4961
|
-
{
|
4962
|
-
"Effect": "Allow",
|
4963
|
-
"Action": [
|
4964
|
-
"secretsmanager:GetResourcePolicy",
|
4965
|
-
"secretsmanager:GetSecretValue",
|
4966
|
-
"secretsmanager:DescribeSecret",
|
4967
|
-
"secretsmanager:ListSecretVersionIds",
|
4968
|
-
],
|
4969
|
-
"Resource": "${" + aws_secret_resource.id + "}",
|
4970
|
-
}
|
4971
|
-
],
|
4972
|
-
}
|
4973
|
-
iam_policy_resource = aws_iam_policy(
|
4974
|
-
secret_identifier,
|
4975
|
-
name=f"{identifier}-secretsmanager-policy",
|
4976
|
-
policy=json.dumps(policy, sort_keys=True),
|
4977
|
-
tags=tags,
|
4978
|
-
)
|
4979
|
-
tf_resources.append(iam_policy_resource)
|
4980
|
-
|
4981
|
-
output_name = output_prefix + "__secret_name"
|
4982
|
-
output_value = secret_name
|
4983
|
-
tf_resources.append(Output(output_name, value=output_value))
|
4984
|
-
output_name = output_prefix + "__secret_policy_arn"
|
4985
|
-
output_value = "${" + iam_policy_resource.arn + "}"
|
4986
|
-
tf_resources.append(Output(output_name, value=output_value))
|
4987
|
-
# master_user_name
|
4988
|
-
output_name = output_prefix + "__master_user_name"
|
4989
|
-
output_value = master_user["master_user_name"]
|
4990
|
-
tf_resources.append(Output(output_name, value=output_value, sensitive=True))
|
4991
|
-
# master_user_password
|
4992
|
-
output_name = output_prefix + "__master_user_password"
|
4993
|
-
output_value = master_user["master_user_password"]
|
4994
|
-
tf_resources.append(Output(output_name, value=output_value, sensitive=True))
|
4995
5013
|
|
4996
5014
|
self.add_resources(account, tf_resources)
|
4997
5015
|
|
@@ -5005,11 +5023,14 @@ class TerrascriptClient: # pylint: disable=too-many-public-methods
|
|
5005
5023
|
master_user_secret = master_user_options["master_user_secret"]
|
5006
5024
|
secret_data = self.secret_reader.read_all(master_user_secret)
|
5007
5025
|
|
5008
|
-
required_keys = {
|
5009
|
-
|
5026
|
+
required_keys = {
|
5027
|
+
"master_user_name",
|
5028
|
+
"master_user_password",
|
5029
|
+
}
|
5030
|
+
if not (required_keys <= secret_data.keys()):
|
5010
5031
|
raise KeyError(
|
5011
5032
|
f"vault secret '{master_user_secret['path']}' must "
|
5012
|
-
f"
|
5033
|
+
f"contain these keys: {', '.join(required_keys)}"
|
5013
5034
|
)
|
5014
5035
|
|
5015
5036
|
advanced_security_options["master_user_options"] = secret_data
|
{qontract_reconcile-0.10.2.dev152.dist-info → qontract_reconcile-0.10.2.dev154.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|