Skip to content

Terraform module to create a set of SAP Application Servers virtual machines on VMware on OVHcloud.

License

Notifications You must be signed in to change notification settings

ovh/terraform-vsphere-sap-application-server

Repository files navigation

OVHcloud SAP Application Servers Terraform module

Terraform module to create a set of SAP Application Servers virtual machines on VMware on OVHcloud. You have the possibility to create many SAP Application Servers virtual machines with different parameters.

This module can be used to create SAP SCS, SAP AS, SAProuter servers and so many other SAP servers.

vSphere user requirements

User in the vSphere client with the following permissions:

  • vSphere access: Read/Write
  • Access to the VM Network: Operator
  • Access to the V(X)LANs: Operator

How to use this module

This repository has an example folder which includes several ways to use this module.

Requirements

Name Version
terraform >= 1.5.5
vsphere >= 2.4.1

Providers

Name Version
vsphere 2.4.1

Resources

Name Type
vsphere_compute_cluster_host_group.cluster_host_group resource
vsphere_compute_cluster_vm_anti_affinity_rule.sap_application_server_anti_affinity_rule resource
vsphere_compute_cluster_vm_group.cluster_sap_application_server_group resource
vsphere_compute_cluster_vm_host_rule.cluster_vm_host_rule resource
vsphere_virtual_machine.sap_application_server resource
vsphere_compute_cluster.cluster data source
vsphere_content_library.library data source
vsphere_content_library_item.item data source
vsphere_datacenter.datacenter data source
vsphere_datastore.custom_datastore_disks data source
vsphere_datastore.datastore data source
vsphere_datastore.default_datastore_disks data source
vsphere_datastore.iso_datastore data source
vsphere_host.host data source
vsphere_network.network data source
vsphere_storage_policy.custom_datastore_disks data source

Inputs

Name Description Type Default Required
sap_application_server_datastore Name of the datastore to store SAP Application Servers virtual machines string n/a yes
sap_application_servers List of SAP Application Servers virtual machines wanted with these parameters (mandatory, even if empty).

Example:
[
 {
   "name" = "sidscs",
   "model" = "",
   "cpus" = "4",
   "cpus_per_socket" = "4",
   "memory" = "4096",
   "custom_disks" = false,
   "disks" = [],
   "networks" = ["VLAN20"],
   "guest_id" = "sles15_64Guest",
   "vsphere_content_library" = "",
   "template" = "",
   "iso_datastore" = "",
   "iso_path" = "",
   "vapp_options" = {}
 },
 {
   "name" = "sidpas",
   "model" = "M",
   "cpus" = "",
   "cpus_per_socket" = "",
   "memory" = "",
   "custom_disks" = true,
   "disks" = [
    { "id" : 0, "label" : "disk0", "size" : "128", "thin_provisioned" : true, "eagerly_scrub": false, "datastore_name" : "ssd-xxxxxx", "datastore_policy" : "" },
     { "id" : 1, "label" : "disk1", "size" : "128", "thin_provisioned" : true, "eagerly_scrub": false, "datastore_name" : "ssd-xxxxxx", "datastore_policy" : "" },
     { "id" : 2, "label" : "disk2", "size" : "64", "thin_provisioned" : true, "eagerly_scrub": false, "datastore_name" : "ssd-xxxxxx", "datastore_policy" : "" }
   ],
   "networks" = ["VLAN20"],
   "guest_id" = "sles15_64Guest",
   "vsphere_content_library" = "",
   "template" = "",
   "iso_datastore" = "",
   "iso_path" = "",
   "vapp_options" = {}
 }
]
list(any) n/a yes
vsphere_compute_cluster Name of the vSphere cluster
Example: Cluster1
string n/a yes
vsphere_datacenter Name of the datacenter in vSphere interface string n/a yes
sap_application_server_anti_affinity_rule_enable Avoid running SAP Application Servers virtual machines on the same ESXi host bool false no
sap_application_server_anti_affinity_rule_mandatory When this value is true, prevents any virtual machine operations that may violate this rule bool false no
sap_application_server_anti_affinity_rule_name Name for the anti-affinity rule string "sap-application-server-anti-affinity-rule" no
sap_application_server_folder Name of the folder to store the SAP Application Server virtual machines string "" no
sap_application_server_hardware_version Hardware compatibility between SAP Application Server virtual machine and ESXi host. By default, the newest version.
More information available on VMware
number 19 no
sap_application_server_hosts_distribution Allow to set which SAP Application Server virtual machines have to run on a specific ESXi host.
When mandatory is true, prevents any virtual machine operations that may violate this rule.

Example:
[
 {
   "group_name" = "scs-ts1",
   "hosts" = ["192.168.2.1", "192.168.2.2"],
   "sap_application_servers" = ["sidscs"],
   "mandatory" = true
 },
 {
   "group_name" = "pas-ts1",
   "hosts" = ["192.168.2.2"],
   "sap_application_servers" = ["sidpas"],
   "mandatory" = false
 }
]
list(any) [] no
sap_application_server_wait_for_guest_ip_timeout The amount of time, in minutes, to wait for an available guest IP address on the SAP Application Server virtual machine. number 0 no
sap_application_server_wait_for_guest_net_timeout The amount of time, in minutes, to wait for an available guest IP address on the SAP Application Server virtual machine. number 0 no

As the variable sap_application_servers is a list with many parameters, we present you one by one each parameter.

Name Description Type
name Name of the virtual machine. string
model The module proposes 5 models:
- S: 2vCPU and 4GB of memory
- M: 4vCPU and 8GB of memory
- L: 8vCPU and 16GB of memory
- XL: 16vCPU and 32GB of memory
- XXL: 32vCPU and 64GB of memory
string
cpus Number of vCPU for the virtual machine.
Mandatory if the variable model is empty.
string
cpus_per_socket Number of vCPU per socket for the virtual machine.
Mandatory even if the variable model is empty.
string
memory Number of memory (in MB) for the virtual machine.
Mandatory if the variable model is empty.
string
custom_disks The module proposes by default two disks:
- disk0 (root) | 128 GB | Thin provisioning
- disk1 (sap) | 128 GB | Thin provisioning

If you want to set your own configuration for disks, set the variable to true.
boolean
disks List of disks wanted if the variable custom_disks has been set to true.
The default disk are no longer created if the variable custom_disks has been set to true
The structure has to be like this:

[
 { "id" : 0, "label" : "disk0", "size" : "{size in GB}", "thin_provisioned" : {true | false=thick}, "datastore_name" : "{datastore to store disk}", "datastore_policy" : "{datastore policy}" },
  { "id" : 1, "label" : "disk1", "size" : "{size in GB}", "thin_provisioned" : {true | false=thick}, "datastore_name" : "{datastore to store disk}", "datastore_policy" : "{datastore policy}" },
  { "id" : 2, "label" : "disk2", "size" : "{size in GB}", "thin_provisioned" : {true | false=thick}, "datastore_name" : "{datastore to store disk}", "datastore_policy" : "{datastore policy}" },
  ...
]

Caution, the datastore policy has to be set with the same behaviour on the thin or thick provisioning. Don't set a thin provisioning in the variable if the datastore policy set a thick provisioning.

You have also the possibility to let the datastore_policy empty (""), the Storage Policy by default for the datastore will be applied.

To know more about the Storage Policy (datastore_policy), please refer to the official documentation on VMware.
list()
networks List of network cards. list()
guest_id Operating System to be compatible between ESXi host and the virtual machine.
To know the possible value for this variable, please refer to the official list on VMware.
string
vsphere_content_library The Content Library name where the OVA is stored, if you want to create the virtual machine from a template. string
template Name of the template.
Mandatory if the variable vsphere_content_library has been set.
string
iso_datastore Datastore name where the ISO file is stored, if you want to add a CD-ROM device and start the virtual machine on it. string
iso_path Path in the datastore to locate the ISO file.
Mandatory if the variable iso_datastore is not empty.
string
vapp_options Map that you want to pass to the virtual machine.
Only available with template which has vApp Options enabled.

Example:
 {
   "guestinfo.hostname" : "vm-sap-pas",
   "guestinfo.user" : "my-user",
   "guestinfo.password" : "123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",
   "guestinfo.password_crypted" : "False"
 }
map

Outputs

Name Description
affinity_hosts_sap_application_servers_rules Map of affinity hosts SAP Application Server virtual machines rules information
anti_affinity_sap_application_servers_rule Map of anti affinity SAP Application Servers virtual machines rule information
sap_application_servers_ids Map of SAP Application Server virtual machines names and its IDs

How do I contribute to this Terraform Module?

Contributions are very welcome! Check out the Contribution Guidelines for instructions.

How is this Terraform Module versioned?

This Terraform Module follows the principles of Semantic Versioning. You can find each new release, along with the changelog, in the Releases Page.

During initial development, the major version will be 0 (e.g., 0.x.y), which indicates the code does not yet have a stable API. Once we hit 1.0.0, we will make every effort to maintain a backwards compatible API and use the MAJOR, MINOR, and PATCH versions on each release to indicate any incompatibilities.

License

This code is released under the Apache 2.0 License. Please see LICENSE for more details.

About

Terraform module to create a set of SAP Application Servers virtual machines on VMware on OVHcloud.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published