azurerm_workloads_sap_single_node_virtual_instance

Manages an SAP Single Node Virtual Instance with new SAP System.

Example Usage

data "azurerm_subscription" "current" {}

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
}

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_workloads_sap_single_node_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 = "managedTestRG"
  app_location                = azurerm_resource_group.app.location
  sap_fqdn                    = "sap.bpaas.com"

  single_server_configuration {
    app_resource_group_name = azurerm_resource_group.app.name
    subnet_id               = azurerm_subnet.example.id
    database_type           = "HANA"
    secondary_ip_enabled    = true

    virtual_machine_configuration {
      virtual_machine_size = "Standard_E32ds_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"
    }

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

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

  identity {
    type = "UserAssigned"

    identity_ids = [
      azurerm_user_assigned_identity.example.id,
    ]
  }

  depends_on = [
    azurerm_role_assignment.example
  ]
}

Arguments Reference

The following arguments are supported:


A single_server_configuration block supports the following:


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 virtual_machine_resource_names block supports the following:


A data_disk 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 Single Node Virtual Instances with new SAP Systems can be imported using the resource id, e.g.

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