This module deals with SAP HANA HA configuration and deployment.
The resources/services/activations/deletions that this module will create/trigger are:
- Create Primary and Secondary Compute Instance that will host SAP HANA HA.
- Create a Static IP Address for the two Compute Instance's.
- Create 2 Persistent Disks to host SAP HANA HA's File systems on primary and secondary nodes.
You can go in the examples folder complete working example. However, here's an example of how to use the module in a main.tf file.
module "gcp_sap_hana_ha" {
source = "../../modules/sap_hana_ha"
subnetwork = "${var.subnetwork}"
linux_image_family = "${var.linux_image_family}"
linux_image_project = "${var.linux_image_project}"
instance_type = "${var.instance_type}"
network_tags = "${var.network_tags}"
project_id = "${var.project_id}"
region = "${var.region}"
service_account_email = "${var.service_account_email}"
boot_disk_size = "${var.boot_disk_size}"
boot_disk_type = "${var.boot_disk_type}"
autodelete_disk = "true"
pd_ssd_size = "${var.pd_ssd_size}"
pd_hdd_size = "${var.pd_hdd_size}"
sap_hana_deployment_bucket = "${var.sap_hana_deployment_bucket}"
sap_deployment_debug = "false"
post_deployment_script = "${var.post_deployment_script}"
sap_hana_sid = "${var.sap_hana_sid}"
primary_instance_name = "${var.primary_instance_name}"
secondary_instance_name = "${var.secondary_instance_name}"
primary_zone = "${var.primary_zone}"
secondary_zone = "${var.secondary_zone}"
sap_hana_instance_number = "${var.sap_hana_instance_number}"
sap_hana_sidadm_password = "${var.sap_hana_sidadm_password}"
sap_hana_system_password = "${var.sap_hana_system_password}"
sap_hana_sidadm_uid = 900
sap_hana_sapsys_gid = 900
sap_vip = "${var.sap_vip}"
sap_vip_secondary_range = "${var.sap_vip_secondary_range}"
primary_instance_ip = "${var.primary_instance_ip}"
secondary_instance_ip = "${var.secondary_instance_ip}"
public_ip = "${var.public_ip}"
sap_vip_internal_address = "${var.sap_vip_internal_address}"
}
Make sure you've gone through the root Requirement Section
Follow instructions here to properly Download SAP HANA from the SAP Marketplace, and upload it to a GCS bucket.
The compute instances created by this submodule will need to download SAP HANA from a GCS bucket in order install it. Follow the instructions below to ensure a successful installation:
- Create a new service account
- Grant this new service account the following permissions on the bucket where you uploaded SAP HANA installation file:
- roles/storage.objectViewer
You may use the following gcloud commands:
gcloud projects add-iam-policy-binding <project-id> --member=serviceAccount:<service-account-email> --role=roles/storage.objectViewer
- When configuring the module, use this newly created service account's email, to set the
service_account_email
input variable.
If you need to run a post deployment script, the script needs to be accessible via a https:// or gs:// URl. It is the recommended way is to use a GCS Bucket in the following way.:
-
Upload the to a GCS bucket.
-
Make sure the service account attached to the instance has the following permissions on the bucket:
- roles/storage.objectViewer
- Note that this permission should already be granted if the bucket is in the same project as the one where you created the service account previously.
- roles/storage.objectViewer
-
Set the post_deployment_script input to the gs:// link to your script. (i.e gs://<bucket_name>/<my_script>)
Name | Description | Type | Default | Required |
---|---|---|---|---|
autodelete_disk | Whether the disk will be auto-deleted when the instance is deleted. | string | "false" |
no |
boot_disk_size | Root disk size in GB | string | n/a | yes |
boot_disk_type | The GCE data disk type. May be set to pd-standard (for PD HDD) or pd-ssd. | string | n/a | yes |
disk_name_0 | Name of first disk. | string | "sap-hana-pd-sd-0" |
no |
disk_name_1 | Name of second disk. | string | "sap-hana-pd-sd-1" |
no |
disk_name_2 | Name of third disk. | string | "sap-hana-pd-sd-2" |
no |
disk_name_3 | Name of fourth disk. | string | "sap-hana-pd-sd-3" |
no |
disk_type_0 | The GCE data disk type. May be set to pd-ssd. | string | "pd-ssd" |
no |
disk_type_1 | The GCE data disk type. May be set to pd-standard (for PD HDD). | string | "pd-standard" |
no |
instance_type | The GCE instance/machine type. | string | n/a | yes |
linux_image_family | GCE image family. | string | n/a | yes |
linux_image_project | Project name containing the linux image. | string | n/a | yes |
network_tags | List of network tags to attach to the instance. | list | n/a | yes |
pd_hdd_size | Persistent disk size in GB | string | "" |
no |
pd_ssd_size | Persistent disk size in GB | string | "" |
no |
post_deployment_script | SAP post deployment script | string | n/a | yes |
primary_instance_ip | Primary instance ip address | string | n/a | yes |
primary_instance_name | A unique name for the resource, required by GCE. Changing this forces a new resource to be created. | string | n/a | yes |
primary_zone | The primary zone that the instance should be created in. | string | n/a | yes |
project_id | The ID of the project in which the resources will be deployed. | string | n/a | yes |
region | Region to deploy the resources. Should be in the same region as the zone. | string | n/a | yes |
sap_deployment_debug | Debug flag for SAP HANA deployment. | string | "false" |
no |
sap_hana_deployment_bucket | SAP HANA post deployment script. Must be a gs:// or https:// link to the script. | string | n/a | yes |
sap_hana_instance_number | SAP HANA instance number | string | n/a | yes |
sap_hana_sapsys_gid | SAP HANA SAP System GID | string | n/a | yes |
sap_hana_sid | SAP HANA System Identifier. When using the SID to enter a user session, like this for example, su - [SID]adm , make sure that [SID] is in lower case. |
string | n/a | yes |
sap_hana_sidadm_password | SAP HANA System Identifier Admin password | string | n/a | yes |
sap_hana_sidadm_uid | SAP HANA System Identifier Admin UID | string | n/a | yes |
sap_hana_system_password | SAP HANA system password | string | n/a | yes |
sap_vip | SAP VIP | string | n/a | yes |
sap_vip_internal_address | Name of static IP adress to add to the instance's access config. | string | n/a | yes |
sap_vip_secondary_range | SAP seconday VIP range | string | n/a | yes |
secondary_instance_ip | Secondary instance ip address | string | n/a | yes |
secondary_instance_name | A unique name for the resource, required by GCE. Changing this forces a new resource to be created. | string | n/a | yes |
secondary_zone | The secondary zone that the instance should be created in. | string | n/a | yes |
service_account_email | Email of service account to attach to the instance. | string | n/a | yes |
startup_script_1 | Startup script to install SAP HANA. | string | n/a | yes |
startup_script_2 | Startup script to install SAP HANA. | string | n/a | yes |
subnetwork | Compute Engine instance name | string | n/a | yes |
Name | Description |
---|---|
primary_instance_machine_type | Primary GCE instance/machine type. |
primary_instance_name | Name of sap primary instance |
primary_zone | Compute Engine primary instance deployment zone |
secondary_instance_machine_type | Secondary GCE instance/machine type. |
secondary_instance_name | Name of sap secondary instance |
secondary_zone | Compute Engine secondary instance deployment zone |