Sentinel http import post call

I need to send current terraform run details through sentinel policy to Jira ticket as a comment
I’m trying using tfrun import for run details and HTTP import to add comments to the Jira ticket.
But I am unable to do that. Can someone help me?
error calling function “post”: expected status code to be one of [200], got 400

@hcrhall Can you please share with me an example?

@hemanth

Take a look at the following:

Hope this helps.

Regards,

RH.

@hcrhall Thanks for your response.

I’m testing using the below code. Still getting the 400 error. Is there anything I’m doing wrong?

breakdown = func() {

  body = string("Comment added when resolving issue")

  request = http.request("https://{jira}/rest/api/2/issue/{issuekey}/comment").
    with_basic_auth(jira_user, jira_pass).
    with_header("Content-Type", "application/json").
    with_body(body)

  response = http.post(request)

  return json.unmarshal(response.body)
}

error calling function “post”: expected status code to be one of [200], got 400

I’m able to do the same through curl command.

Able to resolve it. Thanks

@hemanth

Can you share the solution so other folks know how the enable this use case with Sentinel?

Thanks!