Skip to content

Commit

Permalink
feat(grafana_datasource): add tls_servername argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Nemental committed Aug 12, 2024
1 parent 9991b87 commit 60d485a
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions plugins/modules/grafana_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
requests.
type: bool
default: false
tls_servername:
description:
- A Servername is used to verify the hostname on the returned certificate
type: str
tls_client_cert:
description:
- The client TLS certificate.
Expand Down Expand Up @@ -625,12 +629,10 @@ def get_datasource_payload(data, org_id=None):
json_data["tlsAuth"] = True
if data.get("tls_ca_cert"):
secure_json_data["tlsCACert"] = data["tls_ca_cert"]
secure_json_data["tlsClientCert"] = data["tls_client_cert"]
secure_json_data["tlsClientKey"] = data["tls_client_key"]
json_data["tlsAuthWithCACert"] = True
else:
secure_json_data["tlsClientCert"] = data["tls_client_cert"]
secure_json_data["tlsClientKey"] = data["tls_client_key"]
json_data["serverName"] = data["tls_servername"]
secure_json_data["tlsClientCert"] = data["tls_client_cert"]
secure_json_data["tlsClientKey"] = data["tls_client_key"]
else:
json_data["tlsAuth"] = False
json_data["tlsAuthWithCACert"] = False
Expand Down Expand Up @@ -826,6 +828,7 @@ def setup_module_object():
basic_auth_user=dict(type="str"),
basic_auth_password=dict(type="str", no_log=True),
with_credentials=dict(default=False, type="bool"),
tls_servername=dict(type="str"),
tls_client_cert=dict(type="str", no_log=True),
tls_client_key=dict(type="str", no_log=True),
tls_ca_cert=dict(type="str", no_log=True),
Expand Down

0 comments on commit 60d485a

Please sign in to comment.