Skip to content

Latest commit

 

History

History
125 lines (77 loc) · 3.78 KB

File metadata and controls

125 lines (77 loc) · 3.78 KB

SAP Automation > V1.0.0 > Terraform > Units > SAP Library

Deployment

Common Setup

This step may have been previously completed

  1. Create an SAP Automation root directory and descend into the newly created <automation_root>

    mkdir <automation_root> && cd $_

  2. Clone the Repository.

    • HTTPS

      git clone https://github.com/Azure/sap-hana.git

    • SSH

      git clone [email protected]:Azure/sap-hana.git


Setup Workspace

  1. Create a Workspace Container under the <automation_root> and descend into the newly created Workspace Container.

    mkdir -p <automation_root>/Terraform/workspace/SAP_Library && cd $_

  2. Create a Workspace within the newly created Workspace Container and descend into the newly created Workspace.

    • We recommend an easily identifiable naming convention that uniquely and globally identify the deployment.
      For example: PROTO-SCUS-SAP_Library
      • The first field represents the subscription.
      • The second field represents the region.
      • The third field represents the deployment unit.

    mkdir PROTO-SCUS-SAP_LIBRARY && cd $_


Setup and configure for the Run

  1. Copy the parameter template

    cp <automation_root>/sap-hana/deploy/terraform-units/workspace/SAP_Library/TFE/variables.auto.tfvars .

  2. Edit the parameter file

Parameter Description
deployZone Subscription identifyer for environment partitioning
region Azure Region in which to deploy resources
tags A map of keys and values with which resources are to be tagged
  1. Initialize - Initialize the Terraform Workspace

  2. Plan - Plan it. Terraform performs a deployment check.

  3. Apply - Execute deployment.




Terraform Operations

  • From the Workspace directory that you created.

Initialize

  • Initializes the Workspace by linking in the path to the runtime code and downloading execution Providers.

    terraform init <automation_root>/sap-hana/deploy/terraform-units/workspace/SAP_Library/TFE
  • To re-initialize, add the --upgrade=true switch.

    terraform init --upgrade=true <automation_root>/sap-hana/deploy/terraform-units/workspace/SAP_Library/TFE

Plan

  • A plan tests the code to see what changes will be made.
  • If a Statefile exists, it will compare the code, the statefile, and the resources in Azure in order to detect drift and will display any changes or corrections that will result, and the actions that will be performed.
terraform plan  <automation_root>/sap-hana/deploy/terraform-units/workspace/SAP_Library/TFE

Apply

  • Apply executes the work identified by the Plan.

  • A Plan is also an implicit step in the Apply that will ask for confirmation.

    terraform apply <automation_root>/sap-hana/deploy/terraform-units/workspace/SAP_Library/TFE
  • To automatically confirm, add the --auto-approve switch.

    terraform apply --auto-approve <automation_root>/sap-hana/deploy/terraform-units/workspace/SAP_Library/TFE

Destroy

  • If you don't need the deployment anymore, you can remove it just as easily.
    From the Workspace directory, run the following command to remove all deployed resources:

    terraform destroy <automation_root>/sap-hana/deploy/terraform-units/workspace/SAP_Library/TFE
  • To automatically confirm, add the --auto-approve switch.xs

    terraform destroy --auto-approve <automation_root>/sap-hana/deploy/terraform-units/workspace/SAP_Library/TFE