Skip to content

Commit 072adc2

Browse files
authored
Merge pull request #20 from SPHTech-Platform/fix/ext-id-logic
change the python output to check the status
2 parents 0ddf98d + 8729ade commit 072adc2

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

lambda.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ resource "aws_lambda_invocation" "external_id" {
2929
})
3030

3131
depends_on = [
32+
module.lambda,
3233
aws_secretsmanager_secret_version.aqua_cspm_secret,
3334
]
3435
}

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
output "onboarding_data" {
22
description = "Details of the onboarding"
3-
value = jsondecode(aws_lambda_invocation.onboarding.result)["data"]
3+
value = jsondecode(aws_lambda_invocation.onboarding.result)
44
}

src/lambda_function/index.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ def lambda_handler(event, ctxt):
3434
for i in range(max_attempts):
3535
try:
3636
extid = get_ext_id(aqua_url, aqua_api_key, aqua_secret)
37-
resData = {'ExternalId': extid}
38-
return resData
37+
sucExtID = {'status': 'SUCCESS', 'ExternalId': extid}
38+
return sucExtID
3939
except Exception as e:
4040
LOGGER.error(e)
4141
if i == max_attempts - 1:
@@ -48,13 +48,11 @@ def lambda_handler(event, ctxt):
4848
group = rp['Group']
4949
role_arn = rp['RoleArn']
5050
acc = rp['AccId']
51-
onbData = {}
5251
try:
5352
g_id = get_gid(aqua_url, aqua_api_key, aqua_secret, group)
5453
register(aqua_url, aqua_api_key, aqua_secret, acc, role_arn, extid, g_id)
5554
LOGGER.info(f'Account registered {acc}')
56-
onbData = {'AccountId': acc, 'Registered': True}
57-
sucMsg = {'status': 'SUCCESS', 'data': onbData}
55+
sucMsg = {'status': 'SUCCESS', 'AccountId': acc, 'Registered': True}
5856
return sucMsg
5957
except Exception as e:
6058
LOGGER.error(e)
-14 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)