--- title: Add Terraform Orchestration interface on a resource block description: 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. locale: en-US canonical_url: https://www.servicenow.com/docs/r/australia/it-operations-management/cloud-configuration-governance/add-terraform-orchestration-interface.html release: australia product: Cloud Configuration Governance classification: cloud-configuration-governance topic_type: task last_updated: "2026-03-12" reading_time_minutes: 4 breadcrumb: [Resource blocks in Cloud Provisioning and Governance, Cloud Admin Portal, Cloud Provisioning and Governance administration guide, Cloud Provisioning and Governance, ITOM Cloud Accelerate, IT Operations Management] --- # Add Terraform Orchestration interface on a resource block 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 **Design** > **Resource 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 Information** > **Guest 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 Parameters**tab, 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 **Steps** > **Input** 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: `${parameter.arg1}`. 9. Click the **Steps** sub-tab under **Operations**. 10. Click **Add Step**. 11. Fill in the form fields.
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 OpenSource**provider, 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.
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 **Steps** > **Input** 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: `${parameter.arg1}`. **Note:** Map the values as mentioned in the following table for the following parameters:
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} ```
ScriptFor DeleteStack operation ``` ${CloudScript.scripts.DestroyTerraform} ```
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\[Omitted image "add-button.png"\] Alt text: Add Response Processorfor **Add Response Processor**. 17. Click the **Resource Script** sub tab, and then click **New**. 18. Complete the form.
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); } ```
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**. **Parent Topic:**[Resource blocks in Cloud Provisioning and Governance](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/it-operations-management/cloud-configuration-governance/resource-blocks.md)