Getting error while executing Terraform script in ServiceNow

Venkatesh S5
Kilo Contributor

Hello Team,

While we are trying to launch launch stack (Terraform code) in ServiceNow, it ends up with "  Failed to execute API - Please input value for credential field(s) -UserName, Password. (script_include:TerraformExecutor; line 56)".

Note: We have updated the credentials in Cloud admin portal already. 

Please feel free to share your thoughts for further analysis. 

1 ACCEPTED SOLUTION

Ram Devanathan1
ServiceNow Employee
ServiceNow Employee

you need to modify the terraform files to add empty vars like this into the vars.tf -

#File =vars.tf
variable "vsphere_user" {}
variable "vsphere_password" {}
variable "vsphere_server" {}

and reference these vars in your provider block -

#File =provider.tf
# Configure the VMware vSphere Provider
provider "vsphere" {
 user = var.vsphere_user
 password = var.vsphere_password
 vsphere_server = var.vsphere_server
 # if you have a self-signed cert
 allow_unverified_ssl = true
}

for azure and aws this can be different, just look at standard provider block documentation for each provider and setup vars like this.

Once this is done, CPG will ensure that the creds are passed at runtime into the vars to eventually be used by Terraform.

you can look for reference / examples here -

https://github.com/MasterChefCloudMgmt

View solution in original post

11 REPLIES 11

sorry terraform 1x is not supported. pl refer rls notes. we plan to support terraform 1x in roadmap, but timeframe is not yet decided.

feel free to reach out offline at ramkumar<dot>devanathan<AT>servicenow<dot>com

Thank you Ram for your assistance. 

 

Now we are able to execute Terraform scripts from ServiceNow after downgrading the Terraform version to 0.12.

 

Thank you