Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions plugins/modules/datalake.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@
default: 3600
aliases:
- polling_timeout
raz:
description:
- Flag indicating if Ranger RAZ fine grained access should be enabled for the datalake
type: bool
required: False
default: False
extends_documentation_fragment:
- cloudera.cloud.cdp_sdk_options
- cloudera.cloud.cdp_auth_options
Expand Down Expand Up @@ -209,6 +215,10 @@
sample:
- AWS
- AZURE
enableRangerRaz:
description: Whether or not RAZ is enabled
returned: always
type: bool
clouderaManager:
description: The Cloudera Manager details.
returned: when supported
Expand Down Expand Up @@ -394,6 +404,7 @@ def __init__(self, module):
self.delay = self._get_param('delay')
self.timeout = self._get_param('timeout')
self.force = self._get_param('force')
self.raz = self._get_param("raz")

# Initialize the return values
self.datalake = dict()
Expand Down Expand Up @@ -473,7 +484,7 @@ def process(self):
def create_datalake(self, environment):
self._validate_datalake_name()

payload = self._configure_payload()
payload = self._configure_payload(environment)

if environment['cloudPlatform'] == 'AWS':
if self.instance_profile is None or self.storage is None:
Expand Down Expand Up @@ -525,7 +536,7 @@ def delete_datalake(self):
timeout=self.timeout
)

def _configure_payload(self):
def _configure_payload(self, environment):
payload = dict(
datalakeName=self.name,
environmentName=self.environment,
Expand All @@ -537,6 +548,14 @@ def _configure_payload(self):
if self.scale:
payload.update(scale=self.scale)

if self.raz:
if environment['cloudPlatform'] == 'AWS' or environment['cloudPlatform'] == 'AZURE':
payload.update(enableRangerRaz=self.raz)
else:
self.module.fail_json(msg='GCP Datalakes do not currently support RAZ')
else:
payload.update(enableRangerRaz=self.raz)

if self.tags is not None:
payload['tags'] = list()
for k in self.tags:
Expand Down Expand Up @@ -576,6 +595,12 @@ def _reconcile_existing_state(self, existing):
"need to change the tags, explicitly delete "
"and recreate the Datalake.")

if self.raz:
self.module.warn("Updating an existing Datalake's 'enableRangerRaz' "
"directly is not supported at this time. If you "
"need to change the enableRangerRaz, explicitly delete "
"and recreate the Datalake.")

return mismatched

def _validate_datalake_name(self):
Expand Down Expand Up @@ -603,7 +628,8 @@ def main():
force=dict(required=False, type='bool', default=False),
wait=dict(required=False, type='bool', default=True),
delay=dict(required=False, type='int', aliases=['polling_delay'], default=15),
timeout=dict(required=False, type='int', aliases=['polling_timeout'], default=3600)
timeout=dict(required=False, type='int', aliases=['polling_timeout'], default=3600),
raz=dict(required=False, type="bool", default=False)
),
supports_check_mode=True
)
Expand Down