-
Notifications
You must be signed in to change notification settings - Fork 0
/
ef_servicenow.tf
59 lines (48 loc) · 1.29 KB
/
ef_servicenow.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
resource "snowflake_external_function" "servicenow_create_incident" {
count = contains(var.handlers, "servicenow") == true ? 1 : 0
provider = snowflake.alerting_role
database = local.snowalert_database_name
schema = local.results_schema
name = "SERVICENOW_CREATE_INCIDENT"
# Function arguments
arg {
name = "PAYLOAD"
type = "STRING"
}
# Function headers
header {
name = "method"
value = "post"
}
header {
name = "url"
value = var.servicenow_api_url
}
header {
name = "json"
value = "{0}"
}
header {
name = "auth"
value = var.servicenow_secrets_arn
}
return_null_allowed = true
max_batch_rows = 1
api_integration = module.geff_snowalert[0].api_integration_name
url_of_proxy_and_resource = "${module.geff_snowalert[0].api_gateway_invoke_url}${var.env}/https"
return_type = "VARIANT"
return_behavior = "VOLATILE"
comment = <<COMMENT
servicenow_create_incident: (payload) -> response
COMMENT
depends_on = [
module.snowalert_grants
]
}
locals {
servicenow_create_incident = contains(var.handlers, "servicenow") == true ? join(".", [
local.snowalert_database_name,
local.results_schema,
snowflake_external_function.servicenow_create_incident[0].name,
]) : null
}