Receiving flow engine log entries/errors

NajamR
Tera Contributor

To whom it may concern,

 

I hope you are doing well. I am receiving the following logs and errors from the flow engine log entries page, any assistance will be greatly appreciated.

 

I am following the documentation below to create Terraform Catalog Item for requesting resources with custom variable values passed to the Terraform configuration.

 

Example Customizations - ServiceNow Service Catalog Integration - Terraform Cloud | Terraform | Hash...

 

After, implementing all the steps layed out in the above document. I go to create request from the newly created catalog item and it shows me the following flow log entries. 

 

 

Encountered error executing instruction: ActionErrorEvalInstruction{id=8, conditions=[], statusKey=c2o.__action_status__, dontTreatAsErrorKey=c2o.__dont_treat_as_error__}, errorMessage:Error: Cannot read property "terraform_version" from undefined,Detail: Cannot read property "terraform_version" from undefined, errorCode:1

 

 

 

Encountered error executing instruction: OpInstruction{id=6, opClass=com.snc.process_flow.operation.script.ScriptOperation, io=Io{input={sc_req_item=RefOrValue{value=in.request_item, isRef=true}, auto_apply=RefOrValue{value=true, isRef=false}, tf_var_storage=RefOrValue{value=c1o.tf_var_storage, isRef=true}, tf_var_Virtual_Network=RefOrValue{value=c1o.tf_var_Virtual_Network, isRef=true}, mid_cluster=RefOrValue{value=, isRef=false}, sensitive_tf_env_ARM_CLIENT_SECRET=RefOrValue{value=c1o.sensitive_tf_env_ARM_CLIENT_SECRET, isRef=true}, description=RefOrValue{value=c1o.description, isRef=true}, mid_selection_type=RefOrValue{value=any, isRef=false}, tf_var_Virtual_Machine=RefOrValue{value=c1o.tf_var_Virtual_Machine, isRef=true}, sensitive_tf_env_ARM_TENANT_ID=RefOrValue{value=c1o.sensitive_tf_env_ARM_TENANT_ID, isRef=true}, tf_var_vm_size=RefOrValue{value=c1o.tf_var_vm_size, isRef=true}, connection_alias=RefOrValue{value=, isRef=false}, required_run_time=RefOrValue{value=instance, isRef=false}, host=RefOrValue{value=, isRef=false}, tf_var_Resource_Group_Name=RefOrValue{value=c1o.tf_var_Resource_Group_Name, isRef=true}, sensitive_tf_env_ARM_CLIENT_ID=RefOrValue{value=c1o.sensitive_tf_env_ARM_CLIENT_ID, isRef=true}, vcs_repository=RefOrValue{value=c1o.tf_var_vcs_repository, isRef=true}, mid_selection=RefOrValue{value=auto_select, isRef=false}, capabilities=RefOrValue{value=, isRef=false}, mid_server=RefOrValue{value=, isRef=false}, tf_var_Sub_Network=RefOrValue{value=c1o.tf_var_Sub_Network, isRef=true}, queue_all_runs=RefOrValue{value=false, isRef=false}, tf_var_location=RefOrValue{value=c1o.tf_var_location, isRef=true}, tf_var_Network_Interface=RefOrValue{value=c1o.tf_var_Network_Interface, isRef=true}, script=RefOrValue{value=(function execute(inputs, outputs) {
gs.info("Flow Action: Terraform Create Workspace with Variables Started...");

// We will pass in all input variables and only create TF variables following the naming convention
var tf_variables = inputs;

/* Inputs */
var scRequestItem = inputs.sc_req_item;
var scRequestItemNumber = inputs.sc_req_item.number;
var scRequestID = inputs.sc_req;
var workspaceVCS = inputs.tf_var_vcs_repository;
var description = inputs.description;
var queue_all_runs = inputs.queue_all_runs;
var auto_apply = inputs.auto_apply;

// Logging inputs
gs.info("scRequestItem: " + JSON.stringify(scRequestItem));
gs.info("scRequestItemNumber: " + scRequestItemNumber);
gs.info("scRequestID: " + JSON.stringify(scRequestID));
gs.info("workspaceVCS: " + workspaceVCS);
gs.info("description: " + description);
gs.info("queue_all_runs: " + queue_all_runs);
gs.info("auto_apply: " + auto_apply);

/* Instantiate Terraform Classes */
var conf = new tf_config();
var workspace = new tf_workspace();
var terraform_record = new tf_terraform_record();
var vcs_record = new tf_vcs_record();
var terraform_variable = new tf_variable();
var util = new tf_util();

/* Data for the request content */
var workspaceName = workspace.createName(scRequestItemNumber);
var workspaceURL = workspace.createURL(conf, workspaceName);
var requestItemURL = terraform_record.createRecordURL(scRequestItemNumber);
var vcsRecord = vcs_record.get(workspaceVCS);

// Logging intermediate variables
gs.info("workspaceName: " + workspaceName);
gs.info("workspaceURL: " + workspaceURL);
gs.info("requestItemURL: " + requestItemURL);
gs.info("vcsRecord: " + JSON.stringify(vcsRecord));

/* Create request content */
var content = workspace.createRequestContent(vcsRecord, workspaceName, scRequestItemNumber, requestItemURL, description, queue_all_runs, auto_apply);
var requestContent = JSON.stringify(content);

// Logging request content
gs.info("requestContent: " + requestContent);

/* HTTP REST request to Terraform API */
var http = new tf_http("TF Workspaces", "Create Workspace", requestContent);
var workspace_response = http.execute();

// Logging response from Terraform API
gs.info("workspace_response: " + JSON.stringify(workspace_response));

// Check if workspace_response is valid before accessing its properties
if (workspace_response && workspace_response.data) {
var workspace_id = workspace_response.data.id;

/* Create SN Record from response */
var gr = terraform_record.create(workspace_response, scRequestID.sys_id, scRequestItem.sys_id, workspaceURL);

// Create any TF Variables/ENV Variables from the Variable Set.
terraform_variable.createVariablesFromSet(tf_variables, workspace_id);

var comment = util.formatCommentBlockQuote("Terraform: Workspace Created");
terraform_record.postRITMComment(gr.requested_item, comment);

gs.info("Flow Action: Terraform Create Workspace Finished.");

/* Outputs */
outputs.workspace_name = workspaceName;
} else {
gs.error("Error: workspace_response is invalid or undefined.");
outputs.error = "Failed to create Terraform workspace. Response was invalid.";
}
})(inputs, outputs);
, isRef=false}, sc_req=RefOrValue{value=in.request_item, isRef=true}, application=RefOrValue{value=35aa573fd7802200bdbaee5b5e610375, isRef=false}, sensitive_tf_env_ARM_SUBSCRIPTION_ID=RefOrValue{value=c1o.sensitive_tf_env_ARM_SUBSCRIPTION_ID, isRef=true}}, output={__step_status__=s2o.__step_status__, workspace_name=s2o.workspace_name}, defaultOutput={}}, name=ba67501253be8210c6f81cb0a0490ea7, parentActionId=76b84c1e533e8210c6f81cb0a0490e77}
com.snc.process_flow.exception.OpException: Error: Cannot read property "terraform_version" from undefined,Detail: Cannot read property "terraform_version" from undefined
at com.snc.process_flow.operation.script.ScriptOperationBase.handleScriptResult(ScriptOperationBase.java:64)
at com.snc.process_flow.operation.script.ScriptOperationBase.runScript(ScriptOperationBase.java:52)
at com.snc.process_flow.operation.script.ScriptOperation.run(ScriptOperation.java:75)
at com.snc.process_flow.engine.Operation.run2(Operation.java:90)
at com.snc.process_flow.v2.exec.OpRunner.runOperation(OpRunner.java:73)
at com.snc.process_flow.v2.exec.OpRunner.runOperation(OpRunner.java:67)
at com.snc.process_flow.v2.exec.OpInstructionExecutor.runOperation(OpInstructionExecutor.java:60)
at com.snc.process_flow.v2.exec.OpInstructionExecutor.execute(OpInstructionExecutor.java:27)
at com.snc.process_flow.v2.exec.OpInstructionExecutor.execute(OpInstructionExecutor.java:16)
at com.snc.process_flow.v2.exec.EngineV2.executeInstructions(EngineV2.java:176)
at com.snc.process_flow.v2.exec.EngineV2.run(EngineV2.java:102)
at com.snc.process_flow.v2.exec.EngineRunner.lambda$run$0(EngineRunner.java:28)
at com.snc.process_flow.v2.exec.enviroment.execution.ExecutionScopeRunner.run(ExecutionScopeRunner.java:37)
at com.snc.process_flow.v2.exec.EngineRunner.run(EngineRunner.java:28)
at com.snc.process_flow.engine.EngineV2Adapter.runWithExecutionResult(EngineV2Adapter.java:249)
at com.snc.process_flow.engine.EngineV2Adapter.resumeWithExecutionResult(EngineV2Adapter.java:366)
at com.snc.process_flow.engine.ProcessAutomation.runWithExecutionResult(ProcessAutomation.java:111)
at com.snc.process_flow.engine.ProcessAutomation.run(ProcessAutomation.java:74)
at com.snc.process_flow.engine.GlideProcessAutomation.runSync(GlideProcessAutomation.java:216)
at com.snc.process_flow.engine.GlideProcessAutomation.runWithDomain(GlideProcessAutomation.java:376)
at com.snc.process_flow.engine.GlideProcessAutomation.lambda$runAsUserSync$1(GlideProcessAutomation.java:341)
at com.snc.process_flow.engine.PFSessionClone.run(PFSessionClone.java:71)
at com.snc.process_flow.engine.GlidePFSession.runPlanAsUserSession(GlidePFSession.java:42)
at com.snc.process_flow.engine.GlideProcessAutomation.runAsUserSync(GlideProcessAutomation.java:339)
at com.snc.process_flow.engine.GlideProcessAutomation.messageFlow(GlideProcessAutomation.java:427)
at com.snc.process_flow.engine.GlideProcessAutomation.messageFlow(GlideProcessAutomation.java:406)
at com.snc.process_flow.engine.ProcessHubEventHandler.doSendMessage(ProcessHubEventHandler.java:525)
at com.snc.process_flow.engine.ProcessHubEventHandler.process(ProcessHubEventHandler.java:143)
at com.snc.process_flow.engine.ProcessHubEventHandler.process(ProcessHubEventHandler.java:106)
at com.snc.process_flow.engine.FlowEventManager.processEvents(FlowEventManager.java:168)
at com.glide.job.EventHandlerJob.execute(EventHandlerJob.java:50)
at com.glide.schedule.JobExecutor.lambda$executeJob$1(JobExecutor.java:194)
at com.glide.schedule.JobExecutor.executeJob(JobExecutor.java:197)
at com.glide.schedule.JobExecutor.execute(JobExecutor.java:177)
at com.glide.schedule.JobExecutor.execute(JobExecutor.java:167)
at com.glide.schedule_v2.SchedulerWorkerThread.executeJob(SchedulerWorkerThread.java:577)
at com.glide.schedule_v2.SchedulerWorkerThread.lambda$process$2(SchedulerWorkerThread.java:396)
at com.glide.worker.TransactionalWorkerThread.executeInTransaction(TransactionalWorkerThread.java:35)
at com.glide.schedule_v2.SchedulerWorkerThread.process(SchedulerWorkerThread.java:396)
at com.glide.schedule_v2.SchedulerWorkerThread.run(SchedulerWorkerThread.java:172)

 

 

1 REPLY 1

kachchi_r
Tera Contributor

Try logging out and logging in again. It worked for me.