azurerm_workloads_sap_three_tier_virtual_instance

Manages an SAP Three Tier Virtual Instance with a new SAP System.

Example Usage

resource "tls_private_key" "example" {
  algorithm = "RSA"
  rsa_bits  = 4096
}

data "tls_public_key" "example" {
  private_key_pem = tls_private_key.example.private_key_pem
}

data "azurerm_subscription" "current" {}

resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "West Europe"
}

resource "azurerm_user_assigned_identity" "example" {
  name                = "example-uai"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
}

resource "azurerm_role_assignment" "example" {
  scope                = data.azurerm_subscription.current.id
  role_definition_name = "Azure Center for SAP solutions service role"
  principal_id         = azurerm_user_assigned_identity.example.principal_id
}

resource "azurerm_virtual_network" "example" {
  name                = "example-vnet"
  address_space       = ["10.0.0.0/16"]
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
}

resource "azurerm_subnet" "example" {
  name                 = "example-subnet"
  resource_group_name  = azurerm_resource_group.example.name
  virtual_network_name = azurerm_virtual_network.example.name
  address_prefixes     = ["10.0.2.0/24"]
}

resource "azurerm_resource_group" "app" {
  name     = "example-sapapp"
  location = "West Europe"

  depends_on = [
    azurerm_subnet.example
  ]
}

resource "azurerm_storage_account" "example" {
  name                     = "examplesa"
  resource_group_name      = azurerm_resource_group.example.name
  location                 = azurerm_resource_group.example.location
  account_tier             = "Standard"
  account_replication_type = "LRS"
}

resource "azurerm_workloads_sap_three_tier_virtual_instance" "example" {
  name                        = "X05"
  resource_group_name         = azurerm_resource_group.example.name
  location                    = azurerm_resource_group.example.location
  environment                 = "NonProd"
  sap_product                 = "S4HANA"
  managed_resource_group_name = "exampleManagedRG"
  app_location                = azurerm_resource_group.app.location
  sap_fqdn                    = "sap.bpaas.com"

  three_tier_configuration {
    app_resource_group_name = azurerm_resource_group.app.name
    secondary_ip_enabled    = true

    application_server_configuration {
      instance_count = 1
      subnet_id      = azurerm_subnet.example.id

      virtual_machine_configuration {
        virtual_machine_size = "Standard_D16ds_v4"

        image {
          offer     = "RHEL-SAP-HA"
          publisher = "RedHat"
          sku       = "82sapha-gen2"
          version   = "latest"
        }

        os_profile {
          admin_username  = "testAdmin"
          ssh_private_key = tls_private_key.example.private_key_pem
          ssh_public_key  = data.tls_public_key.example.public_key_openssh
        }
      }
    }

    central_server_configuration {
      instance_count = 1
      subnet_id      = azurerm_subnet.example.id

      virtual_machine_configuration {
        virtual_machine_size = "Standard_D16ds_v4"

        image {
          offer     = "RHEL-SAP-HA"
          publisher = "RedHat"
          sku       = "82sapha-gen2"
          version   = "latest"
        }

        os_profile {
          admin_username  = "testAdmin"
          ssh_private_key = tls_private_key.example.private_key_pem
          ssh_public_key  = data.tls_public_key.example.public_key_openssh
        }
      }
    }

    database_server_configuration {
      instance_count = 1
      subnet_id      = azurerm_subnet.example.id
      database_type  = "HANA"

      virtual_machine_configuration {
        virtual_machine_size = "Standard_E16ds_v4"

        image {
          offer     = "RHEL-SAP-HA"
          publisher = "RedHat"
          sku       = "82sapha-gen2"
          version   = "latest"
        }

        os_profile {
          admin_username  = "testAdmin"
          ssh_private_key = tls_private_key.example.private_key_pem
          ssh_public_key  = data.tls_public_key.example.public_key_openssh
        }
      }

      disk_volume_configuration {
        volume_name     = "hana/data"
        number_of_disks = 3
        size_in_gb      = 128
        sku_name        = "Premium_LRS"
      }

      disk_volume_configuration {
        volume_name     = "hana/log"
        number_of_disks = 3
        size_in_gb      = 128
        sku_name        = "Premium_LRS"
      }

      disk_volume_configuration {
        volume_name     = "hana/shared"
        number_of_disks = 1
        size_in_gb      = 256
        sku_name        = "Premium_LRS"
      }

      disk_volume_configuration {
        volume_name     = "usr/sap"
        number_of_disks = 1
        size_in_gb      = 128
        sku_name        = "Premium_LRS"
      }

      disk_volume_configuration {
        volume_name     = "backup"
        number_of_disks = 2
        size_in_gb      = 256
        sku_name        = "StandardSSD_LRS"
      }

      disk_volume_configuration {
        volume_name     = "os"
        number_of_disks = 1
        size_in_gb      = 64
        sku_name        = "StandardSSD_LRS"
      }
    }

    resource_names {
      application_server {
        availability_set_name = "appAvSet"

        virtual_machine {
          host_name               = "apphostName0"
          os_disk_name            = "app0osdisk"
          virtual_machine_name    = "appvm0"
          network_interface_names = ["appnic0"]

          data_disk {
            volume_name = "default"
            names       = ["app0disk0"]
          }
        }
      }

      central_server {
        availability_set_name = "csAvSet"

        load_balancer {
          name                            = "ascslb"
          backend_pool_names              = ["ascsBackendPool"]
          frontend_ip_configuration_names = ["ascsip0"]
          health_probe_names              = ["ascsHealthProbe"]
        }

        virtual_machine {
          host_name               = "ascshostName"
          os_disk_name            = "ascsosdisk"
          virtual_machine_name    = "ascsvm"
          network_interface_names = ["ascsnic"]

          data_disk {
            volume_name = "default"
            names       = ["ascsdisk"]
          }
        }
      }

      database_server {
        availability_set_name = "dbAvSet"

        load_balancer {
          name                            = "dblb"
          backend_pool_names              = ["dbBackendPool"]
          frontend_ip_configuration_names = ["dbip"]
          health_probe_names              = ["dbHealthProbe"]
        }

        virtual_machine {
          host_name               = "dbprhost"
          os_disk_name            = "dbprosdisk"
          virtual_machine_name    = "dbvmpr"
          network_interface_names = ["dbprnic"]

          data_disk {
            volume_name = "hanaData"
            names       = ["hanadatapr0", "hanadatapr1"]
          }

          data_disk {
            volume_name = "hanaLog"
            names       = ["hanalogpr0", "hanalogpr1", "hanalogpr2"]
          }

          data_disk {
            volume_name = "usrSap"
            names       = ["usrsappr0"]
          }

          data_disk {
            volume_name = "hanaShared"
            names       = ["hanasharedpr0", "hanasharedpr1"]
          }
        }
      }

      shared_storage {
        account_name          = "sharedexamplesa"
        private_endpoint_name = "examplePE"
      }
    }

    transport_create_and_mount {
      resource_group_id    = azurerm_resource_group.app.id
      storage_account_name = "exampletranssa"
    }
  }

  identity {
    type = "UserAssigned"

    identity_ids = [
      azurerm_user_assigned_identity.example.id,
    ]
  }

  tags = {
    Env = "Test"
  }

  depends_on = [
    azurerm_role_assignment.example
  ]
}

Arguments Reference

The following arguments are supported:


A disk_volume_configuration block supports the following:


A virtual_machine_configuration block supports the following:


An image block supports the following:


An os_profile block supports the following:


A three_tier_configuration block supports the following:


A transport_create_and_mount block supports the following:


An application_server_configuration block supports the following:


A central_server_configuration block supports the following:


A database_server_configuration block supports the following:


A resource_names block supports the following:


An application_server block supports the following:


A virtual_machine block supports the following:


A data_disk block supports the following:


A central_server block supports the following:


A load_balancer block supports the following:


A database_server block supports the following:


A shared_storage block supports the following:


An identity block supports the following:

Attributes Reference

In addition to the Arguments listed above - the following Attributes are exported:

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

Import

SAP Three Tier Virtual Instances with new SAP Systems can be imported using the resource id, e.g.

terraform import azurerm_workloads_sap_three_tier_virtual_instance.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Workloads/sapVirtualInstances/vis1