---
sourceDocument: Yokohama IT Operations Management
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/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


---

# Add Terraform Orchestration interface on a resource block

# Add Terraform Orchestration interface on a resource block {#ariaid-title1}

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

After you have activated the Terraform store app for Cloud Provisioning and Governance, to support cloud-based operations for cloud providers
using Terraform Open Source Edition. Add the Terraform Orchestration interface on resource
block, to execute cloud-based operations via terraform templates.

## Before you begin

Role required: sn_cmp.cmp_root_admin, sn_cmp.cloud_service_designer

## Procedure

1. On the Cloud Admin portal, navigate to DesignResource Block.
2. Click the resource block, for example Azure Datacenter.
3. Move the state of the resource block from Published to Draft to make it editable.
4. Navigate to General InformationGuest Interface, and then click New.
5. Search for and select the Terraform Orchestration Interface from the Guest Interface list, and click Submit.
6. Click the Operations tab.
7. In the Input Parameterstab, navigate to Interface and select Terraform Orchestration Interface
8. On the Input Parameters tab, configure the CAPI operation inputs.  
   On the CAPI interface, which in this case is Terraform Orchestration Interface, open CreateStack
   method. The inputs from CAPI display on the Input tab, where you create
   parameters.

   The Input Parameters tab is where users enter values.
   You can map those input parameters to the parameters on the
   Input tab. To do this, copy the
   Mapping value from the Input Parameters tab into the Value field
   on the StepsInput tab.

   If this step is invoking a script, and that script requires arguments to
   return values, you can add a new input parameter for each argument. Use this
   syntax in the Value field:
   <kbd class="ph userinput">${parameter.arg1}</kbd>.
9. Click the Steps sub-tab under Operations.
10. Click Add Step.
11. Fill in the form fields.  
    {#add-terraform-orchestration-interface__table_q1n_4qw_52b__entry__2}

    | Field | Description |
    |-|-|
    | Operation Type | Select the type of operation. Invoke Cloud API: Select this option to select a provider, interface, and method from CAPI. |
    | API Provider | Select the API that provides the interfaces you need. The providers are part of the Cloud API (CAPI). For example, CAPI supplies the Terraform OpenSourceprovider, which provides the Configuration Orchestration Interface. This value appears if you select the Invoke Cloud API operation type. |
    | API Interface | Select the interface that has the methods you want to use. For this example, the Configuration Orchestration Interface provides multiple interfaces or methods, which the system uses during provisioning. |
    | API Method | Select the method to perform the operation. In this example, ExecuteCommand is required to provision terraform templates. |
    | CAPI Version | Enter the version of the CAPI API. |
    | Condition | Enter an optional condition that must be met before the system uses this step. |
    [ ]

    {#add-terraform-orchestration-interface__table_q1n_4qw_52b}
12. Click Submit.  
    The Input and Response Processor tabs appear for the step.
13. On the Input tab, configure the CAPI operation inputs.  
    On the CAPI interface, which in this case is Configuration Orchestration Interface, open
    ExecuteCommand method. The inputs from CAPI show on
    the Input tab, where you create parameters.

    Remember that the parameters on the Input Parameters
    tab is where users enter values. You can map those input parameters to the
    parameters on the Input tab. Copy the
    Mapping value from the Input Parameters tab into the Value field
    on the StepsInput tab.

    If this step is invoking a script, and that script requires arguments to
    return values, you can add a new input parameter for each argument. Use this
    syntax in the Value field:
    <kbd class="ph userinput">${parameter.arg1}</kbd>.  
    Note:  
    Map the values as mentioned in the following table for the following parameters:
    {#add-terraform-orchestration-interface__table_kr1_4fz_kjb__entry__2}

    | Parameter | Value |
    |-|-|
    | AdditionalParameters | Enter the following script: {"ServerType":"$(Script:sn_cmp_terraform.TerraformCommandUtils. getConfigProviderServerTypeByName[arg=${parameter.WorkloadConfigProvider}])"} |
    | ConfigMgmtProviderInfo | $(capiResolver.NodeCredentialResolver#nodeCredentialId=$(ci.sn_cmp_wl_cfg_mgmt_provider [name=${parameter.WorkloadConfigProvider}].credential)) |
    | Node Address | $(ci.cmdb_ci_workload_config_provider[name=${parameter.WorkloadConfigProvider}].url) |
    | Script For CreateStack operation | ${CloudScript.scripts.TerraformDeploy} |
    | Script For DeleteStack operation | ${CloudScript.scripts.DestroyTerraform} |
    [ ]

    {#add-terraform-orchestration-interface__table_kr1_4fz_kjb}
14. On the Response Processor tab, configure the response processors by attaching resource scripts.  
    You would have added Resource Scripts to the resource block, while creating the Resource Block.
15. From the Operation list, select the CreateStack or DeleteStack operation.
16. Click the add icon![Add Response Processor]()for Add Response Processor.
17. Click the Resource Script sub tab, and then click New.
18. Complete the form.  
    {#add-terraform-orchestration-interface__table_hwh_cw2_pdb__entry__2}

    | Field | Description |
    |-|-|
    | Name | Enter a name (For example, Create_AzureTF_Stack_Response_Processor) for the resource script. |
    | Type | Select a type (Response Processor) for the script. |
    | Script Resource Script for Create | Enter the following script: function processResponse (response, cloudServiceAccountId, ldc, correlationId, step, requestorContext, stackId) { var responseObject = global.JSON.parse(response); var tfState = global.JSON.parse(responseObject.terraform.state); var processor = new sn_cmp_terraform.TerraformResponseProcessor(); var processedResponses = processor.processResponse(tfState, cloudServiceAccountId,  ldc, correlationId, step, requestorContext, stackId); return global.JSON.stringify(processedResponses); } |
    | Script Resource Script for Delete | Enter the following script: function processResponse (response, cloudServiceAccountId, ldc, correlationId, step, requestorContext, stackId) { var responseObject = global.JSON.parse(response); var tfState = global.JSON.parse(responseObject.terraform.state); var processor = new sn_cmp_terraform.TerraformResponseProcessor(); var processedResponses = processor.processResponse(tfState, cloudServiceAccountId,  ldc, correlationId, step, requestorContext, stackId); return global.JSON.stringify(processedResponses); } |
    [Table 1. New Record]

    {#add-terraform-orchestration-interface__table_hwh_cw2_pdb}
19. From the Script Name list, select the script corresponding to the selected operation, and click Submit.
20. Move the state of the resource block from Draft to Published.  
    The datacenter resource block moves from the draft to the published state and you cannot make further changes to the resource block. You can only modify a resource block after you set the status to Draft.

*[\>]: and then


