- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2022 05:26 AM
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.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2022 08:51 PM
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 -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 02:13 AM
Hello Sir,
I have tried with your reference script (MasterChefCloudMgmt/azure-simple-vm) and it got success while executing through Visual Studio whereas it ends up with below error while executing through CPG.
"Version constraints inside provider configuration blocks are deprecated on Provider.tf line 11, in provider "azurerm": 11: version = "2.27.0" Terraform 0.13 and earlier allowed provider version constraints inside the provider configuration block, but that is now deprecated and will be removed in a future version of Terraform. To silence this warning, move the provider version constraint into the required_providers block. Warning: "address_prefix": [DEPRECATED] Use the `address_prefixes` property instead. with azurerm_subnet.internal, on main.tf line 13, in resource "azurerm_subnet" "internal": 13: resource "azurerm_subnet" "internal" { System.Management.Automation.RemoteException Error: "name" may only contain alphanumeric characters, dash, underscores, parentheses and periods System.Management.Automation.RemoteException with azurerm_resource_group.main, on main.tf line 1, in resource "azurerm_resource_group" "main": 1: resource "azurerm_resource_group" "main" { System.Management.Automation.RemoteException (script_include:TerraformExecutor; line 130)"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 03:05 AM
ok at least the terraform provisioning started now so that's progress 🙂 thanks for doing the necessary steps to format the template for using with CPG. this will ensure that the cloud credentials in servicenow is used.
this error is indicating that there's a problem with the way the name is getting a value.. is there a variable for this?
Error: "name" may only contain alphanumeric characters, dash, underscores, parentheses and periods System.Management.Automation.RemoteException with azurerm_resource_group.main, on main.tf line 1, in resource "azurerm_resource_group" "main": 1: resource "azurerm_resource_group" "main"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 03:17 AM
Yes. We have variables in the script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 04:12 AM
Can you share your files?
Ram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 04:52 AM
Provider version = "2.89.0"
After performing, terraform init upgrade , Though we are getting error in ServiceNow CPG, instance is getting deployed in Azure.
Attached error screenshot which I got in CPG.
Note: We have updated Terraform version to 1.1.5
Thanks.