sparse-intern-71089
03/14/2022, 5:45 PMprehistoric-activity-61023
03/14/2022, 5:48 PMcreate_app_role
body?prehistoric-activity-61023
03/14/2022, 5:51 PMOutput[str]
to str
due to its lazy evaluation features. I guess, you’re trying to modify somehow the endpoint
argument within create_app_role
.
I don’t know the whole picture but would it be a problem for you to accept Input[str]
instead of str
in this function and perform apply
on it?fast-spoon-69536
03/14/2022, 7:18 PMdef create_app_role(host,admin_username,admin_password,payload,role_name):
#logging.basicConfig(filename='example.log', encoding='utf-8', level=logging.DEBUG)
#logging.debug('This message should go to the log file')
url = 'https://' + host + '/_plugins/_security/api/roles/' + role_name
basic_creds = admin_username + ':' + admin_password
base64_bytes = base64.standard_b64encode(basic_creds.encode('utf-8'))
base64_message = base64_bytes.decode('utf-8')
headers = {
'Content-Type': 'application/json',
'Authorization': 'Basic ' + base64_message
}
http = urllib3.PoolManager()
resp = http.request(
"GET",
url,
headers=headers
)
#print(resp)
if resp.status == 404:
print('404 Role not found')
#logging.debug('404 Role not found')
print('Adding custom role')
app_role_payload_bytes = json.dumps(payload).encode('ascii')
resp = http.request(
"PUT",
url,
body=app_role_payload_bytes,
headers=headers
)
else:
print('Role exists ')
prehistoric-activity-61023
03/14/2022, 7:51 PMInput[str]
instead of str
, you could do:
url = pulumi.Output.concat('https://', host, '/_plugins/_security/api/roles/', role_name)
within that functionprehistoric-activity-61023
03/14/2022, 7:51 PMprehistoric-activity-61023
03/14/2022, 7:52 PMprehistoric-activity-61023
03/14/2022, 7:53 PMfast-spoon-69536
03/15/2022, 6:18 PMprehistoric-activity-61023
03/15/2022, 6:35 PMfast-spoon-69536
03/16/2022, 12:05 PM