Set up ServiceNow Service Catalog integration for HCP Terraform
Integration version: v2.7.0
The Terraform ServiceNow Service Catalog integration enables your end-users to provision self-serve infrastructure via ServiceNow. By connecting ServiceNow to HCP Terraform, this integration lets ServiceNow users order Service Items, create workspaces, and perform Terraform runs using prepared Terraform configurations hosted in VCS repositories or as no-code modules for self-service provisioning.
Note: The ServiceNow Catalog integration is available in HCP Terraform Plus Edition. Refer to HCP Terraform pricing for details.
Summary of the Setup Process
The integration relies on Terraform ServiceNow Catalog integration software installed within your ServiceNow instance. Installing and configuring this integration requires administration in both ServiceNow and HCP Terraform. Since administrators of these services within your organization are not necessarily the same person, this documentation refers to a ServiceNow Admin and a Terraform Admin.
First, the Terraform Admin configures your HCP Terraform organization with a dedicated team for the ServiceNow integration, and obtains a team API token for that team. The Terraform Admin provides the following to your ServiceNow admin:
- An Organization name
- A team API token
- The hostname of your HCP Terraform instance
- Any available no-code modules or version control repositories containing Terraform configurations
- Other required variables token, the hostname of your HCP Terraform instance, and details about no-code modules or version control repositories containing Terraform configurations and required variables to the ServiceNow Admin.
Next, the ServiceNow Admin will install the Terraform ServiceNow Catalog integration to your ServiceNow instance, and configure it using the team API token and hostname.
Finally, the ServiceNow Admin will create a Service Catalog within ServiceNow for the Terraform integration, and configure it using the version control repositories or no-code modules, and variable definitions provided by the Terraform Admin.
ServiceNow Admin | Terraform Admin |
---|---|
Prepare an organization for use with the ServiceNow Catalog. | |
Create a team that can manage workspaces in that organization. | |
Create a team API token so the integration can use that team's permissions. | |
If using VCS repositories, retrieve the OAuth token IDs and repository identifiers that HCP Terraform uses to identify your VCS repositories. If using a no-code flow, create a no-code ready module in your organization's private registry. Learn more in Configure VCS Repositories or No-Code Modules. | |
Provide the API token, OAuth token ID, repository identifiers, variable definitions, and HCP Terraform hostname to the ServiceNow Admin. | |
Install the Terraform integration application from the ServiceNow App Store. | |
Connect the integration application with HCP Terraform. | |
Add the Terraform Service Catalog to ServiceNow. | |
If you are using the VCS flow, configure the VCS repositories in ServiceNow. | |
Configure variable sets for use with the VCS repositories or no-code modules. |
Once these steps are complete, self-serve infrastructure will be available through the ServiceNow Catalog. HCP Terraform will provision and manage requested infrastructure and report the status back to ServiceNow.
Prerequisites
To start using Terraform with the ServiceNow Catalog Integration, you must have:
- An administrator account on a Terraform Enterprise instance or within a HCP Terraform organization.
- An administrator account on your ServiceNow instance.
- If you are using the VCS flow, one or more supported version control systems (VCSs) with read access to repositories with Terraform configurations.
- If you are using no-code provisioning, one or more no-code modules created in your organization's private registry. Refer to the no-code module configuration for information about using no-code modules with the ServiceNow Service Catalog for Terraform.
You can use this integration on the following ServiceNow server versions:
- Utah
- Vancouver
- Washington DC
- Xanadu
It requires the following ServiceNow plugins as dependencies:
- Flow Designer support for the Service Catalog (
com.glideapp.servicecatalog.flow_designer
) - ServiceNow IntegrationHub Action Step - Script (
com.glide.hub.action_step.script
) - ServiceNow IntegrationHub Action Step - REST (
com.glide.hub.action_step.rest
)
Note: Dependent plugins are installed on your ServiceNow instance automatically when the app is downloaded from the ServiceNow Store.
Configure HCP Terraform
Before installing the ServiceNow integration, the Terraform Admin will need to perform the following steps to configure and gather information from HCP Terraform.
- Either create an organization or choose an existing organization where ServiceNow will create new workspaces. Save the organization name for later.
- Create a team for that organization called "ServiceNow", and ensure that it has permission to manage workspaces. You do not need to add any users to this team.
- On the "ServiceNow" team's settings page, generate a team API token. Save the team API token for later.
- If you are using the VCS flow:
- Ensure your Terraform organization is connected to a VCS provider. Repositories that are connectable to HCP Terraform workspaces can also be used as workspace templates in the ServiceNow integration.
- On your organization's VCS provider settings page (Settings > VCS Providers), find the OAuth Token ID for the VCS provider(s) that you intend to use with the ServiceNow integration. HCP Terraform uses the OAuth token ID to identify and authorize the VCS provider. Save the OAuth token ID for later.
- Identify the VCS repositories in the VCS provider containing Terraform configurations that the ServiceNow Terraform integration will deploy. Take note of any Terraform or environment variables used by the repositories you select. Save the Terraform and environment variables for later.
- If using the no-code flow, create one or more no-code modules in the private registry of your HCP Terraform. Save the no-code module names for later.
- Provide the following information to the ServiceNow Admin:
- The organization name
- The team API token
- The hostname of your Terraform Enterprise instance, or of HCP Terraform. The hostname of HCP Terraform is
app.terraform.io
. - The no-code module name(s) or the OAuth token ID(s) of your VCS provider(s), and the repository identifier for each VCS repository containing Terraform configurations that will be used by the integration.
- Any Terraform or environment variables required by the configurations in the given VCS repositories.
Note: Repository identifiers are determined by your VCS provider; they
typically use a format like <ORGANIZATION>/<REPO_NAME>
or
<PROJECT_KEY>/<REPO_NAME>
. Azure DevOps repositories use the format
<ORGANIZATION>/<PROJECT>/_git/<REPO_NAME>
. A GitHub repository hosted at
https://github.com/exampleorg/examplerepo/
would have the repository
identifier exampleorg/examplerepo
.
For instance, if you are configuring this integration for your company, Example
Corp
, using two GitHub repositories, you would share values like the following
with the ServiceNow Admin.
Terraform Enterprise Organization Name: `ServiceNowExampleOrg` Team API Token: `q2uPExampleELkQ.atlasv1.A7jGHmvufExampleTeamAPITokenimVYxwunJk0xD8ObVol054` Terraform Enterprise Hostname: `terraform.corp.example` OAuth Token ID (GitHub org: example-corp): `ot-DhjEXAMPLELVtFA` - Repository ID (Developer Environment): `example-corp/developer-repo` - Environment variables: - `AWS_ACCESS_KEY_ID=AKIAEXAMPLEKEY` - `AWS_SECRET_ACCESS_KEY=ZB0ExampleSecretAccessKeyGjUiJh` - `AWS_DEFAULT_REGION=us-west-2` - Terraform variables: - `instance_type=t2.medium` - Repository ID (Testing Environment): `example-corp/testing-repo` - Environment variables: - `AWS_ACCESS_KEY_ID=AKIAEXAMPLEKEY` - `AWS_SECRET_ACCESS_KEY=ZB0ExampleSecretAccessKeyGjUiJh` - `AWS_DEFAULT_REGION=us-west-2` - Terraform variables: - `instance_type=t2.large`
Install the ServiceNow Integration
Before beginning setup, the ServiceNow Admin must install the Terraform ServiceNow Catalog integration software.
This can be added to your ServiceNow instance from the ServiceNow Store. Search for the "Terraform" integration, published by "HashiCorp Inc".
Connect ServiceNow to HCP Terraform
ServiceNow Roles: admin
or x_terraform.config_user
Once the integration is installed, the ServiceNow Admin can connect your ServiceNow instance to HCP Terraform. Before you begin, you will need the information described in the "Configure HCP Terraform" section from your Terraform Admin.
Once you have this information, connect ServiceNow to HCP Terraform with the following steps.
- Navigate to your ServiceNow Service Management Screen.
- Using the left-hand navigation, open the configuration table for the
integration to manage the HCP Terraform connection.
- Terraform > Configs
- Click on "New" to create a new HCP Terraform connection.
- Set Org Name to the HCP Terraform organization name.
- Click on the "Lock" icon to set Hostname to the hostname of your Terraform
Enterprise instance. If you are using the SaaS version of HCP Terraform,
the hostname is
https://app.terraform.io
. Be sure to include "https://" before the hostname. - Set API Team Token to the HCP Terraform team API token.
- (Optional) To use the MID Server,
select the checkbox and type the
name
in theMID Server Name
field.
- Click "Submit".
Create and Populate a Service Catalog
Now that you have connected ServiceNow to HCP Terraform, you are ready to create a Service Catalog using the VCS repositories or no-code modules provided by the Terraform Admin.
Navigate to the Service Catalog documentation to begin. You can also refer to this documentation whenever you need to add or update request items.
ServiceNow Developer Reference
ServiceNow developers who wish to customize the Terraform integration can refer to the developer documentation.
ServiceNow Administrator's Guide.
Refer to the ServiceNow Administrator documentation for information about configuring the integration.
Example Customizations
Once the ServiceNow integration is installed, you can consult the example customizations documentation.