---
sourceDocument: Yokohama IT Operations Management
sourceDocumentLink: https://www.servicenow.com/docs/r/yokohama/it-operations-management

 Release :

    - yokohama

ft:locale :

    - en-US

ft:publication_title :

    - Yokohama IT Operations Management

ft:clusterId :

    - itom

bundleId :

    - itom

workflow :

    - Technology


---

# Run the IaC Discovery

# Run the IaC Discovery {#ariaid-title1}

* Release version: Yokohama
* 
* Updated January 30, 2025
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 3 minutes to read

Run the Infrastructure as Code (IaC) discovery to identify the resources of the Terraform environment.

## Before you begin

* Ensure that you have the appropriate API credentials for the Version Control System (VCS) accounts provisioned in the Terraform Enterprise or Terraform Cloud organizations. For more information, see [Create API key credentials for the Terraform account and the supported VCS account](https://www.servicenow.com/docs/N2dvZDKjnzmmi2~MAs0pFg "Create API key credential for Terraform account and supported Version Control System (VCS) accounts that contain the Terraform template repositories.").
* Ensure that Terraform Open Source folders which contain the Terraform templates have unique names. If several Terraform template folders have the same name, multiple change tasks are created even though all the templates mayn't contain variable changes.
{#discover-terraform-config-installables-vcs-workspaces__ul_kln_l54_w5b}

Role required: sn.cmp.cloud_service_designer

## About this task

Depending on the configuration provider, Cloud Provisioning and Governance: Terraform Connector discovers the following resources from the Terraform environment:

Terraform Open Source
:   The IaC Discovery discovers the config installables (Terraform templates) from the Terraform Open Source server.

Terraform Enterprise or Terraform Cloud
:   The IaC Discovery discovers the following items:

    * Workspaces: Terraform workspaces provisioned in the Terraform organization.
    * VCS: VCS repositories and branches provisioned in the Terraform organization.
    * Agent pools: Terraform Cloud uses agents and agent
      pools to communicate with on-premise infrastructure. Deploy
      agents in the same network as your infrastructure to establish a
      connection between the infrastructure and Terraform Cloud. For more information on agents
      and agent pools, see [Terraform Cloud agents](https://www.terraform.io/cloud-docs/agents).

      Cloud Provisioning and Governance: Terraform Connector discovers the agent pools created in the Terraform Cloud. You can view the discovered agents in the Config Management module for your config provider. On the catalog order form, an agent pool filter enables you select an active agent to communicate with the private VMware infrastructure.  
      Note:  
      You can see agent pools option in the config management form and the catalog order form when the following conditions are met:
      * You have created the VMware agent pools in the Terraform Cloud organization.
      * You have VMware templates for Terraform Enterprise.
      {#discover-terraform-config-installables-vcs-workspaces__ul_v3z_dl4_w5b}
    * Cfg installables: Terraform templates stored in the repositories of the VCS account provisioned the Terraform organization.  
      Note:  
      To discover the Terraform templates from the VCS, Cloud Provisioning and Governance: Terraform Connector requires the API key credentials of the VCS account.
    {#discover-terraform-config-installables-vcs-workspaces__ul_lq4_s1p_p5b}

## Procedure

1. Navigate to AllCloud Provisioning and GovernanceCloud Admin Portal.  
   The Cloud Admin Portal opens in a new browser tab.
2. On the Cloud Admin Portal, navigate to ManageConfig Management.
3. Select the Terraform provider card.
4. Select Discover Now.  
   Note:  
   You can't cancel the IaC Discovery job after triggering it.
5. **Optional:** To use Cloud Provisioning and Governance: Terraform Connector with Terraform Enterprise or Terraform Cloud, discover the Terraform templates stored in the provisioned VCS.
   1. Select the Tfe Vcs tab.
   2. From the Tfe Vcs list, select the VCS account that contains the Terraform templates you want to use for Cloud Provisioning and Governance catalog item creation. {#discover-terraform-config-installables-vcs-workspaces__cpg-tf-connector-select-vcs-record}
   {#discover-terraform-config-installables-vcs-workspaces__cpg-tf-connector-select-vcs-record}
   3. From the Credentials drop-down list, select the API credential of the selected VCS account. {#discover-terraform-config-installables-vcs-workspaces__cpg-tf-connector-attach-vcs-credentials}
   {#discover-terraform-config-installables-vcs-workspaces__cpg-tf-connector-attach-vcs-credentials}
   4. From the Related Links, select Find Branches and Repositories. {#discover-terraform-config-installables-vcs-workspaces__cpg-tf-connector-find-vcs-repo-branches}
   {#discover-terraform-config-installables-vcs-workspaces__cpg-tf-connector-find-vcs-repo-branches}
   5. Repeat step [5.b](https://www.servicenow.com/docs/YZNDuxdo~NHN2cok4nupQg#discover-terraform-config-installables-vcs-workspaces__cpg-tf-connector-select-vcs-record) to [5.d](https://www.servicenow.com/docs/YZNDuxdo~NHN2cok4nupQg#discover-terraform-config-installables-vcs-workspaces__cpg-tf-connector-find-vcs-repo-branches) for all VCS accounts that contain the Terraform templates you want to use for Cloud Provisioning and Governance catalog item creation.
   {#discover-terraform-config-installables-vcs-workspaces__substeps_zmc_cnp_p5b}
6. Create an Infrastructure as Code (Iac) discovery schedule.  
   IaC discovery schedule helps to discover new Terraform templates, workspaces, agent pools, and VCS branches for the specified config provider. It also detects changes in the already discovered Terraform templates. When Cloud Provisioning and Governance: Terraform Connector detects a change in the template variable or the template metadata, it automatically creates IaC change tasks for the affected catalog items.
   1. On the Cloud Admin portal, navigate to ManageIaC Discovery.
   2. Select New.
   3. On the form, fill in the fields.  
      {#discover-terraform-config-installables-vcs-workspaces__table_wqs_cv5_p5b__entry__2}

      | Field | Description |
      |-|-|
      | Name | Unique and descriptive name of the IaC Discovery schedule. |
      | Provider | Config management provider for which you are creating the discovery schedule. |
      | Active | Option to activate or deactivate the schedule. |
      | Run | Frequency of schedule execution. Configure the schedule execution frequency in the Run field and its associated form fields. |
      [Table 1. IaC Discovery Schedulers form]

      {#discover-terraform-config-installables-vcs-workspaces__table_wqs_cv5_p5b}
   4. Select Submit.
   {#discover-terraform-config-installables-vcs-workspaces__substeps_e23_j44_p5b}

## What to do next

* [Use multiple repositories structure with Terraform Connector app](https://www.servicenow.com/docs/KpQ7ukIXu3d4OYqOMtq5LQ "You can now discover multiple Terraform configurations from one repository, at any folder level with Terraform Enterprise Config Provider.") with IaC Discovery
* If Cloud Provisioning and Governance: Terraform Connector discovers new Terraform templates that you want to use for cloud resource provisioning, create a catalog item from the discovered template. For more information, see [Create a catalog item from the Terraform template](https://www.servicenow.com/docs/eg3__mvq0PtiwOXDHCsnkg "Create a catalog item from the Terraform template to request cloud resource provisioning. Activated catalog items appear in the cloud user portal.").
* If Cloud Provisioning and Governance: Terraform Connector has discovered changes in an existing template, take one of the following actions to resolve the associated IaC change task:
  * Update the affected catalog item per the updated Terraform template.
  * Deactivate the affected catalog item, and then create a catalog item per the updated template.

  {#discover-terraform-config-installables-vcs-workspaces__ul_aq5_ry5_p5b}For more information, see [Manage the Terraform template-based catalog items](https://www.servicenow.com/docs/BGWw4mIvrrYTLQir80wnAA "Use an Infrastructure as Code (IaC) change task to create or update the Terraform template-based catalog items. The IaC change task helps ensure that the catalog items are aligned with the latest infrastructure specifications coded in the Terraform template.").
{#discover-terraform-config-installables-vcs-workspaces__ul_m2r_yx5_p5b}

*[\>]: and then


