Create a resource block for Microsoft Azure Cloud
Resource blocks are the building blocks of cloud catalog items. Create a resource block for the Microsoft Azure Cloud Platform provider, based on a CI type from the CMDB.
Vorbereitungen
Prozedur
- In the Cloud Admin Portal, navigate to Design > Resource Blocks.
-
Click New to open the Create Resource Block dialog box and then fill in the form.
For a detailed description of each field, see Create a custom resource block.
Field Description Name Enter a name (Azure Datacenter) for the resource block. Description Enter a valid description Layer Select the type of resource block (Logical Datacenter). CI Type Select the CI type (Azure Datacenter) that the resource block represents. Guest Interface Select a default guest interface (Compute Interface) to use when you add a resource block to a template. -
Click Submit.
The resource block information appears.
-
Click the Resource Script sub tab and then click New.
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); } - Click Submit.
- Click the Operations sub tab and then click Steps.
- Select CreateStack from the Operations list.
-
Click the Add a Step plus icon to open the Add Operation Steps dialog box and then fill in the form.
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 [Operation Type = Invoke Cloud API]
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 [Operation Type = Invoke Cloud API]
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 [Operation Type = Invoke Cloud API]
Select the method to perform the operation. In this example, ExecuteCommand is required to provision terraform templates. CAPI Version [Operation Type = Invoke Cloud API]
Enter the version of the CAPI API. Condition Enter an optional condition that must be met before the system uses this step. - Click Submit.
-
Click Response Processor and then click the plus icon.
The Add Response Processor dialog box appears.
- Select Create_AzureTF_Stack_Response_Processor from the Script Name list and click Submit.
-
Move the state of the resource block from Draft to Published.
The Azure Datacenter resource block moves from the draft to the published state and no further changes can be made to the resource block. Changes to a resource block can be made only if the status is set to Draft.