From 9eb9e48ff94642785a7d59e221219d0b7e5dfa12 Mon Sep 17 00:00:00 2001 From: surajsbharadwaj <101711050+surajsbharadwaj@users.noreply.github.com> Date: Fri, 3 Nov 2023 07:59:17 +0100 Subject: [PATCH] feat: upgrade terraform-ibm-modules/powervs-instance/ibm version to 1.0.2 (#534) --------- Co-authored-by: stafaniasaju --- .secrets.baseline | 24 +- README.md | 80 ++-- cra-config.yaml | 12 +- cra-tf-validate-ignore-rules.json | 6 + ibm_catalog.json | 58 ++- modules/ansible_sap_instance_init/README.md | 37 -- modules/ansible_sap_instance_init/main.tf | 63 ---- .../templates/configure_os_for_sap.sh.tfpl | 23 -- .../ansible_sap_instance_init/variables.tf | 26 -- modules/ansible_sap_instance_init/versions.tf | 13 - .../main.tf | 8 +- .../outputs.tf | 2 +- .../variables.tf | 6 +- .../versions.tf | 0 modules/pi-sap-system-type1/README.md | 80 ++++ modules/pi-sap-system-type1/main.tf | 216 +++++++++++ modules/pi-sap-system-type1/outputs.tf | 46 +++ modules/pi-sap-system-type1/variables.tf | 222 ++++++++++++ .../pi-sap-system-type1}/version.tf | 0 .../powervs_attach_private_network/README.md | 57 --- .../powervs_attach_private_network/main.tf | 54 --- .../powervs_attach_private_network/outputs.tf | 0 .../variables.tf | 24 -- .../versions.tf | 13 - .../powervs_create_private_network/README.md | 53 --- .../powervs_create_private_network/main.tf | 31 -- .../powervs_create_private_network/outputs.tf | 0 .../variables.tf | 22 -- .../versions.tf | 13 - modules/remote-exec-ansible/main.tf | 52 +++ .../outputs.tf | 0 modules/remote-exec-ansible/variables.tf | 40 ++ modules/remote-exec-ansible/version.tf | 3 + .../templates-ansible/ansible_exec.sh.tftpl | 19 + ...ybook_configure_network_services.yml.tftpl | 18 + .../playbook_configure_os_for_sap.yml.tftpl | 38 ++ solutions/basic/main.tf | 52 --- solutions/basic/outputs.tf | 0 solutions/basic/variables.tf | 32 -- solutions/basic/version.tf | 13 - solutions/e2e/README.md | 127 +++++++ solutions/e2e/main.tf | 83 +++++ solutions/e2e/outputs.tf | 153 ++++++++ solutions/e2e/provider.tf | 52 +++ solutions/e2e/variables.tf | 235 ++++++++++++ solutions/e2e/version.tf | 13 + .../ibm-catalog/sap-ready-to-go/README.md | 61 ++-- .../sap-ready-to-go/locals_schematics_data.tf | 53 +++ solutions/ibm-catalog/sap-ready-to-go/main.tf | 123 +++---- .../ibm-catalog/sap-ready-to-go/outputs.tf | 20 +- .../ibm-catalog/sap-ready-to-go/provider.tf | 25 ++ .../ibm-catalog/sap-ready-to-go/variables.tf | 101 +++--- .../ibm-catalog/sap-ready-to-go/version.tf | 2 +- solutions/sap-ready-to-go/README.md | 66 ++-- solutions/sap-ready-to-go/input.tfvars | 21 ++ solutions/sap-ready-to-go/main.tf | 77 ++-- solutions/sap-ready-to-go/module/README.md | 82 ----- solutions/sap-ready-to-go/module/main.tf | 238 ------------ solutions/sap-ready-to-go/module/outputs.tf | 46 --- .../submodule/sharefs_instance_init/main.tf | 52 --- .../sharefs_instance_init/outputs.tf | 0 .../configure_network_services.sh.tftpl | 20 - .../sharefs_instance_init/variables.tf | 21 -- .../sharefs_instance_init/versions.tf | 20 - solutions/sap-ready-to-go/module/variables.tf | 263 -------------- solutions/sap-ready-to-go/outputs.tf | 14 +- solutions/sap-ready-to-go/provider.tf | 25 ++ solutions/sap-ready-to-go/variables.tf | 341 ++++++++---------- tests/go.mod | 2 +- tests/pr_test.go | 60 ++- tests/resources/main.tf | 4 + tests/resources/outputs.tf | 10 + tests/resources/variables.tf | 1 + tests/resources/version.tf | 9 + 74 files changed, 2078 insertions(+), 1798 deletions(-) delete mode 100644 modules/ansible_sap_instance_init/README.md delete mode 100644 modules/ansible_sap_instance_init/main.tf delete mode 100644 modules/ansible_sap_instance_init/templates/configure_os_for_sap.sh.tfpl delete mode 100644 modules/ansible_sap_instance_init/variables.tf delete mode 100644 modules/ansible_sap_instance_init/versions.tf rename modules/{powervs_hana_storage_config => pi-hana-storage-config}/main.tf (58%) rename modules/{powervs_hana_storage_config => pi-hana-storage-config}/outputs.tf (75%) rename modules/{powervs_hana_storage_config => pi-hana-storage-config}/variables.tf (90%) rename modules/{powervs_hana_storage_config => pi-hana-storage-config}/versions.tf (100%) create mode 100644 modules/pi-sap-system-type1/README.md create mode 100644 modules/pi-sap-system-type1/main.tf create mode 100644 modules/pi-sap-system-type1/outputs.tf create mode 100644 modules/pi-sap-system-type1/variables.tf rename {solutions/sap-ready-to-go/module => modules/pi-sap-system-type1}/version.tf (100%) delete mode 100755 modules/powervs_attach_private_network/README.md delete mode 100644 modules/powervs_attach_private_network/main.tf delete mode 100644 modules/powervs_attach_private_network/outputs.tf delete mode 100644 modules/powervs_attach_private_network/variables.tf delete mode 100644 modules/powervs_attach_private_network/versions.tf delete mode 100755 modules/powervs_create_private_network/README.md delete mode 100644 modules/powervs_create_private_network/main.tf delete mode 100644 modules/powervs_create_private_network/outputs.tf delete mode 100644 modules/powervs_create_private_network/variables.tf delete mode 100644 modules/powervs_create_private_network/versions.tf create mode 100644 modules/remote-exec-ansible/main.tf rename modules/{ansible_sap_instance_init => remote-exec-ansible}/outputs.tf (100%) create mode 100644 modules/remote-exec-ansible/variables.tf create mode 100644 modules/remote-exec-ansible/version.tf create mode 100644 modules/templates-ansible/ansible_exec.sh.tftpl create mode 100644 modules/templates-ansible/playbook_configure_network_services.yml.tftpl create mode 100644 modules/templates-ansible/playbook_configure_os_for_sap.yml.tftpl delete mode 100644 solutions/basic/main.tf delete mode 100644 solutions/basic/outputs.tf delete mode 100644 solutions/basic/variables.tf delete mode 100644 solutions/basic/version.tf create mode 100644 solutions/e2e/README.md create mode 100644 solutions/e2e/main.tf create mode 100644 solutions/e2e/outputs.tf create mode 100644 solutions/e2e/provider.tf create mode 100644 solutions/e2e/variables.tf create mode 100644 solutions/e2e/version.tf create mode 100644 solutions/ibm-catalog/sap-ready-to-go/locals_schematics_data.tf create mode 100644 solutions/ibm-catalog/sap-ready-to-go/provider.tf create mode 100644 solutions/sap-ready-to-go/input.tfvars delete mode 100644 solutions/sap-ready-to-go/module/README.md delete mode 100644 solutions/sap-ready-to-go/module/main.tf delete mode 100644 solutions/sap-ready-to-go/module/outputs.tf delete mode 100644 solutions/sap-ready-to-go/module/submodule/sharefs_instance_init/main.tf delete mode 100644 solutions/sap-ready-to-go/module/submodule/sharefs_instance_init/outputs.tf delete mode 100644 solutions/sap-ready-to-go/module/submodule/sharefs_instance_init/templates/configure_network_services.sh.tftpl delete mode 100644 solutions/sap-ready-to-go/module/submodule/sharefs_instance_init/variables.tf delete mode 100644 solutions/sap-ready-to-go/module/submodule/sharefs_instance_init/versions.tf delete mode 100644 solutions/sap-ready-to-go/module/variables.tf create mode 100644 solutions/sap-ready-to-go/provider.tf create mode 100644 tests/resources/main.tf create mode 100644 tests/resources/outputs.tf create mode 100644 tests/resources/variables.tf create mode 100644 tests/resources/version.tf diff --git a/.secrets.baseline b/.secrets.baseline index 578a13b6..6fc88a1e 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "go.sum|^.secrets.baseline$", "lines": null }, - "generated_at": "2023-11-02T14:24:11Z", + "generated_at": "2023-11-02T15:28:02Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -87,22 +87,32 @@ "verified_result": null } ], - "modules/powervs_attach_private_network/README.md": [ + "modules/pi-sap-system-type1/README.md": [ { - "hashed_secret": "91199272d5d6a574a51722ca6f3d1148edb1a0e7", + "hashed_secret": "3bd02b996f65f3548c1a0b5d93b00bfa7c88341a", "is_secret": false, "is_verified": false, - "line_number": 9, + "line_number": 56, "type": "Secret Keyword", "verified_result": null } ], - "modules/powervs_create_private_network/README.md": [ + "solutions/sap-ready-to-go/README.md": [ { - "hashed_secret": "91199272d5d6a574a51722ca6f3d1148edb1a0e7", + "hashed_secret": "3bd02b996f65f3548c1a0b5d93b00bfa7c88341a", "is_secret": false, "is_verified": false, - "line_number": 9, + "line_number": 61, + "type": "Secret Keyword", + "verified_result": null + } + ], + "solutions/sap-ready-to-go/input.tfvars": [ + { + "hashed_secret": "4d82fc4e8ef3a90cebdf3a1fc0e4abab79a41391", + "is_secret": false, + "is_verified": false, + "line_number": 19, "type": "Secret Keyword", "verified_result": null } diff --git a/README.md b/README.md index c752dfa3..80f0b0cc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# SAP on secure Power Virtual Servers Solutions +# IBM Power Virtual Server for SAP HANA solutions [![Graduated (Supported)](https://img.shields.io/badge/status-Graduated%20(Supported)-brightgreen?style=plastic)](https://terraform-ibm-modules.github.io/documentation/#/badge-status) @@ -9,10 +9,45 @@ [![latest release](https://img.shields.io/github/v/release/terraform-ibm-modules/terraform-ibm-powervs-sap?logo=GitHub&sort=semver)](https://github.com/terraform-ibm-modules/terraform-ibm-powervs-sap/releases/latest) [![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/) -# Table of Contents -1. [Required IAM access policies](#required-iam-access-policies) -2. [Reference architectures](#reference-architectures) -3. [Solutions](#solutions) +## Summary +This repository contains deployable architecture solutions which helps in deploying Power Virtual Server for SAP HANA solutions. The solutions are available in IBM Cloud Catalog and also can be deployed without catalog as well except few solutions. + +Three solutions are offered: +1. [IBM catalog PowerVS sap-ready-to-go variation](https://github.com/terraform-ibm-modules/terraform-ibm-powervs-sap/tree/main/solutions/ibm-catalog/sap-ready-to-go) + - Creates and configures 1 HANA instance, 0 to N Netweaver Instances and 1 Optional ShareFS with RHEL or SLES Os distribution. Creates a new private subnet for SAP communication for entire landscape and attaches it to cloud connections(in Non PER DC). + - Optionally configures os network management services(NTP, NFS, and DNS services) using ansible galaxy collection roles [ibm.power_linux_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/). + - Additionally tunes the instances according to SAPs best practices which is fully ready for hosting SAP applications. +2. [PowerVS sap-ready-to-go variation](https://github.com/terraform-ibm-modules/terraform-ibm-powervs-sap/tree/main/solutions/sap-ready-to-go) + - Creates and configures 1 HANA instance, 0 to N Netweaver Instances and 1 Optional ShareFS with RHEL or SLES Os distribution. Creates a new private subnet for SAP communication for entire landscape and attaches it to cloud connections(in Non PER DC). + - Optionally configures os network management services(NTP, NFS, and DNS services) using ansible galaxy collection roles [ibm.power_linux_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/). + - Additionally tunes the instances according to SAPs best practices which is fully ready for hosting SAP applications. +3. [End to End Solution](https://github.com/terraform-ibm-modules/terraform-ibm-powervs-sap/tree/main/solutions/e2e) + - Creates a [Power Virtual Server with vpc landing zone](https://github.com/terraform-ibm-modules/terraform-ibm-powervs-infrastructure/tree/main/modules/powervs-vpc-landing-zone) which creates a VPC Infrastructure and PowerVS infrastructure. Installs and configures the Squid Proxy, DNS Forwarder, NTP forwarder and NFS on hosts, and sets the host as the server for the NTP, NFS, and DNS services by using ansible galaxy collection roles [ibm.power_linux_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/). + - Creates and configures 1 HANA instance, 0 to N Netweaver Instances and 1 Optional ShareFS with RHEL or SLES Os distribution. Creates a new private subnet for SAP communication for entire landscape and attaches it to cloud connections(in Non PER DC). + - Optionally configures os network management services(NTP, NFS, and DNS services) using ansible galaxy collection roles [ibm.power_linux_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/). + - Additionally tunes the instances according to SAPs best practices which is fully ready for hosting SAP applications. + +## Reference architectures +- [IBM catalog PowerVS sap-ready-to-go variation](https://github.com/terraform-ibm-modules/terraform-ibm-powervs-sap/blob/main/reference-architectures/sap-ready-to-go/deploy-arch-ibm-pvs-sap-ready-to-go.svg) +- [Power Virtual Server with vpc landing zone](https://github.com/terraform-ibm-modules/terraform-ibm-powervs-infrastructure/blob/main/reference-architectures/full-stack/deploy-arch-ibm-pvs-inf-full-stack.svg) + + +## Solutions +| Variation | Available on IBM Catalog | Requires Schematics Workspace ID | Creates PowerVS with VPC landing zone | Creates PowerVS HANA Instance | Creates PowerVS NW Instances | Performs PowerVS OS Config | Performs PowerVS SAP Tuning | Install SAP software | +|:---------------------------------------------------------------------------:|:------------------------:|:--------------------------------:|:-------------------------------------:|:-----------------------------:|:----------------------------:|:--------------------------:|:---------------------------:|:--------------------:| +| [ IBM Catalog sap-ready-to-go ]( ./solutions/ibm-catalog/sap-ready-to-go/ ) | :heavy_check_mark: | :heavy_check_mark: | N/A | 1 | 0 to N | :heavy_check_mark: | :heavy_check_mark: | N/A | +| [ sap-ready-to-go ]( ./solutions/sap-ready-to-go/ ) | N/A | N/A | N/A | 1 | 0 to N | :heavy_check_mark: | :heavy_check_mark: | N/A | +| [ End-to-End ]( ./solutions/e2e/ ) | N/A | N/A | :heavy_check_mark: | 1 | 0 to N | :heavy_check_mark: | :heavy_check_mark: | N/A | + + + +## Overview +* [terraform-ibm-powervs-sap](#terraform-ibm-powervs-sap) +* [Submodules](./modules) + * [pi-sap-system-type1](./modules/pi-sap-system-type1) +* [Contributing](#contributing) + + ## Required IAM access policies @@ -34,19 +69,6 @@ You need the following permissions to run this module. -## Reference architectures - -- [SAP Ready to go PowerVS](reference-architectures/sap-ready-to-go/deploy-arch-ibm-pvs-sap-ready-to-go.md) - - -## Solutions - -| Variation | Available on IBM Catalog | Requires Schematics Workspace ID | Creates PowerVS HANA Instance | Creates PowerVS NW Instances | Performs PowerVS OS Config | Performs PowerVS SAP Tuning | Install SAP software | -| ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | -| [sap-ready-to-go](./solutions/ibm-catalog/sap-ready-to-go/) | :heavy_check_mark: | :heavy_check_mark: | 1 | 0 to N | :heavy_check_mark: | :heavy_check_mark: | N/A | -| [sap-ready-to-go](./solutions/sap-ready-to-go/) | N/A | N/A | 1 | 0 to N | :heavy_check_mark: | :heavy_check_mark: | N/A | - - ## Contributing @@ -55,25 +77,3 @@ You can report issues and request features for this module in GitHub issues in t To set up your local development environment, see [Local development setup](https://terraform-ibm-modules.github.io/documentation/#/local-dev-setup) in the project documentation. - - -### Requirements - -No requirements. - -### Modules - -No modules. - -### Resources - -No resources. - -### Inputs - -No inputs. - -### Outputs - -No outputs. - diff --git a/cra-config.yaml b/cra-config.yaml index db39e1f5..3c3c97a6 100644 --- a/cra-config.yaml +++ b/cra-config.yaml @@ -1,7 +1,15 @@ version: "v1" CRA_TARGETS: - - CRA_TARGET: "solutions/basic" + - CRA_TARGET: "solutions/e2e" PROFILE_ID: "0e6e7b5a-817d-4344-ab6f-e5d7a9c49520" # SCC profile ID (currently set to the FSCloud 1.4.0 profile). CRA_IGNORE_RULES_FILE: "cra-tf-validate-ignore-rules.json" CRA_ENVIRONMENT_VARIABLES: - TF_VAR_prefix: "cra-infra" + TF_VAR_prefix: "cra-sap" + TF_VAR_powervs_zone: "syd05" + TF_VAR_powervs_resource_group_name: "Default" + TF_VAR_landing_zone_configuration: "3VPC_RHEL" + TF_VAR_external_access_ip: "0.0.0.0/0" + TF_VAR_powervs_create_separate_sharefs_instance: false + TF_VAR_os_image_distro: "RHEL" + TF_VAR_ssh_public_key: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDb8qoH4U47+79ssT6FdsOIxxZY8/oxWc66WPwqHfpjCgDRP3Rc1uq2YEKIRJba2DzNFnf+byinH0O9hwjKZ/3l7HxNtvQZXdCnT79TOT/wGbcHBV8ZUTBkUOx67ryS0F5bKDdMDWdsWkMXkRb8AAsJWLAeuFsfMYQjMBLmvrMsRRB6GG+97jF18ghqHjuBTX1FNF9fcytEaz7WfP8KrgSYRcQOauIVlMJyOmh3gZl84u14SXwQKhQrdvqt47ZErKH+fbsgxfOvvmYgr5RktKjbmi+lyBkxRM7//BaKcPw5saThf1MiEesJxIqyL16DW9LXdWei74xHNuF65K03y975Qr9CtPkr1rGgxwU2ksqLy1NN5TnF4erd1VSuLZ5BLov7JRJ2K17ttt0agp9VmkjRFIivOek= some-user@testing-box" + TF_VAR_ssh_private_key: "some_key" diff --git a/cra-tf-validate-ignore-rules.json b/cra-tf-validate-ignore-rules.json index c1b6450a..b9cf9076 100644 --- a/cra-tf-validate-ignore-rules.json +++ b/cra-tf-validate-ignore-rules.json @@ -5,6 +5,12 @@ "description": "Check whether Cloud Object Storage network access is restricted to a specific IP range", "ignore_reason": "In order for this rule to pass, Context Based Restrictions (CBRs) support needs to be added to the module (tracking in https://github.ibm.com/GoldenEye/issues/issues/5626). Even after that is added, there is still a dependency on SCC to support scanning for CBR rules. SCC CBR support is being tracked in https://github.ibm.com/project-fortress/pm/issues/11800.", "is_valid": true + }, + { + "scc_rule_id": "rule-216e2449-27d7-4afc-929a-b66e196a9cf9", + "description": "Check whether Flow Logs for VPC are enabled", + "ignore_reason": "In order for this rule to pass, Context Based Restrictions (CBRs) support needs to be added to the module (tracking in https://github.ibm.com/GoldenEye/issues/issues/5626). Even after that is added, there is still a dependency on SCC to support scanning for CBR rules. SCC CBR support is being tracked in https://github.ibm.com/project-fortress/pm/issues/11800.", + "is_valid": true } ] } diff --git a/ibm_catalog.json b/ibm_catalog.json index 8cd4304e..00ff0822 100755 --- a/ibm_catalog.json +++ b/ibm_catalog.json @@ -55,7 +55,7 @@ "id": "2dd486c7-b317-4aaa-907b-42671485ad96-global", "name": "deploy-arch-ibm-pvs-inf", "install_type": "fullstack", - "version": ">=1.0.0" + "version": ">=3.0.0" } ], "configuration": [ @@ -67,7 +67,7 @@ "catalogID": "1082e7d2-5e2f-0a11-a3bc-f88a8e1931fc", "flavorConstraint": "powervs-workspace", "offeringID": "2dd486c7-b317-4aaa-907b-42671485ad96-global", - "versionConstraint": ">=1.0.0" + "versionConstraint": ">=3.0.0" }, "grouping": "deployment", "original_grouping": "deployment", @@ -129,7 +129,7 @@ "value": "us-south" }, { - "displayname": "Dallas 10 (dal10)", + "displayname": "Dallas 10 (dal10) PER", "value": "dal10" }, { @@ -169,15 +169,16 @@ "custom_config": {} }, { - "key": "powervs_create_separate_fs_share", - "required": true + "key": "powervs_create_separate_sharefs_instance", + "required": true, + "default_value": "" }, { "key": "powervs_hana_instance_name", "required": true }, { - "key": "powervs_hana_sap_profile_id", + "key": "powervs_hana_instance_sap_profile_id", "required": true }, { @@ -221,19 +222,44 @@ "required": true }, { - "key": "powervs_share_storage_config" + "key": "powervs_hana_instance_custom_storage_config", + "custom_config": { + "grouping": "deployment", + "original_grouping": "deployment", + "type": "json_editor" + } }, { - "key": "powervs_hana_custom_storage_config" + "key": "powervs_hana_instance_additional_storage_config", + "custom_config": { + "grouping": "deployment", + "original_grouping": "deployment", + "type": "json_editor" + } }, { - "key": "powervs_hana_additional_storage_config" + "key": "powervs_netweaver_instance_storage_config", + "custom_config": { + "grouping": "deployment", + "original_grouping": "deployment", + "type": "json_editor" + } }, { - "key": "powervs_netweaver_storage_config" + "key": "powervs_sharefs_instance", + "custom_config": { + "grouping": "deployment", + "original_grouping": "deployment", + "type": "json_editor" + } }, { - "key": "powervs_default_images" + "key": "powervs_default_sap_images", + "custom_config": { + "grouping": "deployment", + "original_grouping": "deployment", + "type": "json_editor" + } } ], "outputs": [ @@ -256,7 +282,7 @@ "key": "powervs_netweaver_instance_management_ips" }, { - "key": "powervs_share_fs_ips" + "key": "powervs_sharefs_instance_ips" }, { "key": "powervs_lpars_data" @@ -296,15 +322,11 @@ }, { "title": "PowerVS instances", - "description": "SAP HANA Instance: One\n\nSAP NetWeaver Instances: 0,1..N\n\nShared SAP Instance: 0 or 1" + "description": "SAP HANA Instance: 1\n\nSAP NetWeaver Instances: 0,1..N\n\nShared SAP Instance: 0 or 1" }, { "title": "Power Virtual Server with VPC landing zone", "description": "Available" - }, - { - "title": "Secure infrastructure on VPC for regulated industries", - "description": "Available" } ], "diagrams": [ @@ -314,7 +336,7 @@ "url": "https://raw.githubusercontent.com/terraform-ibm-modules/terraform-ibm-powervs-sap/main/reference-architectures/sap-ready-to-go/deploy-arch-ibm-pvs-sap-ready-to-go.svg", "type": "image/svg+xml" }, - "description": "'SAP ready PowerVS' variation of 'SAP on secure Power Virtual Servers' creates a basic and expandable SAP system landscape builds on the foundation of the 'Secure infrastructure on VPC for regulated industries' and 'Power Virtual Server with VPC landing zone'. PowerVS instances for SAP HANA, SAP NetWeaver and optionally for shared SAP files are deployed and preconfigured for SAP installation.\n\nServices such as DNS, NTP and NFS running in VPC and provided by 'Power Virtual Server with VPC landing zone' are leveraged.\n\nRedundant IBM Cloud Connections provide the network bridge between the IBM Power infrastructure and the IBM VPC and public internet.\n\nThe resulting SAP landscape leverages the services such as Activity Tracker, Cloud Object Storage, Key Management from the 'Secure infrastructure on VPC for regulated industries' and the network connectivity configuration provided by 'Power Virtual Server with VPC landing zone'." + "description": "'SAP ready PowerVS' variation of 'SAP on secure Power Virtual Servers' creates a basic and expandable SAP system landscape builds on the foundation of the 'Power Virtual Server with VPC landing zone'. PowerVS instances for SAP HANA, SAP NetWeaver and optionally for shared SAP files are deployed and preconfigured for SAP installation.\n\nServices such as DNS, NTP and NFS running in VPC and provided by 'Power Virtual Server with VPC landing zone' are leveraged.\n\nRedundant IBM Cloud Connections provide the network bridge between the IBM Power infrastructure and the IBM VPC and public internet.\n\nThe resulting SAP landscape leverages the services such as Activity Tracker, Cloud Object Storage, Key Management from the 'Secure infrastructure on VPC for regulated industries' and the network connectivity configuration provided by 'Power Virtual Server with VPC landing zone'." } ] } diff --git a/modules/ansible_sap_instance_init/README.md b/modules/ansible_sap_instance_init/README.md deleted file mode 100644 index d3994327..00000000 --- a/modules/ansible_sap_instance_init/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# Module power_sap_instance_init - -This module configures the PVS instance and prepares the system for SAP installation. -- Run ansible galaxy roles to prepare OS for SAP - - -### Requirements - -| Name | Version | -|------|---------| -| [terraform](#requirement\_terraform) | >= 1.3 | -| [null](#requirement\_null) | >= 3.2.1 | - -### Modules - -No modules. - -### Resources - -| Name | Type | -|------|------| -| [null_resource.configure_os_for_sap](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource | - -### Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [access\_host\_or\_ip](#input\_access\_host\_or\_ip) | Public IP of Bastion Host | `string` | n/a | yes | -| [sap\_domain](#input\_sap\_domain) | Domain name to be set. | `string` | `""` | no | -| [sap\_solutions](#input\_sap\_solutions) | List of SAP solution configurations to be executed on the PowerVS instances defined in 'target\_server\_ips'. The order should match to 'target\_server\_ips'. Possible values are 'HANA', 'NETWEAVER', 'NONE'. | `list(string)` | n/a | yes | -| [ssh\_private\_key](#input\_ssh\_private\_key) | Private Key to configure Instance, Will not be uploaded to server. | `string` | n/a | yes | -| [target\_server\_ips](#input\_target\_server\_ips) | List of private IPs of PowerVS instances reachable from the access host. | `list(string)` | n/a | yes | - -### Outputs - -No outputs. - diff --git a/modules/ansible_sap_instance_init/main.tf b/modules/ansible_sap_instance_init/main.tf deleted file mode 100644 index 02d26d11..00000000 --- a/modules/ansible_sap_instance_init/main.tf +++ /dev/null @@ -1,63 +0,0 @@ -##################################################### -# 1. Execute Ansible galaxy role to prepare OS for SAP -##################################################### - -locals { - scr_scripts_dir = "${path.module}/templates" - dst_scripts_dir = "/root/terraform_scripts" - - ansible_configure_os_for_sap_playbook_name = "power-linux-configure.yml" - src_script_configure_os_for_sap_tfpl_path = "${local.scr_scripts_dir}/configure_os_for_sap.sh.tfpl" - dst_script_configure_os_for_sap_sh_path = "${local.dst_scripts_dir}/configure_os_for_sap.sh" - dst_ansible_vars_configure_os_for_sap_path = "${local.dst_scripts_dir}/ansible_configure_os_for_sap.yml" -} - -##################################################### -# 1. Execute Ansible galaxy role to prepare OS for SAP -##################################################### - -resource "null_resource" "configure_os_for_sap" { - count = length(var.target_server_ips) - - connection { - type = "ssh" - user = "root" - bastion_host = var.access_host_or_ip - host = var.target_server_ips[count.index] - private_key = var.ssh_private_key - agent = false - timeout = "5m" - } - - #### Write the variables required for ansible roles to file on target host #### - provisioner "file" { - destination = local.dst_ansible_vars_configure_os_for_sap_path - content = <ansible.cfg - -if [[ " $${power_linux_sap_arr[@]} " =~ " $${playbook_name} " ]]; then - unbuffer ansible-playbook --connection=local -i 'localhost,' ~/.ansible/collections/ansible_collections/ibm/power_linux_sap/playbooks/$${playbook_name} --extra-vars "@$${ansible_vars_location}" - status=$? - [ $status -eq 0 ] && echo \"Playbook command successful\" || exit 1 -fi diff --git a/modules/ansible_sap_instance_init/variables.tf b/modules/ansible_sap_instance_init/variables.tf deleted file mode 100644 index 7c3fcc92..00000000 --- a/modules/ansible_sap_instance_init/variables.tf +++ /dev/null @@ -1,26 +0,0 @@ -variable "access_host_or_ip" { - description = "Public IP of Bastion Host" - type = string -} - -variable "sap_domain" { - description = "Domain name to be set." - type = string - default = "" -} - -variable "target_server_ips" { - description = "List of private IPs of PowerVS instances reachable from the access host." - type = list(string) -} - -variable "ssh_private_key" { - description = "Private Key to configure Instance, Will not be uploaded to server." - type = string - sensitive = true -} - -variable "sap_solutions" { - description = "List of SAP solution configurations to be executed on the PowerVS instances defined in 'target_server_ips'. The order should match to 'target_server_ips'. Possible values are 'HANA', 'NETWEAVER', 'NONE'." - type = list(string) -} diff --git a/modules/ansible_sap_instance_init/versions.tf b/modules/ansible_sap_instance_init/versions.tf deleted file mode 100644 index 9c802f6d..00000000 --- a/modules/ansible_sap_instance_init/versions.tf +++ /dev/null @@ -1,13 +0,0 @@ -##################################################### -# powervs sap instance initialization Module -##################################################### - -terraform { - required_version = ">= 1.3" - required_providers { - null = { - source = "hashicorp/null" - version = ">= 3.2.1" - } - } -} diff --git a/modules/powervs_hana_storage_config/main.tf b/modules/pi-hana-storage-config/main.tf similarity index 58% rename from modules/powervs_hana_storage_config/main.tf rename to modules/pi-hana-storage-config/main.tf index f0f001e8..c559c3ea 100644 --- a/modules/powervs_hana_storage_config/main.tf +++ b/modules/pi-hana-storage-config/main.tf @@ -3,7 +3,7 @@ ####################################################### locals { - auto_cal_memory_size = tonumber(element(split("x", var.powervs_hana_sap_profile_id), 1)) < 256 ? 256 : tonumber(element(split("x", var.powervs_hana_sap_profile_id), 1)) + auto_cal_memory_size = tonumber(element(split("x", var.pi_hana_instance_sap_profile_id), 1)) < 256 ? 256 : tonumber(element(split("x", var.pi_hana_instance_sap_profile_id), 1)) auto_cal_data_volume_size = floor((local.auto_cal_memory_size * 1.1) / 4) + 1 auto_cal_log_volume_size = floor((local.auto_cal_memory_size * 0.5) / 4) + 1 > 512 ? 512 : floor((local.auto_cal_memory_size * 0.5) / 4) + 1 auto_cal_shared_volume_size = floor(local.auto_cal_memory_size > 1024 ? 1024 : local.auto_cal_memory_size) @@ -19,7 +19,7 @@ locals { } ] - additional_hana_storage_set = var.powervs_hana_additional_storage_config != null ? var.powervs_hana_additional_storage_config[0].count != "" ? true : false : false - custom_hana_storage_set = var.powervs_hana_custom_storage_config != null ? var.powervs_hana_custom_storage_config[0].count != "" ? true : false : false - hana_storage_config = local.custom_hana_storage_set ? local.additional_hana_storage_set ? concat(var.powervs_hana_custom_storage_config, var.powervs_hana_additional_storage_config) : var.powervs_hana_custom_storage_config : local.additional_hana_storage_set ? concat(local.auto_cal_hana_storage_config, var.powervs_hana_additional_storage_config) : local.auto_cal_hana_storage_config + additional_hana_storage_set = var.pi_hana_instance_additional_storage_config != null ? var.pi_hana_instance_additional_storage_config[0].count != "" ? true : false : false + custom_hana_storage_set = var.pi_hana_instance_custom_storage_config != null ? var.pi_hana_instance_custom_storage_config[0].count != "" ? true : false : false + hana_storage_config = local.custom_hana_storage_set ? local.additional_hana_storage_set ? concat(var.pi_hana_instance_custom_storage_config, var.pi_hana_instance_additional_storage_config) : var.pi_hana_instance_custom_storage_config : local.additional_hana_storage_set ? concat(local.auto_cal_hana_storage_config, var.pi_hana_instance_additional_storage_config) : local.auto_cal_hana_storage_config } diff --git a/modules/powervs_hana_storage_config/outputs.tf b/modules/pi-hana-storage-config/outputs.tf similarity index 75% rename from modules/powervs_hana_storage_config/outputs.tf rename to modules/pi-hana-storage-config/outputs.tf index ae76248c..4159d88e 100644 --- a/modules/powervs_hana_storage_config/outputs.tf +++ b/modules/pi-hana-storage-config/outputs.tf @@ -1,4 +1,4 @@ -output "hana_storage_config" { +output "pi_hana_storage_config" { description = "Storage configuration for HANA instance" value = local.hana_storage_config } diff --git a/modules/powervs_hana_storage_config/variables.tf b/modules/pi-hana-storage-config/variables.tf similarity index 90% rename from modules/powervs_hana_storage_config/variables.tf rename to modules/pi-hana-storage-config/variables.tf index d615d34e..5408ed90 100644 --- a/modules/powervs_hana_storage_config/variables.tf +++ b/modules/pi-hana-storage-config/variables.tf @@ -1,10 +1,10 @@ -variable "powervs_hana_sap_profile_id" { +variable "pi_hana_instance_sap_profile_id" { description = "SAP HANA profile to use. Must be one of the supported profiles. See [here](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-power-vs). File system sizes are automatically calculated. Override automatic calculation by setting values in optional sap_hana_custom_storage_config parameter." type = string default = "ush1-4x128" } -variable "powervs_hana_custom_storage_config" { +variable "pi_hana_instance_custom_storage_config" { description = "Custom File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." type = list(object({ name = string @@ -22,7 +22,7 @@ variable "powervs_hana_custom_storage_config" { }] } -variable "powervs_hana_additional_storage_config" { +variable "pi_hana_instance_additional_storage_config" { description = "Additional File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." type = list(object({ name = string diff --git a/modules/powervs_hana_storage_config/versions.tf b/modules/pi-hana-storage-config/versions.tf similarity index 100% rename from modules/powervs_hana_storage_config/versions.tf rename to modules/pi-hana-storage-config/versions.tf diff --git a/modules/pi-sap-system-type1/README.md b/modules/pi-sap-system-type1/README.md new file mode 100644 index 00000000..77f7cd43 --- /dev/null +++ b/modules/pi-sap-system-type1/README.md @@ -0,0 +1,80 @@ +# Module pi-sap-system-type1 + +The Power Virtual Server for SAP module automates the following tasks: + +- Creates a new private subnet for SAP communication for entire landscape and attaches it to cloud connections(in Non PER DC). +- Creates and configures one PowerVS instance for SAP HANA that is based on best practices. +- Creates and configures multiple PowerVS instances for SAP NetWeaver that are based on best practices. +- Creates and configures one optional PowerVS instance(sharefs) that can be used for sharing SAP files between other system instances. +- Connects all created PowerVS instances to a proxy server that is specified by IP address or hostname. +- Optionally connects all created PowerVS instances to an NTP server and DNS forwarder that are specified by IP address or hostname. +- Optionally configures a shared NFS directory on all created PowerVS instances. +- Post instance provisioning, ansible galaxy collection roles [ibm.power_linux_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/) are executed. +- Tested with RHEL8.4, RHEL 8.6, SLES15-SP4 and SLES15-SP6 images. + +## Notes: +- **Does not install any SAP softwares or solutions.** +- Filesystem sizes for HANA data and HANA log are **calculated automatically** based on the **memory size**. Custom storage configuration is also supported. +- If **sharefs instance is enabled**, then all filesystems provisioned for sharefs instance will be **NFS exported and mounted** on all Netweaver Instances. +- **Do not specify** a filesystem `/sapmnt` explicitly for Netweaver instance as, it is created internally when sharefs instance is not enabled. + + +### Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.3 | +| [ibm](#requirement\_ibm) | >= 1.49.0 | +| [null](#requirement\_null) | >= 3.2.1 | + +### Modules + +| Name | Source | Version | +|------|--------|---------| +| [ansible\_netweaver\_sapmnt\_mount](#module\_ansible\_netweaver\_sapmnt\_mount) | ../remote-exec-ansible | n/a | +| [ansible\_sap\_instance\_init](#module\_ansible\_sap\_instance\_init) | ../remote-exec-ansible | n/a | +| [ansible\_sharefs\_instance\_exportfs](#module\_ansible\_sharefs\_instance\_exportfs) | ../remote-exec-ansible | n/a | +| [pi\_attach\_sap\_network](#module\_pi\_attach\_sap\_network) | terraform-ibm-modules/powervs-workspace/ibm//modules/pi-cloudconnection-attach | 1.1.3 | +| [pi\_hana\_instance](#module\_pi\_hana\_instance) | terraform-ibm-modules/powervs-instance/ibm | 1.0.2 | +| [pi\_hana\_storage\_calculation](#module\_pi\_hana\_storage\_calculation) | ../pi-hana-storage-config | n/a | +| [pi\_netweaver\_instance](#module\_pi\_netweaver\_instance) | terraform-ibm-modules/powervs-instance/ibm | 1.0.2 | +| [pi\_sharefs\_instance](#module\_pi\_sharefs\_instance) | terraform-ibm-modules/powervs-instance/ibm | 1.0.2 | + +### Resources + +| Name | Type | +|------|------| +| [ibm_pi_network.sap_network](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/pi_network) | resource | + +### Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [cloud\_connection\_count](#input\_cloud\_connection\_count) | Existing number of Cloud connections to which new subnet must be attached. Will be ignored in case of PER enabled DC. | `string` | `2` | no | +| [pi\_hana\_instance](#input\_pi\_hana\_instance) | SAP HANA hostname (non FQDN) will get the form of -. SAP HANA profile to use. Must be one of the supported profiles. See [here](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-power-vs). File system sizes are automatically calculated. Override automatic calculation by setting values in optional 'pi\_hana\_instance\_custom\_storage\_config' parameter. 'additional\_storage\_config' additional file systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
object({
name = string
image_id = string
sap_profile_id = string
additional_storage_config = list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
})
|
{
"additional_storage_config": [
{
"count": "1",
"mount": "/usr/sap",
"name": "usrsap",
"size": "50",
"tier": "tier3"
}
],
"image_id": "insert_value_here",
"name": "hana",
"sap_profile_id": "ush1-4x256"
}
| no | +| [pi\_hana\_instance\_custom\_storage\_config](#input\_pi\_hana\_instance\_custom\_storage\_config) | Custom File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
|
[
{
"count": "",
"mount": "",
"name": "",
"size": "",
"tier": ""
}
]
| no | +| [pi\_instance\_init\_linux](#input\_pi\_instance\_init\_linux) | Configures a PowerVS linux instance to have internet access by setting proxy on it, updates os and create filesystems using ansible collection [ibm.power\_linux\_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/). where 'proxy\_host\_or\_ip\_port' E.g., 10.10.10.4:3128 , 'bastion\_host\_ip' is public IP of bastion/jump host to access the private IP of created linux PowerVS instance. |
object(
{
enable = bool
bastion_host_ip = string
ssh_private_key = string
proxy_host_or_ip_port = string
no_proxy_hosts = string
}
)
| n/a | yes | +| [pi\_netweaver\_instance](#input\_pi\_netweaver\_instance) | 'instance\_count' is number of SAP NetWeaver instances that should be created. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
object({
instance_count = number
name = string
image_id = string
processors = string
memory = string
proc_type = string
storage_config = list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
})
|
{
"image_id": "insert_value_here",
"instance_count": 1,
"memory": "32",
"name": "nw",
"proc_type": "shared",
"processors": "3",
"storage_config": [
{
"count": "1",
"mount": "/usr/sap",
"name": "usrsap",
"size": "50",
"tier": "tier3"
}
]
}
| no | +| [pi\_networks](#input\_pi\_networks) | Existing list of subnets to be attached to PowerVS instances. The first element will become the primary interface. Run 'ibmcloud pi networks' to list available private subnets. |
list(
object({
name = string
id = string
cidr = optional(string)
})
)
| n/a | yes | +| [pi\_sap\_network\_cidr](#input\_pi\_sap\_network\_cidr) | Additional private subnet for SAP communication which will be created. CIDR for SAP network. E.g., '10.53.0.0/24' | `string` | `"10.53.0.0/24"` | no | +| [pi\_sharefs\_instance](#input\_pi\_sharefs\_instance) | Deploy separate IBM PowerVS instance as central file system share. All filesystems defined in 'pi\_sharefs\_instance\_storage\_config' variable will be NFS exported and mounted on Netweaver PowerVS instances if enabled. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
object({
enable = bool
name = string
image_id = string
processors = string
memory = string
proc_type = string
storage_config = list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
})
|
{
"enable": false,
"image_id": "insert_value_here",
"memory": "2",
"name": "share",
"proc_type": "shared",
"processors": "0.5",
"storage_config": [
{
"count": "1",
"mount": "/sapmnt",
"name": "sapmnt",
"size": "300",
"tier": "tier3"
},
{
"count": "1",
"mount": "/usr/trans",
"name": "trans",
"size": "50",
"tier": "tier3"
}
]
}
| no | +| [pi\_ssh\_public\_key\_name](#input\_pi\_ssh\_public\_key\_name) | Existing PowerVS SSH Public Key Name. | `string` | n/a | yes | +| [pi\_workspace\_guid](#input\_pi\_workspace\_guid) | PowerVS infrastructure workspace guid. The GUID of the resource instance. | `string` | n/a | yes | +| [pi\_zone](#input\_pi\_zone) | IBM Cloud data center location where IBM PowerVS Workspace exists. | `string` | n/a | yes | +| [prefix](#input\_prefix) | Unique prefix for resources to be created (e.g., SAP system name). | `string` | n/a | yes | +| [sap\_domain](#input\_sap\_domain) | SAP domain to be set for entire landscape. | `string` | `"sap.com"` | no | +| [sap\_network\_services\_config](#input\_sap\_network\_services\_config) | Configures network services NTP, NFS and DNS on PowerVS instance. Requires 'pi\_instance\_init\_linux' to be specified as internet access is required to download ansible collection [ibm.power\_linux\_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/) to configure these services. |
object(
{
nfs = object({ enable = bool, nfs_server_path = string, nfs_client_path = string })
dns = object({ enable = bool, dns_server_ip = string })
ntp = object({ enable = bool, ntp_server_ip = string })
}
)
|
{
"dns": {
"dns_server_ip": "",
"enable": false
},
"nfs": {
"enable": false,
"nfs_client_path": "",
"nfs_server_path": ""
},
"ntp": {
"enable": false,
"ntp_server_ip": ""
}
}
| no | + +### Outputs + +| Name | Description | +|------|-------------| +| [access\_host\_or\_ip](#output\_access\_host\_or\_ip) | Public IP of Provided Bastion/JumpServer Host | +| [pi\_hana\_instance\_ips](#output\_pi\_hana\_instance\_ips) | All private IPS of HANA instance | +| [pi\_hana\_instance\_management\_ip](#output\_pi\_hana\_instance\_management\_ip) | Management IP of HANA Instance | +| [pi\_hana\_instance\_sap\_ip](#output\_pi\_hana\_instance\_sap\_ip) | SAP IP of PowerVS HANA Instance | +| [pi\_lpars\_data](#output\_pi\_lpars\_data) | All private IPS of PowerVS instances and Jump IP to access the host. | +| [pi\_netweaver\_instance\_ips](#output\_pi\_netweaver\_instance\_ips) | All private IPS of NetWeaver instances | +| [pi\_netweaver\_instance\_management\_ips](#output\_pi\_netweaver\_instance\_management\_ips) | Management IPS of NetWeaver instances | +| [pi\_sharefs\_instance\_ips](#output\_pi\_sharefs\_instance\_ips) | Private IPs of the Share FS instance. | + diff --git a/modules/pi-sap-system-type1/main.tf b/modules/pi-sap-system-type1/main.tf new file mode 100644 index 00000000..ad98af76 --- /dev/null +++ b/modules/pi-sap-system-type1/main.tf @@ -0,0 +1,216 @@ +##################################################### +# Create SAP network for the SAP System +##################################################### + +resource "ibm_pi_network" "sap_network" { + pi_cloud_instance_id = var.pi_workspace_guid + pi_network_name = "${var.prefix}-net" + pi_cidr = var.pi_sap_network_cidr + pi_dns = ["127.0.0.1"] + pi_network_type = "vlan" + pi_network_jumbo = true +} + +##################################################### +# Non PER DC: Attach the SAP network to CCs +##################################################### + +locals { + per_enabled_dc_list = ["dal10"] + per_enabled = contains(local.per_enabled_dc_list, var.pi_zone) +} + +module "pi_attach_sap_network" { + source = "terraform-ibm-modules/powervs-workspace/ibm//modules/pi-cloudconnection-attach" + version = "1.1.3" + count = local.per_enabled ? 0 : 1 + + pi_workspace_guid = var.pi_workspace_guid + pi_private_subnet_ids = [resource.ibm_pi_network.sap_network.network_id] + pi_cloud_connection_count = var.cloud_connection_count +} + +locals { + pi_sap_network = { "name" = "${var.prefix}-net", "cidr" = var.pi_sap_network_cidr, "id" = ibm_pi_network.sap_network.network_id } + pi_networks = concat(var.pi_networks, [local.pi_sap_network]) +} + + +########################################################################################################## +# Deploy sharefs instance +########################################################################################################## + +locals { + pi_sharefs_instance_name = "${var.prefix}-${var.pi_sharefs_instance.name}" +} + +module "pi_sharefs_instance" { + source = "terraform-ibm-modules/powervs-instance/ibm" + version = "1.0.2" + count = var.pi_sharefs_instance.enable ? 1 : 0 + + pi_workspace_guid = var.pi_workspace_guid + pi_instance_name = local.pi_sharefs_instance_name + pi_ssh_public_key_name = var.pi_ssh_public_key_name + pi_image_id = var.pi_sharefs_instance.image_id + pi_networks = local.pi_networks + pi_sap_profile_id = null + pi_number_of_processors = var.pi_sharefs_instance.processors + pi_memory_size = var.pi_sharefs_instance.memory + pi_server_type = "s922" + pi_cpu_proc_type = var.pi_sharefs_instance.proc_type + pi_storage_config = var.pi_sharefs_instance.storage_config + pi_instance_init_linux = var.pi_instance_init_linux + pi_network_services_config = var.sap_network_services_config +} + +# Configuration for sharefs instance as NFS server +locals { + valid_sharefs_nfs_config = var.pi_sharefs_instance.enable && var.pi_sharefs_instance.storage_config != null ? var.pi_sharefs_instance.storage_config[0].name != "" ? true : false : false + pi_sharefs_instance_nfs_server_config = { + nfs = { + enable = local.valid_sharefs_nfs_config ? true : false, + nfs_file_system = local.valid_sharefs_nfs_config ? [ + for volume in var.pi_sharefs_instance.storage_config : + { name = volume.name, + mount_path = volume.mount, + size = volume.size + } + ] : [] } + } +} + +module "ansible_sharefs_instance_exportfs" { + source = "../remote-exec-ansible" + depends_on = [module.pi_sharefs_instance] + count = var.pi_sharefs_instance.enable ? 1 : 0 + + bastion_host = var.pi_instance_init_linux.bastion_host_ip + host = module.pi_sharefs_instance[0].pi_instance_primary_ip + ssh_private_key = var.pi_instance_init_linux.ssh_private_key + src_script_template_name = "ansible_exec.sh.tftpl" + dst_script_file_name = "configure_nfs_server.sh" + src_playbook_template_name = "playbook_configure_network_services.yml.tftpl" + dst_playbook_file_name = "playbook_configure_nfs_server.yml" + playbook_template_content = { server_config = jsonencode(local.pi_sharefs_instance_nfs_server_config), client_config = jsonencode({}) } +} + + +########################################################################################################## +# Deploy SAP HANA Instance +########################################################################################################## + +locals { + pi_hana_instance_name = "${var.prefix}-${var.pi_hana_instance.name}" +} + +module "pi_hana_storage_calculation" { + source = "../pi-hana-storage-config" + pi_hana_instance_sap_profile_id = var.pi_hana_instance.sap_profile_id + pi_hana_instance_additional_storage_config = var.pi_hana_instance.additional_storage_config + pi_hana_instance_custom_storage_config = var.pi_hana_instance_custom_storage_config +} + +module "pi_hana_instance" { + source = "terraform-ibm-modules/powervs-instance/ibm" + version = "1.0.2" + + pi_workspace_guid = var.pi_workspace_guid + pi_instance_name = local.pi_hana_instance_name + pi_ssh_public_key_name = var.pi_ssh_public_key_name + pi_image_id = var.pi_hana_instance.image_id + pi_networks = local.pi_networks + pi_sap_profile_id = var.pi_hana_instance.sap_profile_id + pi_storage_config = module.pi_hana_storage_calculation.pi_hana_storage_config + pi_instance_init_linux = var.pi_instance_init_linux + pi_network_services_config = var.sap_network_services_config +} + +locals { + pi_hana_instance_ips = split(", ", module.pi_hana_instance.pi_instance_private_ips) + pi_hana_instance_sap_ip = local.pi_hana_instance_ips[index([for ip in local.pi_hana_instance_ips : alltrue([for i, v in split(".", ip) : tonumber(split(".", cidrhost(var.pi_sap_network_cidr, 0))[i]) <= tonumber(v) && tonumber(v) <= tonumber(split(".", cidrhost(var.pi_sap_network_cidr, -1))[i])])], true)] +} + + +########################################################################################################## +# Deploy SAP Netweaver Instances +########################################################################################################## + +locals { + + pi_netweaver_instance_name = "${var.prefix}-${var.pi_netweaver_instance.name}" + pi_netweaver_instance_sapmnt_storage = [{ "name" : "sapmnt", "size" : "300", "count" : "1", "tier" : "tier3", "mount" : "/sapmnt" }] + pi_netweaver_instance_storage_config = var.pi_sharefs_instance.enable ? var.pi_netweaver_instance.storage_config : concat(var.pi_netweaver_instance.storage_config, local.pi_netweaver_instance_sapmnt_storage) +} + +module "pi_netweaver_instance" { + source = "terraform-ibm-modules/powervs-instance/ibm" + version = "1.0.2" + count = var.pi_netweaver_instance.instance_count + + pi_workspace_guid = var.pi_workspace_guid + pi_instance_name = "${local.pi_netweaver_instance_name}-${count.index + 1}" + pi_ssh_public_key_name = var.pi_ssh_public_key_name + pi_image_id = var.pi_netweaver_instance.image_id + pi_networks = local.pi_networks + pi_sap_profile_id = null + pi_number_of_processors = var.pi_netweaver_instance.processors + pi_memory_size = var.pi_netweaver_instance.memory + pi_server_type = "s922" + pi_cpu_proc_type = var.pi_netweaver_instance.proc_type + pi_storage_config = local.pi_netweaver_instance_storage_config + pi_instance_init_linux = var.pi_instance_init_linux + pi_network_services_config = var.sap_network_services_config +} + +locals { + pi_netweaver_instance_sapmnt_config = { + nfs = { + enable = local.valid_sharefs_nfs_config ? true : false, + nfs_server_path = local.valid_sharefs_nfs_config ? join(";", [for volume in var.pi_sharefs_instance.storage_config : "${module.pi_sharefs_instance[0].pi_instance_primary_ip}:${volume.mount}"]) : "", + nfs_client_path = local.valid_sharefs_nfs_config ? join(";", [for volume in var.pi_sharefs_instance.storage_config : volume.mount]) : "" + } + } +} + +module "ansible_netweaver_sapmnt_mount" { + + source = "../remote-exec-ansible" + depends_on = [module.ansible_sharefs_instance_exportfs, module.pi_netweaver_instance] + count = var.pi_sharefs_instance.enable && local.valid_sharefs_nfs_config ? var.pi_netweaver_instance.instance_count : 0 + + bastion_host = var.pi_instance_init_linux.bastion_host_ip + host = module.pi_netweaver_instance[count.index].pi_instance_primary_ip + ssh_private_key = var.pi_instance_init_linux.ssh_private_key + src_script_template_name = "ansible_exec.sh.tftpl" + dst_script_file_name = "sapmnt_mount.sh" + src_playbook_template_name = "playbook_configure_network_services.yml.tftpl" + dst_playbook_file_name = "playbook_configure_sapmnt.yml" + playbook_template_content = { server_config = jsonencode({}), client_config = jsonencode(local.pi_netweaver_instance_sapmnt_config) } +} + + +##################################################### +# Prepare OS for SAP +##################################################### + +locals { + target_server_ips = concat([module.pi_hana_instance.pi_instance_primary_ip], module.pi_netweaver_instance[*].pi_instance_primary_ip) + sap_solutions = concat(["HANA"], [for ip in module.pi_netweaver_instance[*].pi_instance_primary_ip : "NETWEAVER"]) +} + +module "ansible_sap_instance_init" { + + source = "../remote-exec-ansible" + depends_on = [module.pi_hana_instance, module.pi_netweaver_instance, module.ansible_netweaver_sapmnt_mount] + count = length(local.target_server_ips) + + bastion_host = var.pi_instance_init_linux.bastion_host_ip + host = local.target_server_ips[count.index] + ssh_private_key = var.pi_instance_init_linux.ssh_private_key + src_script_template_name = "ansible_exec.sh.tftpl" + dst_script_file_name = "configure_os_for_sap.sh" + src_playbook_template_name = "playbook_configure_os_for_sap.yml.tftpl" + dst_playbook_file_name = "playbook_configure_os_for_sap.yml" + playbook_template_content = { sap_solution = local.sap_solutions[count.index], sap_domain = var.sap_domain } +} diff --git a/modules/pi-sap-system-type1/outputs.tf b/modules/pi-sap-system-type1/outputs.tf new file mode 100644 index 00000000..f8ab59b4 --- /dev/null +++ b/modules/pi-sap-system-type1/outputs.tf @@ -0,0 +1,46 @@ +output "access_host_or_ip" { + description = "Public IP of Provided Bastion/JumpServer Host" + value = var.pi_instance_init_linux.bastion_host_ip +} + +output "pi_hana_instance_ips" { + description = "All private IPS of HANA instance" + value = module.pi_hana_instance.pi_instance_private_ips +} + +output "pi_hana_instance_management_ip" { + description = "Management IP of HANA Instance" + value = module.pi_hana_instance.pi_instance_primary_ip +} + +output "pi_hana_instance_sap_ip" { + description = "SAP IP of PowerVS HANA Instance" + value = local.pi_hana_instance_sap_ip +} + +output "pi_netweaver_instance_ips" { + description = "All private IPS of NetWeaver instances" + value = var.pi_netweaver_instance.instance_count >= 1 ? module.pi_netweaver_instance[*].pi_instance_private_ips : [""] +} + +output "pi_netweaver_instance_management_ips" { + description = "Management IPS of NetWeaver instances" + value = var.pi_netweaver_instance.instance_count >= 1 ? join(",", module.pi_netweaver_instance[*].pi_instance_primary_ip) : "" +} + +output "pi_sharefs_instance_ips" { + description = "Private IPs of the Share FS instance." + value = var.pi_sharefs_instance.enable ? module.pi_sharefs_instance[0].pi_instance_private_ips : "" +} + +output "pi_lpars_data" { + description = "All private IPS of PowerVS instances and Jump IP to access the host." + value = { + "access_host_or_ip" = nonsensitive(var.pi_instance_init_linux.bastion_host_ip) + "pi_hana_instance_management_ip" = module.pi_hana_instance.pi_instance_primary_ip + "pi_hana_instance_ips" = module.pi_hana_instance.pi_instance_private_ips + "pi_netweaver_instances_management_ip" = var.pi_netweaver_instance.instance_count >= 1 ? join(",", module.pi_netweaver_instance[*].pi_instance_primary_ip) : "" + "pi_netweaver_instance_ips" = var.pi_netweaver_instance.instance_count >= 1 ? module.pi_netweaver_instance[*].pi_instance_private_ips : [""] + "pi_sharefs_instance_ips" = var.pi_sharefs_instance.enable ? module.pi_sharefs_instance[0].pi_instance_private_ips : "" + } +} diff --git a/modules/pi-sap-system-type1/variables.tf b/modules/pi-sap-system-type1/variables.tf new file mode 100644 index 00000000..71ad3472 --- /dev/null +++ b/modules/pi-sap-system-type1/variables.tf @@ -0,0 +1,222 @@ +variable "pi_zone" { + description = "IBM Cloud data center location where IBM PowerVS Workspace exists." + type = string +} + +variable "prefix" { + description = "Unique prefix for resources to be created (e.g., SAP system name)." + type = string +} + +variable "pi_workspace_guid" { + description = "PowerVS infrastructure workspace guid. The GUID of the resource instance." + type = string +} + +variable "pi_ssh_public_key_name" { + description = "Existing PowerVS SSH Public Key Name." + type = string +} + +variable "pi_networks" { + description = "Existing list of subnets to be attached to PowerVS instances. The first element will become the primary interface. Run 'ibmcloud pi networks' to list available private subnets." + type = list( + object({ + name = string + id = string + cidr = optional(string) + }) + ) +} + +variable "pi_sap_network_cidr" { + description = "Additional private subnet for SAP communication which will be created. CIDR for SAP network. E.g., '10.53.0.0/24'" + type = string + default = "10.53.0.0/24" + validation { + condition = anytrue([can(regex("^10\\.((([2][0-5]{2})|([0-1]{0,1}[0-9]{1,2}))\\.){2}(([2][0-5]{2})|([0-1]{0,1}[0-9]{1,2}))", var.pi_sap_network_cidr)), can(regex("^192\\.168\\.((([2][0-5]{2})|([0-1]{0,1}[0-9]{1,2}))\\.)(([2][0-5]{2})|([0-1]{0,1}[0-9]{1,2}))", var.pi_sap_network_cidr)), can(regex("^172\\.(([1][6-9])|([2][0-9])|([3][0-1]))\\.((([2][0-5]{2})|([0-1]{0,1}[0-9]{1,2}))\\.)(([2][0-5]{2})|([0-1]{0,1}[0-9]{1,2}))", var.pi_sap_network_cidr))]) + error_message = "Must be a valid private IPv4 CIDR block address." + } +} + + +variable "cloud_connection_count" { + description = "Existing number of Cloud connections to which new subnet must be attached. Will be ignored in case of PER enabled DC." + type = string + default = 2 +} + +##################################################### +# PowerVS Shared FS Instance parameters +##################################################### + +variable "pi_sharefs_instance" { + description = "Deploy separate IBM PowerVS instance as central file system share. All filesystems defined in 'pi_sharefs_instance_storage_config' variable will be NFS exported and mounted on Netweaver PowerVS instances if enabled. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." + type = object({ + enable = bool + name = string + image_id = string + processors = string + memory = string + proc_type = string + storage_config = list(object({ + name = string + size = string + count = string + tier = string + mount = string + })) + }) + default = { + enable = false + name = "share" + image_id = "insert_value_here" + processors = "0.5" + memory = "2" + proc_type = "shared" + storage_config = [{ + "name" : "sapmnt", + "size" : "300", + "count" : "1", + "tier" : "tier3", + "mount" : "/sapmnt" + }, + { + "name" : "trans", + "size" : "50", + "count" : "1", + "tier" : "tier3", + "mount" : "/usr/trans" + }] + } +} + +##################################################### +# PowerVS HANA Instance parameters +##################################################### + +variable "pi_hana_instance" { + description = "SAP HANA hostname (non FQDN) will get the form of -. SAP HANA profile to use. Must be one of the supported profiles. See [here](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-power-vs). File system sizes are automatically calculated. Override automatic calculation by setting values in optional 'pi_hana_instance_custom_storage_config' parameter. 'additional_storage_config' additional file systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." + type = object({ + name = string + image_id = string + sap_profile_id = string + additional_storage_config = list(object({ + name = string + size = string + count = string + tier = string + mount = string + })) + }) + default = { + name = "hana" + image_id = "insert_value_here" + sap_profile_id = "ush1-4x256" + additional_storage_config = [{ + "name" : "usrsap", + "size" : "50", + "count" : "1", + "tier" : "tier3", + "mount" : "/usr/sap" + }] + } +} + +variable "pi_hana_instance_custom_storage_config" { + description = "Custom File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." + type = list(object({ + name = string + size = string + count = string + tier = string + mount = string + })) + default = [{ + "name" : "", + "size" : "", + "count" : "", + "tier" : "", + "mount" : "" + }] +} + +##################################################### +# PowerVS NetWeaver Instance parameters +##################################################### + +variable "pi_netweaver_instance" { + description = "'instance_count' is number of SAP NetWeaver instances that should be created. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. " + type = object({ + instance_count = number + name = string + image_id = string + processors = string + memory = string + proc_type = string + storage_config = list(object({ + name = string + size = string + count = string + tier = string + mount = string + })) + }) + default = { + instance_count = 1 + name = "nw" + image_id = "insert_value_here" + processors = "3" + memory = "32" + proc_type = "shared" + storage_config = [{ + "name" : "usrsap", + "size" : "50", + "count" : "1", + "tier" : "tier3", + "mount" : "/usr/sap" + }] + } +} + +##################################################### +# PVS SAP instance Initialization +##################################################### + +variable "pi_instance_init_linux" { + description = "Configures a PowerVS linux instance to have internet access by setting proxy on it, updates os and create filesystems using ansible collection [ibm.power_linux_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/). where 'proxy_host_or_ip_port' E.g., 10.10.10.4:3128 , 'bastion_host_ip' is public IP of bastion/jump host to access the private IP of created linux PowerVS instance." + sensitive = true + type = object( + { + enable = bool + bastion_host_ip = string + ssh_private_key = string + proxy_host_or_ip_port = string + no_proxy_hosts = string + } + ) +} + +variable "sap_network_services_config" { + description = "Configures network services NTP, NFS and DNS on PowerVS instance. Requires 'pi_instance_init_linux' to be specified as internet access is required to download ansible collection [ibm.power_linux_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/) to configure these services." + type = object( + { + nfs = object({ enable = bool, nfs_server_path = string, nfs_client_path = string }) + dns = object({ enable = bool, dns_server_ip = string }) + ntp = object({ enable = bool, ntp_server_ip = string }) + } + ) + + default = { + nfs = { enable = false, nfs_server_path = "", nfs_client_path = "" } + dns = { enable = false, dns_server_ip = "" } + ntp = { enable = false, ntp_server_ip = "" } + } + +} + +variable "sap_domain" { + description = "SAP domain to be set for entire landscape." + type = string + default = "sap.com" +} diff --git a/solutions/sap-ready-to-go/module/version.tf b/modules/pi-sap-system-type1/version.tf similarity index 100% rename from solutions/sap-ready-to-go/module/version.tf rename to modules/pi-sap-system-type1/version.tf diff --git a/modules/powervs_attach_private_network/README.md b/modules/powervs_attach_private_network/README.md deleted file mode 100755 index 4c3a83ae..00000000 --- a/modules/powervs_attach_private_network/README.md +++ /dev/null @@ -1,57 +0,0 @@ -# Module attach_sap_network -This module attaches the newly created sap private network to the cloud connections. - -## Usage -```hcl -provider "ibm" { - region = var.powervs_region - zone = var.powervs_zone - ibmcloud_api_key = var.ibmcloud_api_key != null ? var.ibmcloud_api_key : null -} - -module "attach_sap_network" { - - powervs_zone = var.powervs_zone - powervs_resource_group_name = var.powervs_resource_group_name - powervs_workspace_name = var.powervs_workspace_name - powervs_sap_network_name = var.powervs_sap_network_name - powervs_cloud_connection_count = var.powervs_cloud_connection_count -} -``` - -### Requirements - -| Name | Version | -|------|---------| -| [terraform](#requirement\_terraform) | >= 1.3 | -| [ibm](#requirement\_ibm) | >=1.49.0 | - -### Modules - -No modules. - -### Resources - -| Name | Type | -|------|------| -| [ibm_pi_cloud_connection_network_attach.powervs_subnet_instance_nw_attach](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/pi_cloud_connection_network_attach) | resource | -| [ibm_pi_cloud_connection_network_attach.powervs_subnet_instance_nw_attach_backup](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/pi_cloud_connection_network_attach) | resource | -| [ibm_pi_cloud_connections.cloud_connection_ds](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/pi_cloud_connections) | data source | -| [ibm_pi_network.additional_network_ds](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/pi_network) | data source | -| [ibm_resource_group.resource_group_ds](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/resource_group) | data source | -| [ibm_resource_instance.powervs_workspace_ds](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/resource_instance) | data source | - -### Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [powervs\_cloud\_connection\_count](#input\_powervs\_cloud\_connection\_count) | Number of existing Cloud connections to attach new private network | `string` | n/a | yes | -| [powervs\_resource\_group\_name](#input\_powervs\_resource\_group\_name) | Existing IBM Cloud resource group name. | `string` | n/a | yes | -| [powervs\_sap\_network\_name](#input\_powervs\_sap\_network\_name) | Name for new network for SAP system | `string` | n/a | yes | -| [powervs\_workspace\_name](#input\_powervs\_workspace\_name) | Existing Name of the PowerVS workspace. | `string` | n/a | yes | -| [powervs\_zone](#input\_powervs\_zone) | IBM Cloud PowerVS zone. | `string` | n/a | yes | - -### Outputs - -No outputs. - diff --git a/modules/powervs_attach_private_network/main.tf b/modules/powervs_attach_private_network/main.tf deleted file mode 100644 index 7ff114d8..00000000 --- a/modules/powervs_attach_private_network/main.tf +++ /dev/null @@ -1,54 +0,0 @@ -##################################################### -# IBM Cloud PowerVS Resource Configuration -##################################################### - -locals { - service_type = "power-iaas" -} - -data "ibm_resource_group" "resource_group_ds" { - name = var.powervs_resource_group_name -} - -data "ibm_resource_instance" "powervs_workspace_ds" { - name = var.powervs_workspace_name - service = local.service_type - location = var.powervs_zone - resource_group_id = data.ibm_resource_group.resource_group_ds.id -} - -##################################################### -# Get Additional Private Subnet -##################################################### - -data "ibm_pi_network" "additional_network_ds" { - pi_cloud_instance_id = data.ibm_resource_instance.powervs_workspace_ds.guid - pi_network_name = var.powervs_sap_network_name -} - -##################################################### -# Reuse Cloud Connection to attach PVS subnets -##################################################### - -data "ibm_pi_cloud_connections" "cloud_connection_ds" { - pi_cloud_instance_id = data.ibm_resource_instance.powervs_workspace_ds.guid -} - -######################################################################### -# Extend landscape and attach additional workload specific private network -######################################################################### - -resource "ibm_pi_cloud_connection_network_attach" "powervs_subnet_instance_nw_attach" { - count = var.powervs_cloud_connection_count > 0 ? 1 : 0 - pi_cloud_instance_id = data.ibm_resource_instance.powervs_workspace_ds.guid - pi_cloud_connection_id = data.ibm_pi_cloud_connections.cloud_connection_ds.connections[0].cloud_connection_id - pi_network_id = data.ibm_pi_network.additional_network_ds.pi_network_name -} - -resource "ibm_pi_cloud_connection_network_attach" "powervs_subnet_instance_nw_attach_backup" { - depends_on = [ibm_pi_cloud_connection_network_attach.powervs_subnet_instance_nw_attach] - count = var.powervs_cloud_connection_count > 1 ? 1 : 0 - pi_cloud_instance_id = data.ibm_resource_instance.powervs_workspace_ds.guid - pi_cloud_connection_id = data.ibm_pi_cloud_connections.cloud_connection_ds.connections[1].cloud_connection_id - pi_network_id = data.ibm_pi_network.additional_network_ds.pi_network_name -} diff --git a/modules/powervs_attach_private_network/outputs.tf b/modules/powervs_attach_private_network/outputs.tf deleted file mode 100644 index e69de29b..00000000 diff --git a/modules/powervs_attach_private_network/variables.tf b/modules/powervs_attach_private_network/variables.tf deleted file mode 100644 index ab843c07..00000000 --- a/modules/powervs_attach_private_network/variables.tf +++ /dev/null @@ -1,24 +0,0 @@ -variable "powervs_zone" { - description = "IBM Cloud PowerVS zone." - type = string -} - -variable "powervs_resource_group_name" { - description = "Existing IBM Cloud resource group name." - type = string -} - -variable "powervs_workspace_name" { - description = "Existing Name of the PowerVS workspace." - type = string -} - -variable "powervs_sap_network_name" { - description = "Name for new network for SAP system" - type = string -} - -variable "powervs_cloud_connection_count" { - description = "Number of existing Cloud connections to attach new private network" - type = string -} diff --git a/modules/powervs_attach_private_network/versions.tf b/modules/powervs_attach_private_network/versions.tf deleted file mode 100644 index a2bda2e9..00000000 --- a/modules/powervs_attach_private_network/versions.tf +++ /dev/null @@ -1,13 +0,0 @@ -##################################################### -# IBM Cloud PowerVS workspace Module -##################################################### - -terraform { - required_version = ">= 1.3" - required_providers { - ibm = { - source = "IBM-Cloud/ibm" - version = ">=1.49.0" - } - } -} diff --git a/modules/powervs_create_private_network/README.md b/modules/powervs_create_private_network/README.md deleted file mode 100755 index 711c451f..00000000 --- a/modules/powervs_create_private_network/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# Module attach_sap_network -This module creates a subnet in PowerVS workspace. - -## Usage -```hcl -provider "ibm" { - region = var.powervs_region - zone = var.powervs_zone - ibmcloud_api_key = var.ibmcloud_api_key != null ? var.ibmcloud_api_key : null -} - -module "create_sap_network" { - powervs_zone = var.powervs_zone - - powervs_resource_group_name = var.powervs_resource_group_name - powervs_workspace_name = var.powervs_workspace_name - powervs_sap_network_name = var.powervs_sap_network_name - powervs_sap_network_cidr = var.powervs_sap_network_cidr -} -``` - -### Requirements - -| Name | Version | -|------|---------| -| [terraform](#requirement\_terraform) | >= 1.3 | -| [ibm](#requirement\_ibm) | >=1.49.0 | - -### Modules - -No modules. - -### Resources - -| Name | Type | -|------|------| -| [ibm_pi_network.additional_network](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/pi_network) | resource | -| [ibm_resource_group.resource_group_ds](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/resource_group) | data source | -| [ibm_resource_instance.powervs_workspace_ds](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/resource_instance) | data source | - -### Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [powervs\_resource\_group\_name](#input\_powervs\_resource\_group\_name) | Existing IBM Cloud resource group name. | `string` | n/a | yes | -| [powervs\_sap\_network](#input\_powervs\_sap\_network) | Name and CIDR for new network for SAP system to create. |
object({
name = string
cidr = string
})
| n/a | yes | -| [powervs\_workspace\_name](#input\_powervs\_workspace\_name) | Existing Name of the PowerVS workspace. | `string` | n/a | yes | -| [powervs\_zone](#input\_powervs\_zone) | IBM Cloud PowerVS zone. | `string` | n/a | yes | - -### Outputs - -No outputs. - diff --git a/modules/powervs_create_private_network/main.tf b/modules/powervs_create_private_network/main.tf deleted file mode 100644 index 0a81b3eb..00000000 --- a/modules/powervs_create_private_network/main.tf +++ /dev/null @@ -1,31 +0,0 @@ -##################################################### -# IBM Cloud PowerVS Resource Configuration -##################################################### - -locals { - service_type = "power-iaas" -} - -data "ibm_resource_group" "resource_group_ds" { - name = var.powervs_resource_group_name -} - -data "ibm_resource_instance" "powervs_workspace_ds" { - name = var.powervs_workspace_name - service = local.service_type - location = var.powervs_zone - resource_group_id = data.ibm_resource_group.resource_group_ds.id -} - -##################################################### -# Create Additional Private Subnet -##################################################### - -resource "ibm_pi_network" "additional_network" { - pi_cloud_instance_id = data.ibm_resource_instance.powervs_workspace_ds.guid - pi_network_name = var.powervs_sap_network["name"] - pi_cidr = var.powervs_sap_network["cidr"] - pi_dns = ["127.0.0.1"] - pi_network_type = "vlan" - pi_network_jumbo = true -} diff --git a/modules/powervs_create_private_network/outputs.tf b/modules/powervs_create_private_network/outputs.tf deleted file mode 100644 index e69de29b..00000000 diff --git a/modules/powervs_create_private_network/variables.tf b/modules/powervs_create_private_network/variables.tf deleted file mode 100644 index d8577149..00000000 --- a/modules/powervs_create_private_network/variables.tf +++ /dev/null @@ -1,22 +0,0 @@ -variable "powervs_zone" { - description = "IBM Cloud PowerVS zone." - type = string -} - -variable "powervs_resource_group_name" { - description = "Existing IBM Cloud resource group name." - type = string -} - -variable "powervs_workspace_name" { - description = "Existing Name of the PowerVS workspace." - type = string -} - -variable "powervs_sap_network" { - description = "Name and CIDR for new network for SAP system to create." - type = object({ - name = string - cidr = string - }) -} diff --git a/modules/powervs_create_private_network/versions.tf b/modules/powervs_create_private_network/versions.tf deleted file mode 100644 index a2bda2e9..00000000 --- a/modules/powervs_create_private_network/versions.tf +++ /dev/null @@ -1,13 +0,0 @@ -##################################################### -# IBM Cloud PowerVS workspace Module -##################################################### - -terraform { - required_version = ">= 1.3" - required_providers { - ibm = { - source = "IBM-Cloud/ibm" - version = ">=1.49.0" - } - } -} diff --git a/modules/remote-exec-ansible/main.tf b/modules/remote-exec-ansible/main.tf new file mode 100644 index 00000000..e5e0136d --- /dev/null +++ b/modules/remote-exec-ansible/main.tf @@ -0,0 +1,52 @@ +##################################################### +# 1. Execute Ansible galaxy role +##################################################### + +locals { + src_ansible_templates_dir = "${path.module}/../templates-ansible" + dst_files_dir = "/root/terraform_files" + + src_script_tftpl_path = "${local.src_ansible_templates_dir}/${var.src_script_template_name}" + dst_script_file_path = "${local.dst_files_dir}/${var.dst_script_file_name}" + src_playbook_tftpl_path = "${local.src_ansible_templates_dir}/${var.src_playbook_template_name}" + dst_playbook_file_path = "${local.dst_files_dir}/${var.dst_playbook_file_name}" + +} + +resource "terraform_data" "remote_exec_ansible" { + + connection { + type = "ssh" + user = "root" + bastion_host = var.bastion_host + host = var.host + private_key = var.ssh_private_key + agent = false + timeout = "10m" + } + + ####### Execute commands on target host ############ + provisioner "remote-exec" { + inline = ["mkdir -p ${local.dst_files_dir}", "chmod 777 ${local.dst_files_dir}", ] + } + + ####### Copy first template file to target host ############ + provisioner "file" { + content = templatefile(local.src_playbook_tftpl_path, var.playbook_template_content) + destination = local.dst_playbook_file_path + } + + ####### Copy second template file to target host ############ + provisioner "file" { + content = templatefile(local.src_script_tftpl_path, { "ansible_playbook_file" : local.dst_playbook_file_path, "ansible_log_path" : local.dst_files_dir }) + destination = local.dst_script_file_path + } + + ####### Execute commands on target host ############ + provisioner "remote-exec" { + inline = [ + "chmod +x ${local.dst_script_file_path}", + local.dst_script_file_path, + ] + } +} diff --git a/modules/ansible_sap_instance_init/outputs.tf b/modules/remote-exec-ansible/outputs.tf similarity index 100% rename from modules/ansible_sap_instance_init/outputs.tf rename to modules/remote-exec-ansible/outputs.tf diff --git a/modules/remote-exec-ansible/variables.tf b/modules/remote-exec-ansible/variables.tf new file mode 100644 index 00000000..dcbd5923 --- /dev/null +++ b/modules/remote-exec-ansible/variables.tf @@ -0,0 +1,40 @@ +variable "bastion_host" { + description = "Public IP of bastion host." + type = string +} + +variable "host" { + description = "Private IP of instance reachable from the bastion host." + type = string +} + +variable "ssh_private_key" { + description = "Private Key to configure Instance, will not be uploaded to server." + type = string + sensitive = true +} + +variable "src_script_template_name" { + description = "Bash template script filename." + type = string +} + +variable "dst_script_file_name" { + description = "Bash script filename." + type = string +} + +variable "src_playbook_template_name" { + description = "Playbook template filename." + type = string +} + +variable "dst_playbook_file_name" { + description = "Playbook filename." + type = string +} + +variable "playbook_template_content" { + description = "Playbook template content." + type = map(any) +} diff --git a/modules/remote-exec-ansible/version.tf b/modules/remote-exec-ansible/version.tf new file mode 100644 index 00000000..69642684 --- /dev/null +++ b/modules/remote-exec-ansible/version.tf @@ -0,0 +1,3 @@ +terraform { + required_version = ">= 1.3" +} diff --git a/modules/templates-ansible/ansible_exec.sh.tftpl b/modules/templates-ansible/ansible_exec.sh.tftpl new file mode 100644 index 00000000..0fc5e937 --- /dev/null +++ b/modules/templates-ansible/ansible_exec.sh.tftpl @@ -0,0 +1,19 @@ +#!/bin/bash + +### Using input variables from terraform +ansible_playbook=${ansible_playbook_file} +ansible_log_path=${ansible_log_path} + +### Download and install collections from ansible-galaxy +ansible-galaxy collection install ibm.power_linux_sap:1.1.4 -f +ansible-galaxy collection install ansible.utils + +### Bug in ansible system role. Changing http to https for installing ibm power tools +sed -i 's,http://public.dhe.ibm.com/software/server/POWER/Linux/yum/download/ibm-power-repo-latest.noarch.rpm,https://public.dhe.ibm.com/software/server/POWER/Linux/yum/download/ibm-power-repo-latest.noarch.rpm,g' /usr/share/ansible/roles/sap_hana_preconfigure/vars/RedHat_8.yml + +ansible_playbook_name=$(basename $${ansible_playbook}) +## Execute ansible playbook +echo -e "[defaults]\nlog_path=$${ansible_log_path}/$${ansible_playbook_name}.$(date "+%Y.%m.%d-%H.%M.%S").log" >ansible.cfg +unbuffer ansible-playbook --connection=local -i 'localhost,' $${ansible_playbook} +status=$? +[ $status -eq 0 ] && echo \"Playbook command successful\" || exit 1 diff --git a/modules/templates-ansible/playbook_configure_network_services.yml.tftpl b/modules/templates-ansible/playbook_configure_network_services.yml.tftpl new file mode 100644 index 00000000..cafa1c37 --- /dev/null +++ b/modules/templates-ansible/playbook_configure_network_services.yml.tftpl @@ -0,0 +1,18 @@ +# ------------------------------------------------------------------------ +# This playbook uses the ibm.power_linux_sap collection. This collection is +# available on ansible galaxy +# https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/ and can +# be installed using 'ansible-galaxy collection install ibm.power_linux_sap' +# ------------------------------------------------------------------------ + +--- +- hosts: all + vars: + server_config: ${server_config} + client_config: ${client_config} + + roles: + - role: ibm.power_linux_sap.powervs_client_enable_services + when: client_config.keys()|length > 0 + - role: ibm.power_linux_sap.powervs_install_services + when: server_config.keys()|length > 0 diff --git a/modules/templates-ansible/playbook_configure_os_for_sap.yml.tftpl b/modules/templates-ansible/playbook_configure_os_for_sap.yml.tftpl new file mode 100644 index 00000000..715817ec --- /dev/null +++ b/modules/templates-ansible/playbook_configure_os_for_sap.yml.tftpl @@ -0,0 +1,38 @@ +# ------------------------------------------------------------------------ +# This playbook uses the ibm.power_linux_sap collection. This collection is +# available on ansible galaxy +# https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/ and can +# be installed using 'ansible-galaxy collection install ibm.power_linux_sap' +# ------------------------------------------------------------------------ + +--- +- hosts: all + vars: + sap_solution: ${sap_solution} + sap_domain: ${sap_domain} + + roles: + - { role: ibm.power_linux_sap.powervs_prepare_rhel_sap, when: sap_solution is defined and ansible_distribution is match("RedHat*") } + - { role: ibm.power_linux_sap.powervs_prepare_sles_sap, when: sap_solution is defined and ansible_distribution is match("SLES*") } + tasks: + - include_role: + name: sap_general_preconfigure + vars: + sap_general_preconfigure_fail_if_reboot_required: no + when: + - ansible_distribution is match("RedHat*") + - sap_solution is defined + - include_role: + name: sap_hana_preconfigure + vars: + sap_hana_preconfigure_fail_if_reboot_required: no + when: + - ansible_distribution is match("RedHat*") + - sap_solution is defined + - sap_solution is match("HANA") + - include_role: + name: sap_netweaver_preconfigure + when: + - ansible_distribution is match("RedHat*") + - sap_solution is defined + - sap_solution is match("NETWEAVER") diff --git a/solutions/basic/main.tf b/solutions/basic/main.tf deleted file mode 100644 index e6b8d27b..00000000 --- a/solutions/basic/main.tf +++ /dev/null @@ -1,52 +0,0 @@ -locals { - ibm_powervs_zone_region_map = { - "lon04" = "lon" - "lon06" = "lon" - "eu-de-1" = "eu-de" - "eu-de-2" = "eu-de" - "tor01" = "tor" - "mon01" = "mon" - "osa21" = "osa" - "tok04" = "tok" - "syd04" = "syd" - "syd05" = "syd" - "sao01" = "sao" - "us-south" = "us-south" - "dal10" = "us-south" - "dal12" = "us-south" - "us-east" = "us-east" - } -} - -provider "ibm" { - region = lookup(local.ibm_powervs_zone_region_map, var.powervs_zone, null) - zone = var.powervs_zone - ibmcloud_api_key = var.ibmcloud_api_key != null ? var.ibmcloud_api_key : null -} - -##################################################### -# Simple Resource -##################################################### - -locals { - service_type = "power-iaas" - plan = "power-virtual-server-group" -} - -data "ibm_resource_group" "resource_group_ds" { - name = var.powervs_resource_group_name -} - -resource "ibm_resource_instance" "powervs_workspace" { - name = "${var.prefix}-${var.powervs_workspace_name}" - service = local.service_type - plan = local.plan - location = var.powervs_zone - resource_group_id = data.ibm_resource_group.resource_group_ds.id - - timeouts { - create = "6m" - update = "5m" - delete = "10m" - } -} diff --git a/solutions/basic/outputs.tf b/solutions/basic/outputs.tf deleted file mode 100644 index e69de29b..00000000 diff --git a/solutions/basic/variables.tf b/solutions/basic/variables.tf deleted file mode 100644 index f689055c..00000000 --- a/solutions/basic/variables.tf +++ /dev/null @@ -1,32 +0,0 @@ -variable "ibmcloud_api_key" { - description = "The IBM Cloud platform API key needed to deploy IAM enabled resources." - type = string - sensitive = true -} - -variable "powervs_zone" { - description = "IBM Cloud PowerVS zone." - type = string - default = "syd05" - validation { - condition = contains(["syd04", "syd05", "eu-de-1", "eu-de-2", "lon04", "lon06", "us-east", "us-south", "dal10", "dal12", "tok04", "osa21", "sao01", "mon01", "tor01"], var.powervs_zone) - error_message = "Only Following DC values are supported : syd04, syd05, eu-de-1, eu-de-2, lon04, lon06, us-east, us-south, dal10, dal12, tok04, osa21, sao01, mon01, tor01" - } -} - -variable "prefix" { - description = "A unique identifier for resources. Must begin with a lowercase letter and end with a lowercase letter or number. " - type = string -} - -variable "powervs_resource_group_name" { - description = "Existing IBM Cloud resource group name." - type = string - default = "Default" -} - -variable "powervs_workspace_name" { - description = "Name of the PowerVS workspace to create." - type = string - default = "power-workspace" -} diff --git a/solutions/basic/version.tf b/solutions/basic/version.tf deleted file mode 100644 index d9a8f277..00000000 --- a/solutions/basic/version.tf +++ /dev/null @@ -1,13 +0,0 @@ -##################################################### -# PowerVs SAP Instance Module -##################################################### - -terraform { - required_version = ">= 1.3" - required_providers { - ibm = { - source = "IBM-Cloud/ibm" - version = ">=1.49.0" - } - } -} diff --git a/solutions/e2e/README.md b/solutions/e2e/README.md new file mode 100644 index 00000000..5ff6c300 --- /dev/null +++ b/solutions/e2e/README.md @@ -0,0 +1,127 @@ +# End to End Solution : Power Virtual Server with VPC landing zone including Power Virtual Server for SAP HANA instances + +The end to end solution automates the following tasks: + +- A **VPC Infrastructure** based on value passed to `var.landing_zone_configuration` with the following components: + - **landing_zone_configuration = 3VPC_RHEL or 3VPC_SLES** + + - Provisions three VPCs with one VSI in each VPC one management(jump/bastion) VSI, one inet-svs VSI configured as squid proxy server, one private-svs VSI (configured as NFS, NTP, DNS server) using [this preset](https://github.com/terraform-ibm-modules/terraform-ibm-powervs-infrastructure/blob/main/modules/powervs-vpc-landing-zone/presets/3vpc.preset.json.tftpl). + - Installs and configures the Squid Proxy, DNS Forwarder, NTP forwarder and NFS on hosts, and sets the host as the server for the NTP, NFS, and DNS services by using ansible galaxy collection roles [ibm.power_linux_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/). + + - **landing_zone_configuration = 1VPC_RHEL** + + - One VPC with one VSI for management(jump/bastion) using [this preset](https://github.com/terraform-ibm-modules/terraform-ibm-powervs-infrastructure/blob/main/modules/powervs-vpc-landing-zone/presets/1vpc.preset.json.tftpl). + - Installation and configuration of Squid Proxy, DNS Forwarder, NTP forwarder and NFS on the bastion host, and sets the host as the server for the NTP, NFS, and DNS services using ansible galaxy collection roles [ibm.power_linux_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/) + +- **A Power Virtual Server workspace** with the following network topology: + - Creates two private networks: a management network and a backup network. + - Creates one or two IBM Cloud connections in Non PER environment. + - Attaches the private networks to the IBM Cloud connections in Non PER environment. + - Attaches the IBM Cloud connections to a transit gateway in Non PER environment. + - Attaches the PowerVS workspace to Transit gateway in PER enabled DC + - Creates an SSH key. + +- Finally Interconnects both VPC and PowerVS infrastructure. + +- **Power Virtual Server Instances** + - Creates a new private subnet for SAP communication for entire landscape and attaches it to cloud connections(in Non PER DC). + - Creates and configures one PowerVS instance for SAP HANA that is based on best practices. + - Creates and configures multiple PowerVS instances for SAP NetWeaver that are based on best practices. + - Creates and configures one optional PowerVS instance that can be used for sharing SAP files between other system instances. + - Connects all created PowerVS instances to a proxy server that is specified by IP address or hostname. + - Optionally connects all created PowerVS instances to an NTP server and DNS forwarder that are specified by IP address or hostname. + - Optionally configures a shared NFS directory on all created PowerVS instances. + - Post instance provisioning, ansible galaxy collection roles [ibm.power_linux_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/) are executed. + - Tested with RHEL8.4, RHEL 8.6, SLES15-SP4 and SLES15-SP6 images. + +## Notes +- **Does not install any SAP softwares or solutions.** +- Filesystem sizes for HANA data and HANA log are **calculated automatically** based on the **memory size**. Custom storage configuration is also supported. +- If **sharefs instance is enabled**, then all filesystems provisioned for sharefs instance will be **NFS exported and mounted** on all Netweaver Instances. +- **Do not specify** a filesystem `/sapmnt` explicitly for Netweaver instance as, it is created internally when sharefs instance is not enabled. + + +| Variation | Available on IBM Catalog | Requires Schematics Workspace ID | Creates PowerVS with VPC landing zone | Creates PowerVS HANA Instance | Creates PowerVS NW Instances | Performs PowerVS OS Config | Performs PowerVS SAP Tuning | Install SAP software | +|:---------------------------------------------------------------------------:|:------------------------:|:--------------------------------:|:-------------------------------------:|:-----------------------------:|:----------------------------:|:--------------------------:|:---------------------------:|:--------------------:| +| [ End-to-End ](./) | N/A | N/A | :heavy_check_mark: | 1 | 0 to N | :heavy_check_mark: | :heavy_check_mark: | N/A | + + +### Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.3, < 1.6 | +| [ibm](#requirement\_ibm) | >=1.58.1 | +| [time](#requirement\_time) | >= 0.9.1 | + +### Modules + +| Name | Source | Version | +|------|--------|---------| +| [fullstack](#module\_fullstack) | terraform-ibm-modules/powervs-infrastructure/ibm//modules/powervs-vpc-landing-zone | 3.0.0 | +| [sap\_system](#module\_sap\_system) | ../../modules/pi-sap-system-type1 | n/a | + +### Resources + +| Name | Type | +|------|------| +| [time_sleep.wait_5_mins](https://registry.terraform.io/providers/hashicorp/time/latest/docs/resources/sleep) | resource | + +### Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [configure\_dns\_forwarder](#input\_configure\_dns\_forwarder) | Specify if DNS forwarder will be configured. This will allow you to use central DNS servers (e.g. IBM Cloud DNS servers) sitting outside of the created IBM PowerVS infrastructure. If yes, ensure 'dns\_forwarder\_config' optional variable is set properly. DNS forwarder will be installed on the private-svs vsi. | `bool` | `true` | no | +| [configure\_nfs\_server](#input\_configure\_nfs\_server) | Specify if NFS server will be configured. This will allow you easily to share files between PowerVS instances (e.g., SAP installation files). NFS server will be installed on the private-svs vsi. If yes, ensure 'nfs\_server\_config' optional variable is set properly below. Default value is 1TB which will be mounted on /nfs. | `bool` | `true` | no | +| [configure\_ntp\_forwarder](#input\_configure\_ntp\_forwarder) | Specify if NTP forwarder will be configured. This will allow you to synchronize time between IBM PowerVS instances. NTP forwarder will be installed on the private-svs vsi. | `bool` | `true` | no | +| [external\_access\_ip](#input\_external\_access\_ip) | Specify the IP address or CIDR to login through SSH to the environment after deployment. Access to this environment will be allowed only from this IP address. | `string` | n/a | yes | +| [ibmcloud\_api\_key](#input\_ibmcloud\_api\_key) | The IBM Cloud platform API key needed to deploy IAM enabled resources. | `string` | n/a | yes | +| [landing\_zone\_configuration](#input\_landing\_zone\_configuration) | VPC landing zone configuration. | `string` | n/a | yes | +| [os\_image\_distro](#input\_os\_image\_distro) | Image distribution to use for all instances(Shared, HANA, Netweaver). OS release versions may be specified in 'var.powervs\_default\_images' optional parameters below. | `string` | n/a | yes | +| [powervs\_create\_separate\_sharefs\_instance](#input\_powervs\_create\_separate\_sharefs\_instance) | Deploy separate IBM PowerVS instance as central file system share. All filesystems defined in 'powervs\_sharefs\_instance\_storage\_config' variable will be NFS exported and mounted on Netweaver PowerVS instances if enabled. Optional parameter 'powervs\_share\_fs\_instance' can be configured if enabled. | `bool` | n/a | yes | +| [powervs\_default\_sap\_images](#input\_powervs\_default\_sap\_images) | Default SUSE and Red Hat Linux images to use for SAP HANA and SAP NetWeaver PowerVS instances. |
object({
sles_hana_image = string
sles_nw_image = string
rhel_hana_image = string
rhel_nw_image = string
})
|
{
"rhel_hana_image": "RHEL8-SP6-SAP",
"rhel_nw_image": "RHEL8-SP6-SAP-NETWEAVER",
"sles_hana_image": "SLES15-SP4-SAP",
"sles_nw_image": "SLES15-SP4-SAP-NETWEAVER"
}
| no | +| [powervs\_hana\_instance](#input\_powervs\_hana\_instance) | SAP HANA hostname (non FQDN) will get the form of -. SAP HANA profile to use. Must be one of the supported profiles. See [here](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-power-vs). File system sizes are automatically calculated. Override automatic calculation by setting values in optional 'pi\_hana\_instance\_custom\_storage\_config' parameter. 'additional\_storage\_config' additional file systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
object({
name = string
sap_profile_id = string
additional_storage_config = list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
})
|
{
"additional_storage_config": [
{
"count": "1",
"mount": "/usr/sap",
"name": "usrsap",
"size": "50",
"tier": "tier3"
}
],
"name": "hana",
"sap_profile_id": "ush1-4x256"
}
| no | +| [powervs\_hana\_instance\_custom\_storage\_config](#input\_powervs\_hana\_instance\_custom\_storage\_config) | Custom File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
|
[
{
"count": "",
"mount": "",
"name": "",
"size": "",
"tier": ""
}
]
| no | +| [powervs\_netweaver\_instance](#input\_powervs\_netweaver\_instance) | 'instance\_count' is number of SAP NetWeaver instances that should be created. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
object({
instance_count = number
name = string
processors = string
memory = string
proc_type = string
storage_config = list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
})
|
{
"instance_count": 1,
"memory": "32",
"name": "nw",
"proc_type": "shared",
"processors": "3",
"storage_config": [
{
"count": "1",
"mount": "/usr/sap",
"name": "usrsap",
"size": "50",
"tier": "tier3"
}
]
}
| no | +| [powervs\_resource\_group\_name](#input\_powervs\_resource\_group\_name) | Existing IBM Cloud resource group name. | `string` | n/a | yes | +| [powervs\_sap\_network\_cidr](#input\_powervs\_sap\_network\_cidr) | Additional private subnet for SAP communication which will be created. CIDR for SAP network. E.g., '10.53.0.0/24' | `string` | `"10.53.0.0/24"` | no | +| [powervs\_sharefs\_instance](#input\_powervs\_sharefs\_instance) | Share fs instance. This parameter is effective if 'powervs\_create\_separate\_sharefs\_instance' is set to true. size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
object({
name = string
processors = string
memory = string
proc_type = string
storage_config = list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
})
|
{
"memory": "2",
"name": "share",
"proc_type": "shared",
"processors": "0.5",
"storage_config": [
{
"count": "1",
"mount": "/sapmnt",
"name": "sapmnt",
"size": "300",
"tier": "tier3"
},
{
"count": "1",
"mount": "/usr/trans",
"name": "trans",
"size": "50",
"tier": "tier3"
}
]
}
| no | +| [powervs\_zone](#input\_powervs\_zone) | IBM Cloud data center location where IBM PowerVS infrastructure will be created. | `string` | n/a | yes | +| [prefix](#input\_prefix) | A unique identifier for resources. Must begin with a lowercase letter and end with a lowercase letter or number. This prefix will be prepended to any resources provisioned by this template. | `string` | n/a | yes | +| [sap\_domain](#input\_sap\_domain) | SAP domain to be set for entire landscape. | `string` | `"sap.com"` | no | +| [ssh\_private\_key](#input\_ssh\_private\_key) | Private SSH key (RSA format) used to login to IBM PowerVS instances. Should match to public SSH key referenced by 'ssh\_public\_key'. Entered data must be in [heredoc strings format](https://www.terraform.io/language/expressions/strings#heredoc-strings). The key is not uploaded or stored. For more information about SSH keys, see [SSH keys](https://cloud.ibm.com/docs/vpc?topic=vpc-ssh-keys). | `string` | n/a | yes | +| [ssh\_public\_key](#input\_ssh\_public\_key) | Public SSH Key for VSI creation. Must be an RSA key with a key size of either 2048 bits or 4096 bits (recommended). Must be a valid SSH key that does not already exist in the deployment region. | `string` | n/a | yes | + +### Outputs + +| Name | Description | +|------|-------------| +| [access\_host\_or\_ip](#output\_access\_host\_or\_ip) | Access host(jump/bastion) for created PowerVS infrastructure. | +| [cloud\_connection\_count](#output\_cloud\_connection\_count) | Number of cloud connections configured in created PowerVS infrastructure. | +| [dns\_host\_or\_ip](#output\_dns\_host\_or\_ip) | DNS forwarder host for created PowerVS infrastructure. | +| [nfs\_host\_or\_ip\_path](#output\_nfs\_host\_or\_ip\_path) | NFS host for created PowerVS infrastructure. | +| [ntp\_host\_or\_ip](#output\_ntp\_host\_or\_ip) | NTP host for created PowerVS infrastructure. | +| [powervs\_backup\_subnet](#output\_powervs\_backup\_subnet) | Name, ID and CIDR of backup private network in created PowerVS infrastructure. | +| [powervs\_hana\_instance\_ips](#output\_powervs\_hana\_instance\_ips) | All private IPS of HANA instance | +| [powervs\_hana\_instance\_management\_ip](#output\_powervs\_hana\_instance\_management\_ip) | Management IP of HANA Instance | +| [powervs\_images](#output\_powervs\_images) | Object containing imported PowerVS image names and image ids. | +| [powervs\_lpars\_data](#output\_powervs\_lpars\_data) | All private IPS of PowerVS instances and Jump IP to access the host. | +| [powervs\_management\_subnet](#output\_powervs\_management\_subnet) | Name, ID and CIDR of management private network in created PowerVS infrastructure. | +| [powervs\_netweaver\_instance\_ips](#output\_powervs\_netweaver\_instance\_ips) | All private IPS of NetWeaver instances | +| [powervs\_netweaver\_instance\_management\_ips](#output\_powervs\_netweaver\_instance\_management\_ips) | Management IPS of NetWeaver instances | +| [powervs\_resource\_group\_name](#output\_powervs\_resource\_group\_name) | IBM Cloud resource group where PowerVS infrastructure is created. | +| [powervs\_share\_fs\_ips](#output\_powervs\_share\_fs\_ips) | Private IPs of the Share FS instance. | +| [powervs\_ssh\_public\_key](#output\_powervs\_ssh\_public\_key) | SSH public key name and value in created PowerVS infrastructure. | +| [powervs\_workspace\_guid](#output\_powervs\_workspace\_guid) | PowerVS infrastructure workspace guid. The GUID of the resource instance. | +| [powervs\_workspace\_id](#output\_powervs\_workspace\_id) | PowerVS infrastructure workspace id. The unique identifier of the new resource instance. | +| [powervs\_workspace\_name](#output\_powervs\_workspace\_name) | PowerVS infrastructure workspace name. | +| [powervs\_zone](#output\_powervs\_zone) | Zone where PowerVS infrastructure is created. | +| [prefix](#output\_prefix) | The prefix that is associated with all resources | +| [proxy\_host\_or\_ip\_port](#output\_proxy\_host\_or\_ip\_port) | Proxy host:port for created PowerVS infrastructure. | +| [ssh\_public\_key](#output\_ssh\_public\_key) | The string value of the ssh public key used when deploying VPC | +| [transit\_gateway\_id](#output\_transit\_gateway\_id) | The ID of transit gateway. | +| [transit\_gateway\_name](#output\_transit\_gateway\_name) | The name of the transit gateway. | +| [vpc\_names](#output\_vpc\_names) | A list of the names of the VPC. | +| [vsi\_list](#output\_vsi\_list) | A list of VSI with name, id, zone, and primary ipv4 address, VPC Name, and floating IP. | +| [vsi\_names](#output\_vsi\_names) | A list of the vsis names provisioned within the VPCs. | + diff --git a/solutions/e2e/main.tf b/solutions/e2e/main.tf new file mode 100644 index 00000000..03477c81 --- /dev/null +++ b/solutions/e2e/main.tf @@ -0,0 +1,83 @@ +####################################################### +# Power Virtual Server with VPC landing zone module +# VPC landing zone +# PowerVS Workspace +# Transit Gateway, CCs, PowerVS catalog images +####################################################### + +module "fullstack" { + source = "terraform-ibm-modules/powervs-infrastructure/ibm//modules/powervs-vpc-landing-zone" + version = "3.0.0" + + providers = { ibm.ibm-is = ibm.ibm-is, ibm.ibm-pi = ibm.ibm-pi } + + powervs_zone = var.powervs_zone + landing_zone_configuration = var.landing_zone_configuration + prefix = var.prefix + external_access_ip = var.external_access_ip + ssh_public_key = var.ssh_public_key + ssh_private_key = var.ssh_private_key + powervs_resource_group_name = var.powervs_resource_group_name + configure_dns_forwarder = var.configure_dns_forwarder + configure_ntp_forwarder = var.configure_ntp_forwarder + configure_nfs_server = var.configure_nfs_server +} + +resource "time_sleep" "wait_5_mins" { + create_duration = "300s" +} +####################################################### +# Power Virtual Server SAP ready-to-go +# Deploy SAP system +# 1 HANA instance +# 0:N Netweaver Instance +# 1 Optional Sharefs instance +# SAP instance Init +####################################################### + +locals { + powervs_networks = [module.fullstack.powervs_management_subnet, module.fullstack.powervs_backup_subnet] + powervs_sharefs_os_image = var.os_image_distro == "SLES" ? var.powervs_default_sap_images.sles_nw_image : var.powervs_default_sap_images.rhel_nw_image + powervs_hana_os_image = var.os_image_distro == "SLES" ? var.powervs_default_sap_images.sles_hana_image : var.powervs_default_sap_images.rhel_hana_image + powervs_netweaver_os_image = var.os_image_distro == "SLES" ? var.powervs_default_sap_images.sles_nw_image : var.powervs_default_sap_images.rhel_nw_image + + powervs_sharefs_instance = merge(var.powervs_sharefs_instance, { enable = var.powervs_create_separate_sharefs_instance, image_id = lookup(module.fullstack.powervs_images, local.powervs_sharefs_os_image, null) }) + powervs_hana_instance = merge(var.powervs_hana_instance, { image_id = lookup(module.fullstack.powervs_images, local.powervs_hana_os_image, null) }) + powervs_netweaver_instance = merge(var.powervs_netweaver_instance, { image_id = lookup(module.fullstack.powervs_images, local.powervs_netweaver_os_image, null) }) + + powervs_instance_init_linux = { + enable = true + bastion_host_ip = module.fullstack.access_host_or_ip + ssh_private_key = var.ssh_private_key + proxy_host_or_ip_port = module.fullstack.proxy_host_or_ip_port + no_proxy_hosts = "161.0.0.0/8,10.0.0.0/8" + } + + sap_network_services_config = { + nfs = { enable = var.configure_nfs_server, nfs_server_path = module.fullstack.nfs_host_or_ip_path, nfs_client_path = "/nfs" } + dns = { enable = var.configure_dns_forwarder, dns_server_ip = module.fullstack.dns_host_or_ip } + ntp = { enable = var.configure_ntp_forwarder, ntp_server_ip = module.fullstack.ntp_host_or_ip } + } +} + +module "sap_system" { + source = "../../modules/pi-sap-system-type1" + depends_on = [time_sleep.wait_5_mins] + providers = { ibm = ibm.ibm-pi } + + pi_zone = var.powervs_zone + prefix = var.prefix + pi_workspace_guid = module.fullstack.powervs_workspace_guid + pi_ssh_public_key_name = module.fullstack.powervs_ssh_public_key.name + pi_networks = local.powervs_networks + pi_sap_network_cidr = var.powervs_sap_network_cidr + cloud_connection_count = 0 + pi_sharefs_instance = local.powervs_sharefs_instance + pi_hana_instance = local.powervs_hana_instance + pi_hana_instance_custom_storage_config = var.powervs_hana_instance_custom_storage_config + pi_netweaver_instance = local.powervs_netweaver_instance + pi_instance_init_linux = local.powervs_instance_init_linux + sap_network_services_config = local.sap_network_services_config + sap_domain = var.sap_domain + +} diff --git a/solutions/e2e/outputs.tf b/solutions/e2e/outputs.tf new file mode 100644 index 00000000..d5092354 --- /dev/null +++ b/solutions/e2e/outputs.tf @@ -0,0 +1,153 @@ +output "prefix" { + description = "The prefix that is associated with all resources" + value = var.prefix +} + +######################################################################## +# Landing Zone VPC outputs +######################################################################## + +output "vpc_names" { + description = "A list of the names of the VPC." + value = module.fullstack.vpc_names +} + +output "vsi_names" { + description = "A list of the vsis names provisioned within the VPCs." + value = module.fullstack.vsi_names +} + +output "ssh_public_key" { + description = "The string value of the ssh public key used when deploying VPC" + value = var.ssh_public_key +} + +output "transit_gateway_name" { + description = "The name of the transit gateway." + value = module.fullstack.transit_gateway_name +} + +output "transit_gateway_id" { + description = "The ID of transit gateway." + value = module.fullstack.transit_gateway_id +} + +output "vsi_list" { + description = "A list of VSI with name, id, zone, and primary ipv4 address, VPC Name, and floating IP." + value = module.fullstack.vsi_list +} + +output "access_host_or_ip" { + description = "Access host(jump/bastion) for created PowerVS infrastructure." + value = module.fullstack.access_host_or_ip +} + +output "proxy_host_or_ip_port" { + description = "Proxy host:port for created PowerVS infrastructure." + value = module.fullstack.proxy_host_or_ip_port +} + +output "dns_host_or_ip" { + description = "DNS forwarder host for created PowerVS infrastructure." + value = module.fullstack.dns_host_or_ip +} + +output "ntp_host_or_ip" { + description = "NTP host for created PowerVS infrastructure." + value = module.fullstack.ntp_host_or_ip +} + +output "nfs_host_or_ip_path" { + description = "NFS host for created PowerVS infrastructure." + value = module.fullstack.nfs_host_or_ip_path +} + + +######################################################################## +# PowerVS Infrastructure outputs +######################################################################## + +output "powervs_zone" { + description = "Zone where PowerVS infrastructure is created." + value = var.powervs_zone +} + +output "powervs_resource_group_name" { + description = "IBM Cloud resource group where PowerVS infrastructure is created." + value = var.powervs_resource_group_name +} + +output "powervs_workspace_name" { + description = "PowerVS infrastructure workspace name." + value = module.fullstack.powervs_workspace_name +} + +output "powervs_workspace_id" { + description = "PowerVS infrastructure workspace id. The unique identifier of the new resource instance." + value = module.fullstack.powervs_workspace_id +} + +output "powervs_workspace_guid" { + description = "PowerVS infrastructure workspace guid. The GUID of the resource instance." + value = module.fullstack.powervs_workspace_guid +} + +output "powervs_ssh_public_key" { + description = "SSH public key name and value in created PowerVS infrastructure." + value = module.fullstack.powervs_ssh_public_key +} + +output "powervs_management_subnet" { + description = "Name, ID and CIDR of management private network in created PowerVS infrastructure." + value = module.fullstack.powervs_management_subnet +} + +output "powervs_backup_subnet" { + description = "Name, ID and CIDR of backup private network in created PowerVS infrastructure." + value = module.fullstack.powervs_backup_subnet +} + +output "powervs_images" { + description = "Object containing imported PowerVS image names and image ids." + value = module.fullstack.powervs_images +} + +output "cloud_connection_count" { + description = "Number of cloud connections configured in created PowerVS infrastructure." + value = module.fullstack.cloud_connection_count +} + + +######################################################################## +# PowerVS Instance outputs +######################################################################## + +output "powervs_hana_instance_ips" { + description = "All private IPS of HANA instance" + value = module.sap_system.pi_hana_instance_ips +} + +output "powervs_hana_instance_management_ip" { + description = "Management IP of HANA Instance" + value = module.sap_system.pi_hana_instance_management_ip +} + +output "powervs_netweaver_instance_ips" { + description = "All private IPS of NetWeaver instances" + value = module.sap_system.pi_netweaver_instance_ips +} + +output "powervs_netweaver_instance_management_ips" { + description = "Management IPS of NetWeaver instances" + value = module.sap_system.pi_netweaver_instance_management_ips +} + +output "powervs_share_fs_ips" { + description = "Private IPs of the Share FS instance." + value = module.sap_system.pi_sharefs_instance_ips +} + +output "powervs_lpars_data" { + description = "All private IPS of PowerVS instances and Jump IP to access the host." + value = module.sap_system.pi_lpars_data +} diff --git a/solutions/e2e/provider.tf b/solutions/e2e/provider.tf new file mode 100644 index 00000000..d94420c4 --- /dev/null +++ b/solutions/e2e/provider.tf @@ -0,0 +1,52 @@ +locals { + ibm_powervs_zone_region_map = { + "lon04" = "lon" + "lon06" = "lon" + "eu-de-1" = "eu-de" + "eu-de-2" = "eu-de" + "tor01" = "tor" + "mon01" = "mon" + "osa21" = "osa" + "tok04" = "tok" + "syd04" = "syd" + "syd05" = "syd" + "sao01" = "sao" + "us-south" = "us-south" + "dal10" = "us-south" + "dal12" = "us-south" + "us-east" = "us-east" + } + + ibm_powervs_zone_cloud_region_map = { + "syd04" = "au-syd" + "syd05" = "au-syd" + "eu-de-1" = "eu-de" + "eu-de-2" = "eu-de" + "lon04" = "eu-gb" + "lon06" = "eu-gb" + "tok04" = "jp-tok" + "tor01" = "ca-tor" + "osa21" = "jp-osa" + "sao01" = "br-sao" + "mon01" = "ca-tor" + "us-south" = "us-south" + "dal10" = "us-south" + "dal12" = "us-south" + "us-east" = "us-east" + } +} + +# There are discrepancies between the region inputs on the powervs terraform resource, and the vpc ("is") resources +provider "ibm" { + alias = "ibm-pi" + region = lookup(local.ibm_powervs_zone_region_map, var.powervs_zone, null) + zone = var.powervs_zone + ibmcloud_api_key = var.ibmcloud_api_key != null ? var.ibmcloud_api_key : null +} + +provider "ibm" { + alias = "ibm-is" + region = lookup(local.ibm_powervs_zone_cloud_region_map, var.powervs_zone, null) + zone = var.powervs_zone + ibmcloud_api_key = var.ibmcloud_api_key != null ? var.ibmcloud_api_key : null +} diff --git a/solutions/e2e/variables.tf b/solutions/e2e/variables.tf new file mode 100644 index 00000000..56b08d8c --- /dev/null +++ b/solutions/e2e/variables.tf @@ -0,0 +1,235 @@ +##################################################### +# +# Required Parameters +# +##################################################### +variable "ibmcloud_api_key" { + description = "The IBM Cloud platform API key needed to deploy IAM enabled resources." + type = string + sensitive = true +} + +variable "powervs_zone" { + description = "IBM Cloud data center location where IBM PowerVS infrastructure will be created." + type = string +} + +variable "prefix" { + description = "A unique identifier for resources. Must begin with a lowercase letter and end with a lowercase letter or number. This prefix will be prepended to any resources provisioned by this template." + type = string +} + +variable "powervs_resource_group_name" { + description = "Existing IBM Cloud resource group name." + type = string +} + +variable "landing_zone_configuration" { + description = "VPC landing zone configuration." + type = string + + validation { + condition = contains(["3VPC_RHEL", "3VPC_SLES", "1VPC_RHEL"], var.landing_zone_configuration) + error_message = "Provided value must be one of ['3VPC_RHEL', '3VPC_SLES', '1VPC_RHEL'] only" + } +} + +variable "external_access_ip" { + description = "Specify the IP address or CIDR to login through SSH to the environment after deployment. Access to this environment will be allowed only from this IP address." + type = string +} + +variable "ssh_public_key" { + description = "Public SSH Key for VSI creation. Must be an RSA key with a key size of either 2048 bits or 4096 bits (recommended). Must be a valid SSH key that does not already exist in the deployment region." + type = string +} + +variable "ssh_private_key" { + description = "Private SSH key (RSA format) used to login to IBM PowerVS instances. Should match to public SSH key referenced by 'ssh_public_key'. Entered data must be in [heredoc strings format](https://www.terraform.io/language/expressions/strings#heredoc-strings). The key is not uploaded or stored. For more information about SSH keys, see [SSH keys](https://cloud.ibm.com/docs/vpc?topic=vpc-ssh-keys)." + type = string + sensitive = true +} + +variable "os_image_distro" { + description = "Image distribution to use for all instances(Shared, HANA, Netweaver). OS release versions may be specified in 'var.powervs_default_images' optional parameters below." + type = string + + validation { + condition = (upper(var.os_image_distro) == "RHEL" || upper(var.os_image_distro) == "SLES") + error_message = "Supported values are 'RHEL' or 'SLES' only." + } +} + +variable "powervs_create_separate_sharefs_instance" { + description = "Deploy separate IBM PowerVS instance as central file system share. All filesystems defined in 'powervs_sharefs_instance_storage_config' variable will be NFS exported and mounted on Netweaver PowerVS instances if enabled. Optional parameter 'powervs_share_fs_instance' can be configured if enabled." + type = bool +} + +##################################################### +# +# Optional Parameters +# +##################################################### + +variable "configure_dns_forwarder" { + description = "Specify if DNS forwarder will be configured. This will allow you to use central DNS servers (e.g. IBM Cloud DNS servers) sitting outside of the created IBM PowerVS infrastructure. If yes, ensure 'dns_forwarder_config' optional variable is set properly. DNS forwarder will be installed on the private-svs vsi." + type = bool + default = true +} + +variable "configure_ntp_forwarder" { + description = "Specify if NTP forwarder will be configured. This will allow you to synchronize time between IBM PowerVS instances. NTP forwarder will be installed on the private-svs vsi." + type = bool + default = true +} + +variable "configure_nfs_server" { + description = "Specify if NFS server will be configured. This will allow you easily to share files between PowerVS instances (e.g., SAP installation files). NFS server will be installed on the private-svs vsi. If yes, ensure 'nfs_server_config' optional variable is set properly below. Default value is 1TB which will be mounted on /nfs." + type = bool + default = true +} + +################################# +# PowerVS SAP System Parameters +################################# + +variable "powervs_sap_network_cidr" { + description = "Additional private subnet for SAP communication which will be created. CIDR for SAP network. E.g., '10.53.0.0/24'" + type = string + default = "10.53.0.0/24" +} + +variable "powervs_default_sap_images" { + description = "Default SUSE and Red Hat Linux images to use for SAP HANA and SAP NetWeaver PowerVS instances." + type = object({ + sles_hana_image = string + sles_nw_image = string + rhel_hana_image = string + rhel_nw_image = string + }) + default = { + "sles_hana_image" : "SLES15-SP4-SAP", + "rhel_hana_image" : "RHEL8-SP6-SAP", + "sles_nw_image" : "SLES15-SP4-SAP-NETWEAVER", + "rhel_nw_image" : "RHEL8-SP6-SAP-NETWEAVER" + } +} + +variable "powervs_sharefs_instance" { + description = "Share fs instance. This parameter is effective if 'powervs_create_separate_sharefs_instance' is set to true. size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." + type = object({ + name = string + processors = string + memory = string + proc_type = string + storage_config = list(object({ + name = string + size = string + count = string + tier = string + mount = string + })) + }) + default = { + "name" : "share", + "processors" : "0.5", + "memory" : "2", + "proc_type" : "shared", + "storage_config" : [{ + "name" : "sapmnt", + "size" : "300", + "count" : "1", + "tier" : "tier3", + "mount" : "/sapmnt" + }, + { + "name" : "trans", + "size" : "50", + "count" : "1", + "tier" : "tier3", + "mount" : "/usr/trans" + }] + } +} + +variable "powervs_hana_instance" { + description = "SAP HANA hostname (non FQDN) will get the form of -. SAP HANA profile to use. Must be one of the supported profiles. See [here](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-power-vs). File system sizes are automatically calculated. Override automatic calculation by setting values in optional 'pi_hana_instance_custom_storage_config' parameter. 'additional_storage_config' additional file systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." + type = object({ + name = string + sap_profile_id = string + additional_storage_config = list(object({ + name = string + size = string + count = string + tier = string + mount = string + })) + }) + default = { + name = "hana" + sap_profile_id = "ush1-4x256" + additional_storage_config = [{ + "name" : "usrsap", + "size" : "50", + "count" : "1", + "tier" : "tier3", + "mount" : "/usr/sap" + }] + } +} + +variable "powervs_hana_instance_custom_storage_config" { + description = "Custom File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." + type = list(object({ + name = string + size = string + count = string + tier = string + mount = string + })) + default = [{ + "name" : "", + "size" : "", + "count" : "", + "tier" : "", + "mount" : "" + }] +} + +variable "powervs_netweaver_instance" { + description = "'instance_count' is number of SAP NetWeaver instances that should be created. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. " + type = object({ + instance_count = number + name = string + processors = string + memory = string + proc_type = string + storage_config = list(object({ + name = string + size = string + count = string + tier = string + mount = string + })) + }) + default = { + instance_count = 1 + name = "nw" + processors = "3" + memory = "32" + proc_type = "shared" + storage_config = [{ + "name" : "usrsap", + "size" : "50", + "count" : "1", + "tier" : "tier3", + "mount" : "/usr/sap" + }] + } +} + +variable "sap_domain" { + description = "SAP domain to be set for entire landscape." + type = string + default = "sap.com" +} diff --git a/solutions/e2e/version.tf b/solutions/e2e/version.tf new file mode 100644 index 00000000..f91a2cb5 --- /dev/null +++ b/solutions/e2e/version.tf @@ -0,0 +1,13 @@ +terraform { + required_version = ">= 1.3, < 1.6" + required_providers { + ibm = { + source = "IBM-Cloud/ibm" + version = ">=1.58.1" + } + time = { + source = "hashicorp/time" + version = ">= 0.9.1" + } + } +} diff --git a/solutions/ibm-catalog/sap-ready-to-go/README.md b/solutions/ibm-catalog/sap-ready-to-go/README.md index 2bed0c65..f5926171 100644 --- a/solutions/ibm-catalog/sap-ready-to-go/README.md +++ b/solutions/ibm-catalog/sap-ready-to-go/README.md @@ -1,24 +1,35 @@ -# Power Virtual Server for SAP HANA example to create SAP prepared PowerVS instances from IBM Cloud Catalog +# IBM Cloud Catalog - Power Virtual Server for SAP HANA : 'sap-ready-to-go' -The Power Virtual Server for SAP HANA example automates the following tasks: +The 'sap-ready-to-go' solution automates the following tasks: +- Creates a new private subnet for SAP communication for entire landscape and attaches it to cloud connections(in Non PER DC). - Creates and configures one PowerVS instance for SAP HANA that is based on best practices. - Creates and configures multiple PowerVS instances for SAP NetWeaver that are based on best practices. - Creates and configures one optional PowerVS instance that can be used for sharing SAP files between other system instances. - Connects all created PowerVS instances to a proxy server that is specified by IP address or hostname. - Optionally connects all created PowerVS instances to an NTP server and DNS forwarder that are specified by IP address or hostname. - Optionally configures a shared NFS directory on all created PowerVS instances. +- Post instance provisioning, ansible galaxy collection roles [ibm.power_linux_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/) are executed. +- Tested with RHEL8.4, RHEL 8.6, SLES15-SP4 and SLES15-SP6 images. ## Before you begin -Note: **This solution requires a schematics workspace id as an input.** -If you do not have a PowerVS infrastructure that is the full stack solution for a PowerVS Workspace that includes the full stack solution for Secure Landing Zone, create it first. +- **This solution requires a schematics workspace id as an input.** +- If you do not have a [Power Virtual Server with VPC landing zone deployment](https://cloud.ibm.com/catalog/architecture/deploy-arch-ibm-pvs-inf-2dd486c7-b317-4aaa-907b-42671485ad96-global?catalog_query=aHR0cHM6Ly9jbG91ZC5pYm0uY29tL2NhdGFsb2c%2Fc2VhcmNoPXBvd2VyI3NlYXJjaF9yZXN1bHRz) that is the full stack solution for a PowerVS Workspace with Secure Landing Zone, create it first. + +## Notes +- **Does not install any SAP softwares or solutions.** +- Filesystem sizes for HANA data and HANA log are **calculated automatically** based on the **memory size**. Custom storage configuration is also supported. +- If **sharefs instance is enabled**, then all filesystems provisioned for sharefs instance will be **NFS exported and mounted** on all Netweaver Instances. +- **Do not specify** a filesystem `/sapmnt` explicitly for Netweaver instance as, it is created internally when sharefs instance is not enabled. + + +| Variation | Available on IBM Catalog | Requires Schematics Workspace ID | Creates PowerVS with VPC landing zone | Creates PowerVS HANA Instance | Creates PowerVS NW Instances | Performs PowerVS OS Config | Performs PowerVS SAP Tuning | Install SAP software | +|:---------------------------------------------------------------------------:|:------------------------:|:--------------------------------:|:-------------------------------------:|:-----------------------------:|:----------------------------:|:--------------------------:|:---------------------------:|:--------------------:| +| [ IBM Catalog sap-ready-to-go ](./) | :heavy_check_mark: | :heavy_check_mark: | N/A | 1 | 0 to N | :heavy_check_mark: | :heavy_check_mark: | N/A | -| Variation | Available on IBM Catalog | Requires Schematics Workspace ID | Creates PowerVS HANA Instance | Creates PowerVS NW Instances | Performs PowerVS OS Config | Performs PowerVS SAP Tuning | Install SAP software | -| ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | -| [sap-ready-to-go](./) | :heavy_check_mark: | :heavy_check_mark: | 1 | 0 to N | :heavy_check_mark: | :heavy_check_mark: | N/A | ## Architecture Diagram -![sap-ready-to-go](../../../reference-architectures/sap-ready-to-go/deploy-arch-ibm-pvs-sap-ready-to-go.svg) +![sap-ready-to-go](https://github.com/terraform-ibm-modules/terraform-ibm-powervs-sap/blob/main/reference-architectures/sap-ready-to-go/deploy-arch-ibm-pvs-sap-ready-to-go.svg) @@ -27,43 +38,43 @@ If you do not have a PowerVS infrastructure that is the full stack solution for | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.3, < 1.6 | -| [ibm](#requirement\_ibm) | =1.56.1 | +| [ibm](#requirement\_ibm) | =1.58.1 | ### Modules | Name | Source | Version | |------|--------|---------| -| [sap\_system](#module\_sap\_system) | ../../sap-ready-to-go/module | n/a | +| [sap\_system](#module\_sap\_system) | ../../../modules/pi-sap-system-type1 | n/a | ### Resources | Name | Type | |------|------| -| [ibm_schematics_output.schematics_output](https://registry.terraform.io/providers/IBM-Cloud/ibm/1.56.1/docs/data-sources/schematics_output) | data source | -| [ibm_schematics_workspace.schematics_workspace](https://registry.terraform.io/providers/IBM-Cloud/ibm/1.56.1/docs/data-sources/schematics_workspace) | data source | +| [ibm_schematics_output.schematics_output](https://registry.terraform.io/providers/IBM-Cloud/ibm/1.58.1/docs/data-sources/schematics_output) | data source | +| [ibm_schematics_workspace.schematics_workspace](https://registry.terraform.io/providers/IBM-Cloud/ibm/1.58.1/docs/data-sources/schematics_workspace) | data source | ### Inputs | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [ibmcloud\_api\_key](#input\_ibmcloud\_api\_key) | The IBM Cloud platform API key needed to deploy IAM enabled resources. | `string` | n/a | yes | -| [os\_image\_distro](#input\_os\_image\_distro) | Image distribution to use for all instances(Shared, HANA, Netweaver). OS release versions may be specified in 'var.powervs\_default\_images' optional parameters below. | `string` | `"RHEL"` | no | -| [powervs\_create\_separate\_fs\_share](#input\_powervs\_create\_separate\_fs\_share) | Deploy separate IBM PowerVS instance(0.5 cpus, 2 GB memory size, shared processor on s922.) as central file system share. All filesystems defined in 'powervs\_share\_storage\_config' optional variable will be NFS exported and mounted on Netweaver PowerVS instances. | `bool` | `false` | no | -| [powervs\_default\_images](#input\_powervs\_default\_images) | Default SuSE and Red Hat Linux images to use for SAP HANA and SAP NetWeaver PowerVS instances. |
object({
sles_hana_image = string
sles_nw_image = string
rhel_hana_image = string
rhel_nw_image = string
})
|
{
"rhel_hana_image": "RHEL8-SP6-SAP",
"rhel_nw_image": "RHEL8-SP6-SAP-NETWEAVER",
"sles_hana_image": "SLES15-SP4-SAP",
"sles_nw_image": "SLES15-SP4-SAP-NETWEAVER"
}
| no | -| [powervs\_hana\_additional\_storage\_config](#input\_powervs\_hana\_additional\_storage\_config) | Additional File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
|
[
{
"count": "1",
"mount": "/usr/sap",
"name": "usrsap",
"size": "50",
"tier": "tier3"
}
]
| no | -| [powervs\_hana\_custom\_storage\_config](#input\_powervs\_hana\_custom\_storage\_config) | Custom File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
|
[
{
"count": "",
"mount": "",
"name": "",
"size": "",
"tier": ""
}
]
| no | +| [ibmcloud\_api\_key](#input\_ibmcloud\_api\_key) | IBM Cloud platform API key needed to deploy IAM enabled resources. | `string` | n/a | yes | +| [os\_image\_distro](#input\_os\_image\_distro) | Image distribution to use for all instances(Shared, HANA, Netweaver). OS release versions may be specified in 'var.powervs\_default\_images' optional parameters below. | `string` | n/a | yes | +| [powervs\_create\_separate\_sharefs\_instance](#input\_powervs\_create\_separate\_sharefs\_instance) | Deploy separate IBM PowerVS instance as central file system share. All filesystems defined in 'powervs\_sharefs\_instance\_storage\_config' variable will be NFS exported and mounted on Netweaver PowerVS instances if enabled. Optional parameter 'powervs\_share\_fs\_instance' can be configured if enabled. | `bool` | n/a | yes | +| [powervs\_default\_sap\_images](#input\_powervs\_default\_sap\_images) | Default SUSE and Red Hat Linux images to use for SAP HANA and SAP NetWeaver PowerVS instances. |
object({
sles_hana_image = string
sles_nw_image = string
rhel_hana_image = string
rhel_nw_image = string
})
|
{
"rhel_hana_image": "RHEL8-SP6-SAP",
"rhel_nw_image": "RHEL8-SP6-SAP-NETWEAVER",
"sles_hana_image": "SLES15-SP4-SAP",
"sles_nw_image": "SLES15-SP4-SAP-NETWEAVER"
}
| no | +| [powervs\_hana\_instance\_additional\_storage\_config](#input\_powervs\_hana\_instance\_additional\_storage\_config) | Additional File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
|
[
{
"count": "1",
"mount": "/usr/sap",
"name": "usrsap",
"size": "50",
"tier": "tier3"
}
]
| no | +| [powervs\_hana\_instance\_custom\_storage\_config](#input\_powervs\_hana\_instance\_custom\_storage\_config) | Custom file systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
|
[
{
"count": "",
"mount": "",
"name": "",
"size": "",
"tier": ""
}
]
| no | | [powervs\_hana\_instance\_name](#input\_powervs\_hana\_instance\_name) | SAP HANA hostname (non FQDN). Will get the form of -. Max length of final hostname must be <= 13 characters. | `string` | `"hana"` | no | -| [powervs\_hana\_sap\_profile\_id](#input\_powervs\_hana\_sap\_profile\_id) | SAP HANA profile to use. Must be one of the supported profiles. See [here](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-power-vs). File system sizes are automatically calculated. Override automatic calculation by setting values in optional sap\_hana\_custom\_storage\_config parameter. | `string` | `"ush1-4x256"` | no | +| [powervs\_hana\_instance\_sap\_profile\_id](#input\_powervs\_hana\_instance\_sap\_profile\_id) | SAP HANA profile to use. Must be one of the supported profiles. See [here](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-power-vs). File system sizes are automatically calculated. Override automatic calculation by setting values in optional parameter 'powervs\_hana\_instance\_custom\_storage\_config'. | `string` | `"ush1-4x256"` | no | | [powervs\_netweaver\_cpu\_number](#input\_powervs\_netweaver\_cpu\_number) | Number of CPUs for each SAP NetWeaver instance. | `string` | `"3"` | no | | [powervs\_netweaver\_instance\_count](#input\_powervs\_netweaver\_instance\_count) | Number of SAP NetWeaver instances that should be created. | `number` | `1` | no | | [powervs\_netweaver\_instance\_name](#input\_powervs\_netweaver\_instance\_name) | SAP Netweaver hostname (non FQDN). Will get the form of --. Max length of final hostname must be <= 13 characters. | `string` | `"nw"` | no | +| [powervs\_netweaver\_instance\_storage\_config](#input\_powervs\_netweaver\_instance\_storage\_config) | File systems to be created and attached to PowerVS instance for SAP NetWeaver. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. Please do not specify volume for 'sapmnt' as this will be created internally if 'powervs\_create\_separate\_sharefs\_instance' is false, else 'sapmnt' will mounted from sharefs instance. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
|
[
{
"count": "1",
"mount": "/usr/sap",
"name": "usrsap",
"size": "50",
"tier": "tier3"
}
]
| no | | [powervs\_netweaver\_memory\_size](#input\_powervs\_netweaver\_memory\_size) | Memory size for each SAP NetWeaver instance. | `string` | `"32"` | no | -| [powervs\_netweaver\_storage\_config](#input\_powervs\_netweaver\_storage\_config) | File systems to be created and attached to PowerVS instance for SAP NetWeaver. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
|
[
{
"count": "1",
"mount": "/usr/sap",
"name": "usrsap",
"size": "50",
"tier": "tier3"
}
]
| no | -| [powervs\_sap\_network\_cidr](#input\_powervs\_sap\_network\_cidr) | Network range for separate SAP network. E.g., '10.53.1.0/24' | `string` | `"10.53.1.0/24"` | no | -| [powervs\_share\_storage\_config](#input\_powervs\_share\_storage\_config) | File systems to be created and attached to PowerVS instance for shared storage file systems. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
|
[
{
"count": "1",
"mount": "/sapmnt",
"name": "sapmnt",
"size": "300",
"tier": "tier3"
},
{
"count": "1",
"mount": "/usr/trans",
"name": "trans",
"size": "50",
"tier": "tier3"
}
]
| no | +| [powervs\_sap\_network\_cidr](#input\_powervs\_sap\_network\_cidr) | Network range for separate SAP network. E.g., '10.53.0.0/24' | `string` | `"10.53.0.0/24"` | no | +| [powervs\_sharefs\_instance](#input\_powervs\_sharefs\_instance) | Share fs instance. This parameter is effective if 'powervs\_create\_separate\_sharefs\_instance' is set to true. size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
object({
name = string
processors = string
memory = string
proc_type = string
storage_config = list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
})
|
{
"memory": "2",
"name": "share",
"proc_type": "shared",
"processors": "0.5",
"storage_config": [
{
"count": "1",
"mount": "/sapmnt",
"name": "sapmnt",
"size": "300",
"tier": "tier3"
},
{
"count": "1",
"mount": "/usr/trans",
"name": "trans",
"size": "50",
"tier": "tier3"
}
]
}
| no | | [powervs\_zone](#input\_powervs\_zone) | IBM Cloud data center location where IBM PowerVS Workspace exists. | `string` | n/a | yes | | [prefix](#input\_prefix) | Unique prefix for resources to be created (e.g., SAP system name). Max length must be less than or equal to 6. | `string` | n/a | yes | -| [prerequisite\_workspace\_id](#input\_prerequisite\_workspace\_id) | IBM Cloud Schematics workspace ID of an existing Power infrastructure for regulated industries deployment. If you do not yet have an existing deployment, click [here](https://cloud.ibm.com/catalog/) and search for 'Power Virtual Server with VPC landing zone' to create one. | `string` | n/a | yes | +| [prerequisite\_workspace\_id](#input\_prerequisite\_workspace\_id) | IBM Cloud Schematics workspace ID of an existing 'Power Virtual Server with VPC landing zone' catalog solution. If you do not yet have an existing deployment, click [here](https://cloud.ibm.com/catalog/architecture/deploy-arch-ibm-pvs-inf-2dd486c7-b317-4aaa-907b-42671485ad96-global?) to create one. | `string` | n/a | yes | | [sap\_domain](#input\_sap\_domain) | SAP domain to be set for entire landscape. | `string` | `"sap.com"` | no | | [ssh\_private\_key](#input\_ssh\_private\_key) | Private SSH key (RSA format) used to login to IBM PowerVS instances. Should match to uploaded public SSH key referenced by 'ssh\_public\_key' which was created previously. Entered data must be in [heredoc strings format](https://www.terraform.io/language/expressions/strings#heredoc-strings). The key is not uploaded or stored. For more information about SSH keys, see [SSH keys](https://cloud.ibm.com/docs/vpc?topic=vpc-ssh-keys). | `string` | n/a | yes | @@ -72,11 +83,11 @@ If you do not have a PowerVS infrastructure that is the full stack solution for | Name | Description | |------|-------------| | [access\_host\_or\_ip](#output\_access\_host\_or\_ip) | Public IP of Provided Bastion/JumpServer Host | -| [infrastructure\_data](#output\_infrastructure\_data) | Data from PowerVS infrastructure layer | +| [infrastructure\_data](#output\_infrastructure\_data) | PowerVS infrastructure details. | | [powervs\_hana\_instance\_ips](#output\_powervs\_hana\_instance\_ips) | All private IPS of HANA instance | | [powervs\_hana\_instance\_management\_ip](#output\_powervs\_hana\_instance\_management\_ip) | Management IP of HANA Instance | | [powervs\_lpars\_data](#output\_powervs\_lpars\_data) | All private IPS of PowerVS instances and Jump IP to access the host. | | [powervs\_netweaver\_instance\_ips](#output\_powervs\_netweaver\_instance\_ips) | All private IPS of NetWeaver instances | | [powervs\_netweaver\_instance\_management\_ips](#output\_powervs\_netweaver\_instance\_management\_ips) | Management IPS of NetWeaver instances | -| [powervs\_share\_fs\_ips](#output\_powervs\_share\_fs\_ips) | Private IPs of the Share FS instance. | +| [powervs\_sharefs\_instance\_ips](#output\_powervs\_sharefs\_instance\_ips) | Private IPs of the Share FS instance. | diff --git a/solutions/ibm-catalog/sap-ready-to-go/locals_schematics_data.tf b/solutions/ibm-catalog/sap-ready-to-go/locals_schematics_data.tf new file mode 100644 index 00000000..1e91aa43 --- /dev/null +++ b/solutions/ibm-catalog/sap-ready-to-go/locals_schematics_data.tf @@ -0,0 +1,53 @@ +############################################################ +# Get Values from PowerVS with VPC Landing Zone Workspace +############################################################ + +locals { + location = regex("^[a-z/-]+", var.prerequisite_workspace_id) +} + +data "ibm_schematics_workspace" "schematics_workspace" { + workspace_id = var.prerequisite_workspace_id + location = local.location +} + +data "ibm_schematics_output" "schematics_output" { + workspace_id = var.prerequisite_workspace_id + location = local.location + template_id = data.ibm_schematics_workspace.schematics_workspace.runtime_data[0].id +} + +locals { + powervs_infrastructure = jsondecode(data.ibm_schematics_output.schematics_output.output_json) + + powervs_workspace_guid = local.powervs_infrastructure[0].powervs_workspace_guid.value + powervs_sshkey_name = local.powervs_infrastructure[0].powervs_ssh_public_key.value.name + powervs_images = local.powervs_infrastructure[0].powervs_images.value + cloud_connection_count = local.powervs_infrastructure[0].cloud_connection_count.value + powervs_networks = [local.powervs_infrastructure[0].powervs_management_subnet.value, local.powervs_infrastructure[0].powervs_backup_subnet.value] + access_host_or_ip = local.powervs_infrastructure[0].access_host_or_ip.value + proxy_host_or_ip_port = local.powervs_infrastructure[0].proxy_host_or_ip_port.value + dns_host_or_ip = local.powervs_infrastructure[0].dns_host_or_ip.value + ntp_host_or_ip = local.powervs_infrastructure[0].ntp_host_or_ip.value + nfs_host_or_ip_path = local.powervs_infrastructure[0].nfs_host_or_ip_path.value +} + +locals { + powervs_sharefs_os_image = var.os_image_distro == "SLES" ? var.powervs_default_sap_images.sles_nw_image : var.powervs_default_sap_images.rhel_nw_image + powervs_hana_os_image = var.os_image_distro == "SLES" ? var.powervs_default_sap_images.sles_hana_image : var.powervs_default_sap_images.rhel_hana_image + powervs_netweaver_os_image = var.os_image_distro == "SLES" ? var.powervs_default_sap_images.sles_nw_image : var.powervs_default_sap_images.rhel_nw_image + + powervs_instance_init_linux = { + enable = true + bastion_host_ip = local.access_host_or_ip + ssh_private_key = var.ssh_private_key + proxy_host_or_ip_port = local.proxy_host_or_ip_port + no_proxy_hosts = "161.0.0.0/8,10.0.0.0/8" + } + + powervs_network_services_config = { + nfs = { enable = local.nfs_host_or_ip_path != "" ? true : false, nfs_server_path = local.nfs_host_or_ip_path, nfs_client_path = "/nfs" } + dns = { enable = local.dns_host_or_ip != "" ? true : false, dns_server_ip = local.dns_host_or_ip } + ntp = { enable = local.ntp_host_or_ip != "" ? true : false, ntp_server_ip = local.ntp_host_or_ip } + } +} diff --git a/solutions/ibm-catalog/sap-ready-to-go/main.tf b/solutions/ibm-catalog/sap-ready-to-go/main.tf index 3bddc21c..067ff801 100644 --- a/solutions/ibm-catalog/sap-ready-to-go/main.tf +++ b/solutions/ibm-catalog/sap-ready-to-go/main.tf @@ -1,94 +1,55 @@ -locals { - ibm_powervs_zone_region_map = { - "lon04" = "lon" - "lon06" = "lon" - "eu-de-1" = "eu-de" - "eu-de-2" = "eu-de" - "tor01" = "tor" - "mon01" = "mon" - "osa21" = "osa" - "tok04" = "tok" - "syd04" = "syd" - "syd05" = "syd" - "sao01" = "sao" - "us-south" = "us-south" - "dal10" = "us-south" - "dal12" = "us-south" - "us-east" = "us-east" - } -} - -provider "ibm" { - region = lookup(local.ibm_powervs_zone_region_map, var.powervs_zone, null) - zone = var.powervs_zone - ibmcloud_api_key = var.ibmcloud_api_key != null ? var.ibmcloud_api_key : null -} - ##################################################### -# Get Values from Infrastructure Workspace +# Deploy SAP system +# 1 HANA instance +# 0:N Netweaver Instance +# 1 Optional Sharefs instance ##################################################### locals { - location = regex("^[a-z/-]+", var.prerequisite_workspace_id) -} - -data "ibm_schematics_workspace" "schematics_workspace" { - workspace_id = var.prerequisite_workspace_id - location = local.location -} - -data "ibm_schematics_output" "schematics_output" { - workspace_id = var.prerequisite_workspace_id - location = local.location - template_id = data.ibm_schematics_workspace.schematics_workspace.runtime_data[0].id -} + powervs_sharefs_instance = { + enable = var.powervs_create_separate_sharefs_instance + name = var.powervs_sharefs_instance.name + image_id = lookup(local.powervs_images, local.powervs_sharefs_os_image, null) + processors = var.powervs_sharefs_instance.processors + memory = var.powervs_sharefs_instance.memory + proc_type = var.powervs_sharefs_instance.proc_type + storage_config = var.powervs_sharefs_instance.storage_config + } -locals { - powerinfra_output = jsondecode(data.ibm_schematics_output.schematics_output.output_json) + powervs_hana_instance = { + name = var.powervs_hana_instance_name + image_id = lookup(local.powervs_images, local.powervs_hana_os_image, null) + sap_profile_id = var.powervs_hana_instance_sap_profile_id + additional_storage_config = var.powervs_hana_instance_additional_storage_config + } - powervs_resource_group_name = local.powerinfra_output[0].powervs_resource_group_name.value - powervs_workspace_name = local.powerinfra_output[0].powervs_workspace_name.value - powervs_sshkey_name = local.powerinfra_output[0].powervs_sshkey_name.value - cloud_connection_count = local.powerinfra_output[0].cloud_connection_count.value - additional_networks = [local.powerinfra_output[0].powervs_management_network_name.value, local.powerinfra_output[0].powervs_backup_network_name.value] - access_host_or_ip = local.powerinfra_output[0].access_host_or_ip.value - proxy_host_or_ip_port = local.powerinfra_output[0].proxy_host_or_ip_port.value - dns_host_or_ip = local.powerinfra_output[0].dns_host_or_ip.value - ntp_host_or_ip = local.powerinfra_output[0].ntp_host_or_ip.value - nfs_host_or_ip_path = local.powerinfra_output[0].nfs_host_or_ip_path.value + powervs_netweaver_instance = { + instance_count = var.powervs_netweaver_instance_count + name = var.powervs_netweaver_instance_name + image_id = lookup(local.powervs_images, local.powervs_netweaver_os_image, null) + processors = var.powervs_netweaver_cpu_number + memory = var.powervs_netweaver_memory_size + proc_type = "shared" + storage_config = var.powervs_netweaver_instance_storage_config + } } -##################################################### -# Deploy SAP system ( 1 HANA instance and 0:N Netweaver Instance) -##################################################### module "sap_system" { - source = "../../sap-ready-to-go/module" - powervs_zone = var.powervs_zone - powervs_resource_group_name = local.powervs_resource_group_name - powervs_workspace_name = local.powervs_workspace_name - powervs_sshkey_name = local.powervs_sshkey_name + source = "../../../modules/pi-sap-system-type1" + + pi_zone = var.powervs_zone prefix = var.prefix - ssh_private_key = var.ssh_private_key - powervs_sap_network_cidr = var.powervs_sap_network_cidr + pi_workspace_guid = local.powervs_workspace_guid + pi_ssh_public_key_name = local.powervs_sshkey_name + pi_networks = local.powervs_networks + pi_sap_network_cidr = var.powervs_sap_network_cidr cloud_connection_count = local.cloud_connection_count - additional_networks = local.additional_networks - os_image_distro = var.os_image_distro - powervs_create_separate_fs_share = var.powervs_create_separate_fs_share - powervs_hana_instance_name = var.powervs_hana_instance_name - powervs_hana_sap_profile_id = var.powervs_hana_sap_profile_id - powervs_netweaver_instance_count = var.powervs_netweaver_instance_count - powervs_netweaver_instance_name = var.powervs_netweaver_instance_name - powervs_netweaver_cpu_number = var.powervs_netweaver_cpu_number - powervs_netweaver_memory_size = var.powervs_netweaver_memory_size - access_host_or_ip = local.access_host_or_ip - proxy_host_or_ip_port = local.proxy_host_or_ip_port - dns_host_or_ip = local.dns_host_or_ip - ntp_host_or_ip = local.ntp_host_or_ip - nfs_host_or_ip_path = local.nfs_host_or_ip_path + pi_sharefs_instance = local.powervs_sharefs_instance + pi_hana_instance = local.powervs_hana_instance + pi_hana_instance_custom_storage_config = var.powervs_hana_instance_custom_storage_config + pi_netweaver_instance = local.powervs_netweaver_instance + pi_instance_init_linux = local.powervs_instance_init_linux + sap_network_services_config = local.powervs_network_services_config sap_domain = var.sap_domain - powervs_share_storage_config = var.powervs_share_storage_config - powervs_hana_custom_storage_config = var.powervs_hana_custom_storage_config - powervs_hana_additional_storage_config = var.powervs_hana_additional_storage_config - powervs_netweaver_storage_config = var.powervs_netweaver_storage_config - powervs_default_images = var.powervs_default_images + } diff --git a/solutions/ibm-catalog/sap-ready-to-go/outputs.tf b/solutions/ibm-catalog/sap-ready-to-go/outputs.tf index 360668d3..29a43d24 100644 --- a/solutions/ibm-catalog/sap-ready-to-go/outputs.tf +++ b/solutions/ibm-catalog/sap-ready-to-go/outputs.tf @@ -1,39 +1,39 @@ output "infrastructure_data" { - description = "Data from PowerVS infrastructure layer" - value = jsondecode(data.ibm_schematics_output.schematics_output.output_json) + description = "PowerVS infrastructure details." + value = { for k, v in local.powervs_infrastructure[0] : k => v.value } } output "access_host_or_ip" { description = "Public IP of Provided Bastion/JumpServer Host" - value = module.sap_system.access_host_or_ip + value = local.access_host_or_ip } output "powervs_hana_instance_ips" { description = "All private IPS of HANA instance" - value = module.sap_system.powervs_hana_instance_ips + value = module.sap_system.pi_hana_instance_ips } output "powervs_hana_instance_management_ip" { description = "Management IP of HANA Instance" - value = module.sap_system.powervs_hana_instance_management_ip + value = module.sap_system.pi_hana_instance_management_ip } output "powervs_netweaver_instance_ips" { description = "All private IPS of NetWeaver instances" - value = module.sap_system.powervs_netweaver_instance_ips + value = module.sap_system.pi_netweaver_instance_ips } output "powervs_netweaver_instance_management_ips" { description = "Management IPS of NetWeaver instances" - value = module.sap_system.powervs_netweaver_instance_management_ips + value = module.sap_system.pi_netweaver_instance_management_ips } -output "powervs_share_fs_ips" { +output "powervs_sharefs_instance_ips" { description = "Private IPs of the Share FS instance." - value = module.sap_system.powervs_share_fs_ips + value = module.sap_system.pi_sharefs_instance_ips } output "powervs_lpars_data" { description = "All private IPS of PowerVS instances and Jump IP to access the host." - value = module.sap_system.powervs_lpars_data + value = module.sap_system.pi_lpars_data } diff --git a/solutions/ibm-catalog/sap-ready-to-go/provider.tf b/solutions/ibm-catalog/sap-ready-to-go/provider.tf new file mode 100644 index 00000000..ffbf0d10 --- /dev/null +++ b/solutions/ibm-catalog/sap-ready-to-go/provider.tf @@ -0,0 +1,25 @@ +locals { + ibm_powervs_zone_region_map = { + "lon04" = "lon" + "lon06" = "lon" + "eu-de-1" = "eu-de" + "eu-de-2" = "eu-de" + "tor01" = "tor" + "mon01" = "mon" + "osa21" = "osa" + "tok04" = "tok" + "syd04" = "syd" + "syd05" = "syd" + "sao01" = "sao" + "us-south" = "us-south" + "dal10" = "us-south" + "dal12" = "us-south" + "us-east" = "us-east" + } +} + +provider "ibm" { + region = lookup(local.ibm_powervs_zone_region_map, var.powervs_zone, null) + zone = var.powervs_zone + ibmcloud_api_key = var.ibmcloud_api_key != null ? var.ibmcloud_api_key : null +} diff --git a/solutions/ibm-catalog/sap-ready-to-go/variables.tf b/solutions/ibm-catalog/sap-ready-to-go/variables.tf index eacbfead..235a56e8 100644 --- a/solutions/ibm-catalog/sap-ready-to-go/variables.tf +++ b/solutions/ibm-catalog/sap-ready-to-go/variables.tf @@ -1,11 +1,11 @@ variable "ibmcloud_api_key" { - description = "The IBM Cloud platform API key needed to deploy IAM enabled resources." + description = "IBM Cloud platform API key needed to deploy IAM enabled resources." type = string sensitive = true } variable "prerequisite_workspace_id" { - description = "IBM Cloud Schematics workspace ID of an existing Power infrastructure for regulated industries deployment. If you do not yet have an existing deployment, click [here](https://cloud.ibm.com/catalog/) and search for 'Power Virtual Server with VPC landing zone' to create one." + description = "IBM Cloud Schematics workspace ID of an existing 'Power Virtual Server with VPC landing zone' catalog solution. If you do not yet have an existing deployment, click [here](https://cloud.ibm.com/catalog/architecture/deploy-arch-ibm-pvs-inf-2dd486c7-b317-4aaa-907b-42671485ad96-global?) to create one." type = string } @@ -24,15 +24,14 @@ variable "prefix" { } variable "powervs_sap_network_cidr" { - description = "Network range for separate SAP network. E.g., '10.53.1.0/24'" + description = "Network range for separate SAP network. E.g., '10.53.0.0/24'" type = string - default = "10.53.1.0/24" + default = "10.53.0.0/24" } variable "os_image_distro" { description = "Image distribution to use for all instances(Shared, HANA, Netweaver). OS release versions may be specified in 'var.powervs_default_images' optional parameters below." type = string - default = "RHEL" validation { condition = (upper(var.os_image_distro) == "RHEL" || upper(var.os_image_distro) == "SLES") @@ -44,10 +43,9 @@ variable "os_image_distro" { # PowerVS Shared FS Instance parameters ##################################################### -variable "powervs_create_separate_fs_share" { - description = "Deploy separate IBM PowerVS instance(0.5 cpus, 2 GB memory size, shared processor on s922.) as central file system share. All filesystems defined in 'powervs_share_storage_config' optional variable will be NFS exported and mounted on Netweaver PowerVS instances." +variable "powervs_create_separate_sharefs_instance" { + description = "Deploy separate IBM PowerVS instance as central file system share. All filesystems defined in 'powervs_sharefs_instance_storage_config' variable will be NFS exported and mounted on Netweaver PowerVS instances if enabled. Optional parameter 'powervs_share_fs_instance' can be configured if enabled." type = bool - default = false } ##################################################### @@ -60,8 +58,8 @@ variable "powervs_hana_instance_name" { default = "hana" } -variable "powervs_hana_sap_profile_id" { - description = "SAP HANA profile to use. Must be one of the supported profiles. See [here](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-power-vs). File system sizes are automatically calculated. Override automatic calculation by setting values in optional sap_hana_custom_storage_config parameter." +variable "powervs_hana_instance_sap_profile_id" { + description = "SAP HANA profile to use. Must be one of the supported profiles. See [here](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-power-vs). File system sizes are automatically calculated. Override automatic calculation by setting values in optional parameter 'powervs_hana_instance_custom_storage_config'." type = string default = "ush1-4x256" } @@ -114,34 +112,8 @@ variable "sap_domain" { # Optional Parameters ##################################################### -variable "powervs_share_storage_config" { - description = "File systems to be created and attached to PowerVS instance for shared storage file systems. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." - type = list(object({ - name = string - size = string - count = string - tier = string - mount = string - })) - default = [{ - "name" : "sapmnt", - "size" : "300", - "count" : "1", - "tier" : "tier3", - "mount" : "/sapmnt" - }, - { - "name" : "trans", - "size" : "50", - "count" : "1", - "tier" : "tier3", - "mount" : "/usr/trans" - }] -} - - -variable "powervs_hana_custom_storage_config" { - description = "Custom File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." +variable "powervs_hana_instance_custom_storage_config" { + description = "Custom file systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." type = list(object({ name = string size = string @@ -158,7 +130,7 @@ variable "powervs_hana_custom_storage_config" { }] } -variable "powervs_hana_additional_storage_config" { +variable "powervs_hana_instance_additional_storage_config" { description = "Additional File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." type = list(object({ name = string @@ -177,8 +149,8 @@ variable "powervs_hana_additional_storage_config" { }] } -variable "powervs_netweaver_storage_config" { - description = "File systems to be created and attached to PowerVS instance for SAP NetWeaver. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." +variable "powervs_netweaver_instance_storage_config" { + description = "File systems to be created and attached to PowerVS instance for SAP NetWeaver. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. Please do not specify volume for 'sapmnt' as this will be created internally if 'powervs_create_separate_sharefs_instance' is false, else 'sapmnt' will mounted from sharefs instance." type = list(object({ name = string size = string @@ -197,8 +169,45 @@ variable "powervs_netweaver_storage_config" { ] } -variable "powervs_default_images" { - description = "Default SuSE and Red Hat Linux images to use for SAP HANA and SAP NetWeaver PowerVS instances." +variable "powervs_sharefs_instance" { + description = "Share fs instance. This parameter is effective if 'powervs_create_separate_sharefs_instance' is set to true. size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." + type = object({ + name = string + processors = string + memory = string + proc_type = string + storage_config = list(object({ + name = string + size = string + count = string + tier = string + mount = string + })) + }) + default = { + "name" : "share", + "processors" : "0.5", + "memory" : "2", + "proc_type" : "shared", + "storage_config" : [{ + "name" : "sapmnt", + "size" : "300", + "count" : "1", + "tier" : "tier3", + "mount" : "/sapmnt" + }, + { + "name" : "trans", + "size" : "50", + "count" : "1", + "tier" : "tier3", + "mount" : "/usr/trans" + }] + } +} + +variable "powervs_default_sap_images" { + description = "Default SUSE and Red Hat Linux images to use for SAP HANA and SAP NetWeaver PowerVS instances." type = object({ sles_hana_image = string sles_nw_image = string @@ -206,9 +215,9 @@ variable "powervs_default_images" { rhel_nw_image = string }) default = { - "sles_hana_image" : "SLES15-SP4-SAP" - "rhel_hana_image" : "RHEL8-SP6-SAP" - "sles_nw_image" : "SLES15-SP4-SAP-NETWEAVER" + "sles_hana_image" : "SLES15-SP4-SAP", + "rhel_hana_image" : "RHEL8-SP6-SAP", + "sles_nw_image" : "SLES15-SP4-SAP-NETWEAVER", "rhel_nw_image" : "RHEL8-SP6-SAP-NETWEAVER" } } diff --git a/solutions/ibm-catalog/sap-ready-to-go/version.tf b/solutions/ibm-catalog/sap-ready-to-go/version.tf index cc94f1f2..f1fd8b2e 100644 --- a/solutions/ibm-catalog/sap-ready-to-go/version.tf +++ b/solutions/ibm-catalog/sap-ready-to-go/version.tf @@ -7,7 +7,7 @@ terraform { required_providers { ibm = { source = "IBM-Cloud/ibm" - version = "=1.56.1" + version = "=1.58.1" } } } diff --git a/solutions/sap-ready-to-go/README.md b/solutions/sap-ready-to-go/README.md index 182e80d6..6d5f746a 100644 --- a/solutions/sap-ready-to-go/README.md +++ b/solutions/sap-ready-to-go/README.md @@ -1,21 +1,34 @@ -# Power Virtual Server for SAP HANA example to create SAP prepared PowerVS instances from IBM Cloud Catalog +# Power Virtual Server for SAP HANA : 'sap-ready-to-go' -The Power Virtual Server for SAP HANA example automates the following tasks: +The 'sap-ready-to-go' solution automates the following tasks: +- Creates a new private subnet for SAP communication for entire landscape and attaches it to cloud connections(in Non PER DC). - Creates and configures one PowerVS instance for SAP HANA that is based on best practices. - Creates and configures multiple PowerVS instances for SAP NetWeaver that are based on best practices. - Creates and configures one optional PowerVS instance that can be used for sharing SAP files between other system instances. - Connects all created PowerVS instances to a proxy server that is specified by IP address or hostname. - Optionally connects all created PowerVS instances to an NTP server and DNS forwarder that are specified by IP address or hostname. - Optionally configures a shared NFS directory on all created PowerVS instances. +- Post instance provisioning, ansible galaxy collection roles [ibm.power_linux_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/) are executed. +- Tested with RHEL8.4, RHEL 8.6, SLES15-SP4 and SLES15-SP6 images. -| Variation | Available on IBM Catalog | Requires Schematics Workspace ID | Creates PowerVS HANA Instance | Creates PowerVS NW Instances | Performs PowerVS OS Config | Performs PowerVS SAP Tuning | Install SAP software | -| ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | ------------- | -| [sap-ready-to-go](./) | N/A | N/A | 1 | 0 to N | :heavy_check_mark: | :heavy_check_mark: | N/A | +## Before you begin +- Power Virtual Server Workspace, images, management subnet, and ssh key must exist. This solutions does not create these resources. + +## Notes +- **Does not install any SAP softwares or solutions.** +- Filesystem sizes for HANA data and HANA log are **calculated automatically** based on the **memory size**. Custom storage configuration is also supported. +- If **sharefs instance is enabled**, then all filesystems provisioned for sharefs instance will be **NFS exported and mounted** on all Netweaver Instances. +- **Do not specify** a filesystem `/sapmnt` explicitly for Netweaver instance as, it is created internally when sharefs instance is not enabled. + + +| Variation | Available on IBM Catalog | Requires Schematics Workspace ID | Creates PowerVS with VPC landing zone | Creates PowerVS HANA Instance | Creates PowerVS NW Instances | Performs PowerVS OS Config | Performs PowerVS SAP Tuning | Install SAP software | +|:---------------------------------------------------------------------------:|:------------------------:|:--------------------------------:|:-------------------------------------:|:-----------------------------:|:----------------------------:|:--------------------------:|:---------------------------:|:--------------------:| +| [ sap-ready-to-go ](./) | N/A | N/A | N/A | 1 | 0 to N | :heavy_check_mark: | :heavy_check_mark: | N/A | ## Architecture Diagram -![sap-ready-to-go](../../reference-architectures/sap-ready-to-go/deploy-arch-ibm-pvs-sap-ready-to-go.svg) +![sap-ready-to-go](https://github.com/terraform-ibm-modules/terraform-ibm-powervs-sap/blob/main/reference-architectures/sap-ready-to-go/deploy-arch-ibm-pvs-sap-ready-to-go.svg) ### Requirements @@ -29,7 +42,7 @@ The Power Virtual Server for SAP HANA example automates the following tasks: | Name | Source | Version | |------|--------|---------| -| [sap\_system](#module\_sap\_system) | ./module | n/a | +| [sap\_system](#module\_sap\_system) | ../../modules/pi-sap-system-type1 | n/a | ### Resources @@ -39,35 +52,24 @@ No resources. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [access\_host\_or\_ip](#input\_access\_host\_or\_ip) | The public IP address or hostname for the access host. The address is used to reach the target or server\_host IP address and to configure the DNS, NTP, NFS, and Squid proxy services. Set to null or empty if not configuring OS. | `string` | n/a | yes | -| [additional\_networks](#input\_additional\_networks) | Existing list of subnets name to be attached to PowerVS instances. First network has to be a management network. | `list(string)` |
[
"mgmt_net",
"bkp_net"
]
| no | -| [cloud\_connection\_count](#input\_cloud\_connection\_count) | Existing number of Cloud connections to which new subnet must be attached. | `string` | `2` | no | -| [dns\_host\_or\_ip](#input\_dns\_host\_or\_ip) | Private IP address of DNS server, resolver or forwarder. Set empty if not configuring OS. | `string` | n/a | yes | +| [cloud\_connection\_count](#input\_cloud\_connection\_count) | Existing number of Cloud connections to which new subnet must be attached. Will be ignored in case of PER enabled DC. | `string` | `2` | no | | [ibmcloud\_api\_key](#input\_ibmcloud\_api\_key) | The IBM Cloud platform API key needed to deploy IAM enabled resources. | `string` | n/a | yes | -| [nfs\_host\_or\_ip\_path](#input\_nfs\_host\_or\_ip\_path) | Full path on NFS server (in form :, e.g., '10.20.10.4:/nfs'). Set to empty if not configuring OS. | `string` | n/a | yes | -| [ntp\_host\_or\_ip](#input\_ntp\_host\_or\_ip) | Private IP address of NTP time server or forwarder. Set empty if not configuring OS. | `string` | n/a | yes | -| [os\_image\_distro](#input\_os\_image\_distro) | Image distribution to use for all instances(Shared, HANA, Netweaver). OS release versions may be specified in 'var.powervs\_default\_images' optional parameters below. | `string` | `"RHEL"` | no | -| [powervs\_create\_separate\_fs\_share](#input\_powervs\_create\_separate\_fs\_share) | Deploy separate IBM PowerVS instance(0.5 cpus, 2 GB memory size, shared processor on s922.) as central file system share. All filesystems defined in 'powervs\_share\_storage\_config' optional variable will be NFS exported and mounted on Netweaver PowerVS instances. | `bool` | n/a | yes | -| [powervs\_default\_images](#input\_powervs\_default\_images) | Default SuSE and Red Hat Linux images to use for SAP HANA and SAP NetWeaver PowerVS instances. |
object({
sles_hana_image = string
sles_nw_image = string
rhel_hana_image = string
rhel_nw_image = string
})
|
{
"rhel_hana_image": "RHEL8-SP6-SAP",
"rhel_nw_image": "RHEL8-SP6-SAP-NETWEAVER",
"sles_hana_image": "SLES15-SP4-SAP",
"sles_nw_image": "SLES15-SP4-SAP-NETWEAVER"
}
| no | -| [powervs\_hana\_additional\_storage\_config](#input\_powervs\_hana\_additional\_storage\_config) | Additional File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
|
[
{
"count": "1",
"mount": "/usr/sap",
"name": "usrsap",
"size": "50",
"tier": "tier3"
}
]
| no | -| [powervs\_hana\_custom\_storage\_config](#input\_powervs\_hana\_custom\_storage\_config) | Custom File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
|
[
{
"count": "",
"mount": "",
"name": "",
"size": "",
"tier": ""
}
]
| no | -| [powervs\_hana\_instance\_name](#input\_powervs\_hana\_instance\_name) | SAP HANA hostname (non FQDN). Will get the form of -. Max length of final hostname must be <= 13 characters. | `string` | `"hana"` | no | -| [powervs\_hana\_sap\_profile\_id](#input\_powervs\_hana\_sap\_profile\_id) | SAP HANA profile to use. Must be one of the supported profiles. See [here](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-power-vs). File system sizes are automatically calculated. Override automatic calculation by setting values in optional sap\_hana\_custom\_storage\_config parameter. | `string` | `"ush1-4x256"` | no | -| [powervs\_netweaver\_cpu\_number](#input\_powervs\_netweaver\_cpu\_number) | Number of CPUs for each SAP NetWeaver instance. | `string` | `"3"` | no | -| [powervs\_netweaver\_instance\_count](#input\_powervs\_netweaver\_instance\_count) | Number of SAP NetWeaver instances that should be created. | `number` | `1` | no | -| [powervs\_netweaver\_instance\_name](#input\_powervs\_netweaver\_instance\_name) | SAP Netweaver hostname (non FQDN). Will get the form of --. Max length of final hostname must be <= 13 characters. | `string` | `"nw"` | no | -| [powervs\_netweaver\_memory\_size](#input\_powervs\_netweaver\_memory\_size) | Memory size for each SAP NetWeaver instance. | `string` | `"32"` | no | -| [powervs\_netweaver\_storage\_config](#input\_powervs\_netweaver\_storage\_config) | File systems to be created and attached to PowerVS instance for SAP NetWeaver. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
|
[
{
"count": "1",
"mount": "/usr/sap",
"name": "usrsap",
"size": "50",
"tier": "tier3"
}
]
| no | -| [powervs\_resource\_group\_name](#input\_powervs\_resource\_group\_name) | Existing IBM Cloud resource group name. | `string` | n/a | yes | -| [powervs\_sap\_network\_cidr](#input\_powervs\_sap\_network\_cidr) | Network range for separate SAP network. E.g., '10.53.1.0/24' | `string` | `"10.53.1.0/24"` | no | -| [powervs\_share\_storage\_config](#input\_powervs\_share\_storage\_config) | File systems to be created and attached to PowerVS instance for shared storage file systems. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
|
[
{
"count": "1",
"mount": "/sapmnt",
"name": "sapmnt",
"size": "300",
"tier": "tier3"
},
{
"count": "1",
"mount": "/usr/trans",
"name": "trans",
"size": "50",
"tier": "tier3"
}
]
| no | -| [powervs\_sshkey\_name](#input\_powervs\_sshkey\_name) | Existing PowerVS SSH Key Name. | `string` | n/a | yes | -| [powervs\_workspace\_name](#input\_powervs\_workspace\_name) | Existing Name of PowerVS workspace. | `string` | n/a | yes | +| [powervs\_create\_sharefs\_instance](#input\_powervs\_create\_sharefs\_instance) | value |
object({
enable = bool
image_id = string
})
| n/a | yes | +| [powervs\_hana\_instance](#input\_powervs\_hana\_instance) | SAP HANA hostname (non FQDN) will get the form of -. SAP HANA profile to use. Must be one of the supported profiles. See [here](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-power-vs). File system sizes are automatically calculated. Override automatic calculation by setting values in optional 'powervs\_hana\_instance\_custom\_storage\_config' parameter. Additional File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
object({
name = string
sap_profile_id = string
additional_storage_config = list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
})
|
{
"additional_storage_config": [
{
"count": "1",
"mount": "/usr/sap",
"name": "usrsap",
"size": "50",
"tier": "tier3"
}
],
"name": "hana",
"sap_profile_id": "ush1-4x256"
}
| no | +| [powervs\_hana\_instance\_custom\_storage\_config](#input\_powervs\_hana\_instance\_custom\_storage\_config) | Custom File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
|
[
{
"count": "",
"mount": "",
"name": "",
"size": "",
"tier": ""
}
]
| no | +| [powervs\_hana\_instance\_image\_id](#input\_powervs\_hana\_instance\_image\_id) | Image ID to be used for PowerVS HANA instance. Run 'ibmcloud pi images' to list available images. | `string` | n/a | yes | +| [powervs\_instance\_init\_linux](#input\_powervs\_instance\_init\_linux) | Configures a PowerVS linux instance to have internet access by setting proxy on it, updates os and create filesystems using ansible collection [ibm.power\_linux\_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/). where 'proxy\_host\_or\_ip\_port' E.g., 10.10.10.4:3128 , 'bastion\_host\_ip' is public IP of bastion/jump host to access the private IP of created linux PowerVS instance. |
object(
{
enable = bool
bastion_host_ip = string
ssh_private_key = string
proxy_host_or_ip_port = string
no_proxy_hosts = string
}
)
| n/a | yes | +| [powervs\_netweaver\_instance](#input\_powervs\_netweaver\_instance) | 'instance\_count' is number of SAP NetWeaver instances that should be created. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
object({
instance_count = number
name = string
processors = string
memory = string
proc_type = string
storage_config = list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
})
|
{
"instance_count": 1,
"memory": "32",
"name": "nw",
"proc_type": "shared",
"processors": "3",
"storage_config": [
{
"count": "1",
"mount": "/usr/sap",
"name": "usrsap",
"size": "50",
"tier": "tier3"
}
]
}
| no | +| [powervs\_netweaver\_instance\_image\_id](#input\_powervs\_netweaver\_instance\_image\_id) | Image ID to be used for PowerVS Netweaver instance. Run 'ibmcloud pi images' to list available images. | `string` | n/a | yes | +| [powervs\_networks](#input\_powervs\_networks) | Existing list of subnets to be attached to PowerVS instances. The first element will become the primary interface. Run 'ibmcloud pi networks' to list available private subnets. |
list(
object({
name = string
id = string
cidr = optional(string)
})
)
| n/a | yes | +| [powervs\_sap\_network\_cidr](#input\_powervs\_sap\_network\_cidr) | Additional private subnet for SAP communication which will be created. CIDR for SAP network. E.g., '10.53.0.0/24' | `string` | n/a | yes | +| [powervs\_sharefs\_instance](#input\_powervs\_sharefs\_instance) | Deploy separate IBM PowerVS instance as central file system share. All filesystems defined in 'powervs\_sharefs\_instance\_storage\_config' variable will be NFS exported and mounted on Netweaver PowerVS instances if enabled. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
object({
name = string
processors = string
memory = string
proc_type = string
storage_config = list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
})
|
{
"memory": "2",
"name": "share",
"proc_type": "shared",
"processors": "0.5",
"storage_config": [
{
"count": "1",
"mount": "/sapmnt",
"name": "sapmnt",
"size": "300",
"tier": "tier3"
},
{
"count": "1",
"mount": "/usr/trans",
"name": "trans",
"size": "50",
"tier": "tier3"
}
]
}
| no | +| [powervs\_ssh\_public\_key\_name](#input\_powervs\_ssh\_public\_key\_name) | Existing PowerVS SSH Public Key Name. | `string` | n/a | yes | +| [powervs\_workspace\_guid](#input\_powervs\_workspace\_guid) | PowerVS infrastructure workspace guid. The GUID of the resource instance. | `string` | n/a | yes | | [powervs\_zone](#input\_powervs\_zone) | IBM Cloud data center location where IBM PowerVS Workspace exists. | `string` | n/a | yes | | [prefix](#input\_prefix) | Unique prefix for resources to be created (e.g., SAP system name). Max length must be less than or equal to 6. | `string` | n/a | yes | -| [proxy\_host\_or\_ip\_port](#input\_proxy\_host\_or\_ip\_port) | Proxy hostname or IP address with port. E.g., 10.10.10.4:3128 . | `string` | n/a | yes | | [sap\_domain](#input\_sap\_domain) | SAP domain to be set for entire landscape. | `string` | `"sap.com"` | no | -| [ssh\_private\_key](#input\_ssh\_private\_key) | Private SSH key (RSA format) used to login to IBM PowerVS instances. Should match to uploaded public SSH key referenced by 'ssh\_public\_key' which was created previously. Entered data must be in [heredoc strings format](https://www.terraform.io/language/expressions/strings#heredoc-strings). The key is not uploaded or stored. For more information about SSH keys, see [SSH keys](https://cloud.ibm.com/docs/vpc?topic=vpc-ssh-keys). | `string` | n/a | yes | +| [sap\_network\_services\_config](#input\_sap\_network\_services\_config) | Configures network services NTP, NFS and DNS on PowerVS instance. Requires 'powervs\_instance\_init\_linux' to be specified as internet access is required to download ansible collection [ibm.power\_linux\_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/) to configure these services. |
object(
{
nfs = object({ enable = bool, nfs_server_path = string, nfs_client_path = string })
dns = object({ enable = bool, dns_server_ip = string })
ntp = object({ enable = bool, ntp_server_ip = string })
}
)
|
{
"dns": {
"dns_server_ip": "",
"enable": false
},
"nfs": {
"enable": false,
"nfs_client_path": "",
"nfs_server_path": ""
},
"ntp": {
"enable": false,
"ntp_server_ip": ""
}
}
| no | ### Outputs diff --git a/solutions/sap-ready-to-go/input.tfvars b/solutions/sap-ready-to-go/input.tfvars new file mode 100644 index 00000000..a914b76e --- /dev/null +++ b/solutions/sap-ready-to-go/input.tfvars @@ -0,0 +1,21 @@ +ibmcloud_api_key = "" +powervs_zone = "" #syd04 +prefix = "" +powervs_workspace_guid = "" +powervs_ssh_public_key_name = "" +powervs_networks = "" #[{ "cidr" : "10.61.0.0/24", "id" : "c39dadb6-830c-4567-8b36-d176f8fe3aab", "name" : "mgmt_net" }, { "cidr" : "10.62.0.0/24", "id" : "340bde12-5e32-48ee-8624-058d0b80d990", "name" : "bkp_net" }] +powervs_sap_network_cidr = "" #10.78.0.1/24 +powervs_create_sharefs_instance = { + enable = "" #true or false + image_id = "" +} +powervs_hana_instance_image_id = "" +powervs_netweaver_instance_image_id = "" +powervs_instance_init_linux = { + enable = "" #true or false + bastion_host_ip = "" + proxy_host_or_ip_port = "" #10.30.10.4:3128 + no_proxy_hosts = "161.0.0.0/8,10.0.0.0/8" + ssh_private_key = <<-EOF +EOF +} diff --git a/solutions/sap-ready-to-go/main.tf b/solutions/sap-ready-to-go/main.tf index 0534972e..03e57ed9 100644 --- a/solutions/sap-ready-to-go/main.tf +++ b/solutions/sap-ready-to-go/main.tf @@ -1,60 +1,33 @@ -locals { - ibm_powervs_zone_region_map = { - "lon04" = "lon" - "lon06" = "lon" - "eu-de-1" = "eu-de" - "eu-de-2" = "eu-de" - "tor01" = "tor" - "mon01" = "mon" - "osa21" = "osa" - "tok04" = "tok" - "syd04" = "syd" - "syd05" = "syd" - "sao01" = "sao" - "us-south" = "us-south" - "dal10" = "us-south" - "dal12" = "us-south" - "us-east" = "us-east" - } -} - -provider "ibm" { - region = lookup(local.ibm_powervs_zone_region_map, var.powervs_zone, null) - zone = var.powervs_zone - ibmcloud_api_key = var.ibmcloud_api_key != null ? var.ibmcloud_api_key : null -} ##################################################### -# Deploy SAP system ( 1 HANA instance and 0:N Netweaver Instance) +# Deploy SAP system +# 1 HANA instance +# 0:N Netweaver Instance +# 1 Optional Sharefs instance ##################################################### + +locals { + powervs_sharefs_instance = merge(var.powervs_create_sharefs_instance, var.powervs_sharefs_instance) + powervs_hana_instance = merge(var.powervs_hana_instance, { image_id = var.powervs_hana_instance_image_id }) + powervs_netweaver_instance = merge(var.powervs_netweaver_instance, { image_id = var.powervs_netweaver_instance_image_id }) +} + module "sap_system" { - source = "./module" - powervs_zone = var.powervs_zone - powervs_resource_group_name = var.powervs_resource_group_name - powervs_workspace_name = var.powervs_workspace_name - powervs_sshkey_name = var.powervs_sshkey_name + source = "../../modules/pi-sap-system-type1" + + pi_zone = var.powervs_zone prefix = var.prefix - ssh_private_key = var.ssh_private_key - powervs_sap_network_cidr = var.powervs_sap_network_cidr + pi_workspace_guid = var.powervs_workspace_guid + pi_ssh_public_key_name = var.powervs_ssh_public_key_name + pi_networks = var.powervs_networks + pi_sap_network_cidr = var.powervs_sap_network_cidr cloud_connection_count = var.cloud_connection_count - additional_networks = var.additional_networks - os_image_distro = var.os_image_distro - powervs_create_separate_fs_share = var.powervs_create_separate_fs_share - powervs_hana_instance_name = var.powervs_hana_instance_name - powervs_hana_sap_profile_id = var.powervs_hana_sap_profile_id - powervs_netweaver_instance_count = var.powervs_netweaver_instance_count - powervs_netweaver_instance_name = var.powervs_netweaver_instance_name - powervs_netweaver_cpu_number = var.powervs_netweaver_cpu_number - powervs_netweaver_memory_size = var.powervs_netweaver_memory_size - access_host_or_ip = var.access_host_or_ip - proxy_host_or_ip_port = var.proxy_host_or_ip_port - dns_host_or_ip = var.dns_host_or_ip - ntp_host_or_ip = var.ntp_host_or_ip - nfs_host_or_ip_path = var.nfs_host_or_ip_path + pi_sharefs_instance = local.powervs_sharefs_instance + pi_hana_instance = local.powervs_hana_instance + pi_hana_instance_custom_storage_config = var.powervs_hana_instance_custom_storage_config + pi_netweaver_instance = local.powervs_netweaver_instance + pi_instance_init_linux = var.powervs_instance_init_linux + sap_network_services_config = var.sap_network_services_config sap_domain = var.sap_domain - powervs_share_storage_config = var.powervs_share_storage_config - powervs_hana_custom_storage_config = var.powervs_hana_custom_storage_config - powervs_hana_additional_storage_config = var.powervs_hana_additional_storage_config - powervs_netweaver_storage_config = var.powervs_netweaver_storage_config - powervs_default_images = var.powervs_default_images + } diff --git a/solutions/sap-ready-to-go/module/README.md b/solutions/sap-ready-to-go/module/README.md deleted file mode 100644 index 118bf7ec..00000000 --- a/solutions/sap-ready-to-go/module/README.md +++ /dev/null @@ -1,82 +0,0 @@ -# Power Virtual Server for SAP SYSTEM MODULE -The Power Virtual Server for SAP module automates the following tasks: - -- Creates and configures one PowerVS instance for SAP HANA that is based on best practices. -- Creates and configures multiple PowerVS instances for SAP NetWeaver that are based on best practices. -- Creates and configures one optional PowerVS instance that can be used for sharing SAP files between other system instances. -- Connects all created PowerVS instances to a proxy server that is specified by IP address or hostname. -- Optionally connects all created PowerVS instances to an NTP server and DNS forwarder that are specified by IP address or hostname. -- Optionally configures a shared NFS directory on all created PowerVS instances. - - -### Requirements - -| Name | Version | -|------|---------| -| [terraform](#requirement\_terraform) | >= 1.3 | -| [ibm](#requirement\_ibm) | >= 1.49.0 | -| [null](#requirement\_null) | >= 3.2.1 | - -### Modules - -| Name | Source | Version | -|------|--------|---------| -| [ansible\_sap\_instance\_init](#module\_ansible\_sap\_instance\_init) | ../../../modules/ansible_sap_instance_init | n/a | -| [powervs\_attach\_sap\_network](#module\_powervs\_attach\_sap\_network) | ../../../modules/powervs_attach_private_network | n/a | -| [powervs\_create\_sap\_network](#module\_powervs\_create\_sap\_network) | ../../../modules/powervs_create_private_network | n/a | -| [powervs\_hana\_instance](#module\_powervs\_hana\_instance) | git::https://github.com/terraform-ibm-modules/terraform-ibm-powervs-instance.git | v0.3.2 | -| [powervs\_hana\_storage\_calculation](#module\_powervs\_hana\_storage\_calculation) | ../../../modules/powervs_hana_storage_config | n/a | -| [powervs\_netweaver\_instance](#module\_powervs\_netweaver\_instance) | git::https://github.com/terraform-ibm-modules/terraform-ibm-powervs-instance.git | v0.3.2 | -| [powervs\_sharefs\_instance](#module\_powervs\_sharefs\_instance) | git::https://github.com/terraform-ibm-modules/terraform-ibm-powervs-instance.git | v0.3.2 | -| [sharefs\_instance\_init](#module\_sharefs\_instance\_init) | ./submodule/sharefs_instance_init | n/a | - -### Resources - -No resources. - -### Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [access\_host\_or\_ip](#input\_access\_host\_or\_ip) | The public IP address or hostname for the access host. The address is used to reach the target or server\_host IP address and to configure the DNS, NTP, NFS, and Squid proxy services. Set to null or empty if not configuring OS. | `string` | n/a | yes | -| [additional\_networks](#input\_additional\_networks) | Existing list of subnets name to be attached to PowerVS instances. First network has to be a management network. | `list(string)` |
[
"mgmt_net",
"bkp_net"
]
| no | -| [cloud\_connection\_count](#input\_cloud\_connection\_count) | Existing number of Cloud connections to which new subnet must be attached. | `string` | `2` | no | -| [dns\_host\_or\_ip](#input\_dns\_host\_or\_ip) | Private IP address of DNS server, resolver or forwarder. Set empty if not configuring OS. | `string` | n/a | yes | -| [nfs\_host\_or\_ip\_path](#input\_nfs\_host\_or\_ip\_path) | Full path on NFS server (in form :, e.g., '10.20.10.4:/nfs'). Set to empty if not configuring OS. | `string` | n/a | yes | -| [ntp\_host\_or\_ip](#input\_ntp\_host\_or\_ip) | Private IP address of NTP time server or forwarder. Set empty if not configuring OS. | `string` | n/a | yes | -| [os\_image\_distro](#input\_os\_image\_distro) | Image distribution to use for all instances(Shared, HANA, Netweaver). OS release versions may be specified in 'var.powervs\_default\_images' optional parameters below. | `string` | `"RHEL"` | no | -| [powervs\_create\_separate\_fs\_share](#input\_powervs\_create\_separate\_fs\_share) | Deploy separate IBM PowerVS instance(0.5 cpus, 2 GB memory size, shared processor on s922.) as central file system share. All filesystems defined in 'powervs\_share\_storage\_config' optional variable will be NFS exported and mounted on Netweaver PowerVS instances. | `bool` | n/a | yes | -| [powervs\_default\_images](#input\_powervs\_default\_images) | Default SuSE and Red Hat Linux images to use for SAP HANA and SAP NetWeaver PowerVS instances. |
object({
sles_hana_image = string
sles_nw_image = string
rhel_hana_image = string
rhel_nw_image = string
})
|
{
"rhel_hana_image": "RHEL8-SP6-SAP",
"rhel_nw_image": "RHEL8-SP6-SAP-NETWEAVER",
"sles_hana_image": "SLES15-SP4-SAP",
"sles_nw_image": "SLES15-SP4-SAP-NETWEAVER"
}
| no | -| [powervs\_hana\_additional\_storage\_config](#input\_powervs\_hana\_additional\_storage\_config) | Additional File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
|
[
{
"count": "1",
"mount": "/usr/sap",
"name": "usrsap",
"size": "50",
"tier": "tier3"
}
]
| no | -| [powervs\_hana\_custom\_storage\_config](#input\_powervs\_hana\_custom\_storage\_config) | Custom File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
|
[
{
"count": "",
"mount": "",
"name": "",
"size": "",
"tier": ""
}
]
| no | -| [powervs\_hana\_instance\_name](#input\_powervs\_hana\_instance\_name) | SAP HANA hostname (non FQDN). Will get the form of -. Max length of final hostname must be <= 13 characters. | `string` | `"hana"` | no | -| [powervs\_hana\_sap\_profile\_id](#input\_powervs\_hana\_sap\_profile\_id) | SAP HANA profile to use. Must be one of the supported profiles. See [here](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-power-vs). File system sizes are automatically calculated. Override automatic calculation by setting values in optional sap\_hana\_custom\_storage\_config parameter. | `string` | `"ush1-4x256"` | no | -| [powervs\_netweaver\_cpu\_number](#input\_powervs\_netweaver\_cpu\_number) | Number of CPUs for each SAP NetWeaver instance. | `string` | `"3"` | no | -| [powervs\_netweaver\_instance\_count](#input\_powervs\_netweaver\_instance\_count) | Number of SAP NetWeaver instances that should be created. | `number` | `1` | no | -| [powervs\_netweaver\_instance\_name](#input\_powervs\_netweaver\_instance\_name) | SAP Netweaver hostname (non FQDN). Will get the form of --. Max length of final hostname must be <= 13 characters. | `string` | `"nw"` | no | -| [powervs\_netweaver\_memory\_size](#input\_powervs\_netweaver\_memory\_size) | Memory size for each SAP NetWeaver instance. | `string` | `"32"` | no | -| [powervs\_netweaver\_storage\_config](#input\_powervs\_netweaver\_storage\_config) | File systems to be created and attached to PowerVS instance for SAP NetWeaver. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
|
[
{
"count": "1",
"mount": "/usr/sap",
"name": "usrsap",
"size": "50",
"tier": "tier3"
}
]
| no | -| [powervs\_resource\_group\_name](#input\_powervs\_resource\_group\_name) | Existing IBM Cloud resource group name. | `string` | n/a | yes | -| [powervs\_sap\_network\_cidr](#input\_powervs\_sap\_network\_cidr) | Network range for separate SAP network. E.g., '10.53.1.0/24' | `string` | `"10.53.1.0/24"` | no | -| [powervs\_share\_storage\_config](#input\_powervs\_share\_storage\_config) | File systems to be created and attached to PowerVS instance for shared storage file systems. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
}))
|
[
{
"count": "1",
"mount": "/sapmnt",
"name": "sapmnt",
"size": "300",
"tier": "tier3"
},
{
"count": "1",
"mount": "/usr/trans",
"name": "trans",
"size": "50",
"tier": "tier3"
}
]
| no | -| [powervs\_sshkey\_name](#input\_powervs\_sshkey\_name) | Existing PowerVS SSH Key Name. | `string` | n/a | yes | -| [powervs\_workspace\_name](#input\_powervs\_workspace\_name) | Existing Name of PowerVS workspace. | `string` | n/a | yes | -| [powervs\_zone](#input\_powervs\_zone) | IBM Cloud data center location where IBM PowerVS Workspace exists. | `string` | n/a | yes | -| [prefix](#input\_prefix) | Unique prefix for resources to be created (e.g., SAP system name). Max length must be less than or equal to 6. | `string` | n/a | yes | -| [proxy\_host\_or\_ip\_port](#input\_proxy\_host\_or\_ip\_port) | Proxy hostname or IP address with port. E.g., 10.10.10.4:3128 . | `string` | n/a | yes | -| [sap\_domain](#input\_sap\_domain) | SAP domain to be set for entire landscape. | `string` | `"sap.com"` | no | -| [ssh\_private\_key](#input\_ssh\_private\_key) | Private SSH key (RSA format) used to login to IBM PowerVS instances. Should match to uploaded public SSH key referenced by 'ssh\_public\_key' which was created previously. Entered data must be in [heredoc strings format](https://www.terraform.io/language/expressions/strings#heredoc-strings). The key is not uploaded or stored. For more information about SSH keys, see [SSH keys](https://cloud.ibm.com/docs/vpc?topic=vpc-ssh-keys). | `string` | n/a | yes | - -### Outputs - -| Name | Description | -|------|-------------| -| [access\_host\_or\_ip](#output\_access\_host\_or\_ip) | Public IP of Provided Bastion/JumpServer Host | -| [powervs\_hana\_instance\_ips](#output\_powervs\_hana\_instance\_ips) | All private IPS of HANA instance | -| [powervs\_hana\_instance\_management\_ip](#output\_powervs\_hana\_instance\_management\_ip) | Management IP of HANA Instance | -| [powervs\_hana\_instance\_sap\_ip](#output\_powervs\_hana\_instance\_sap\_ip) | SAP IP of PowerVS HANA Instance | -| [powervs\_lpars\_data](#output\_powervs\_lpars\_data) | All private IPS of PowerVS instances and Jump IP to access the host. | -| [powervs\_netweaver\_instance\_ips](#output\_powervs\_netweaver\_instance\_ips) | All private IPS of NetWeaver instances | -| [powervs\_netweaver\_instance\_management\_ips](#output\_powervs\_netweaver\_instance\_management\_ips) | Management IPS of NetWeaver instances | -| [powervs\_share\_fs\_ips](#output\_powervs\_share\_fs\_ips) | Private IPs of the Share FS instance. | - diff --git a/solutions/sap-ready-to-go/module/main.tf b/solutions/sap-ready-to-go/module/main.tf deleted file mode 100644 index 4965dfa6..00000000 --- a/solutions/sap-ready-to-go/module/main.tf +++ /dev/null @@ -1,238 +0,0 @@ -locals { - per_enabled_dc_list = ["dal10"] - per_enabled = contains(local.per_enabled_dc_list, var.powervs_zone) -} - -##################################################### -# Get Values from Infrastructure Workspace -##################################################### - -locals { - - powervs_resource_group_name = var.powervs_resource_group_name - powervs_workspace_name = var.powervs_workspace_name - powervs_sshkey_name = var.powervs_sshkey_name - access_host_or_ip = var.access_host_or_ip - cloud_connection_count = var.cloud_connection_count - proxy_host_or_ip_port = var.proxy_host_or_ip_port - ntp_host_or_ip = var.ntp_host_or_ip - dns_host_or_ip = var.dns_host_or_ip - nfs_host_or_ip_path = var.nfs_host_or_ip_path -} - -##################################################### -# Prepare locals for SAP systems -##################################################### - -locals { - - powervs_sap_network = { "name" = "${var.prefix}-net", "cidr" = var.powervs_sap_network_cidr } - powervs_networks = concat(var.additional_networks, [local.powervs_sap_network.name]) - powervs_instance_init = { - enable = true - access_host_or_ip = local.access_host_or_ip - ssh_private_key = var.ssh_private_key - } - - powervs_proxy_settings = { - proxy_host_or_ip_port = local.proxy_host_or_ip_port - no_proxy_hosts = "161.0.0.0/8,10.0.0.0/8" - } - - ## Configuration for sharefs instance and HANA instance - powervs_network_services_config = { - nfs = { enable = local.nfs_host_or_ip_path != "" ? true : false, nfs_server_path = local.nfs_host_or_ip_path, nfs_client_path = "/nfs" } - dns = { enable = local.dns_host_or_ip != "" ? true : false, dns_server_ip = local.dns_host_or_ip } - ntp = { enable = local.ntp_host_or_ip != "" ? true : false, ntp_server_ip = local.ntp_host_or_ip } - } - - ## Configuration for sharefs instance as NFS server - sharefs_nfs_server_config = { - nfs : { - enable : var.powervs_create_separate_fs_share ? true : false, - nfs_file_system : [for volume in var.powervs_share_storage_config : { name : volume.name, mount_path : volume.mount, size : volume.size }] } - } - - ## Configuration for Netweaver instance - nfs_server_path = var.powervs_create_separate_fs_share ? join(";", concat([local.nfs_host_or_ip_path], [for volume in var.powervs_share_storage_config : "${module.powervs_sharefs_instance[0].pi_instance_mgmt_ip}:${volume.mount}"])) : local.nfs_host_or_ip_path - nfs_client_path = var.powervs_create_separate_fs_share ? join(";", concat(["/nfs"], [for volume in var.powervs_share_storage_config : volume.mount])) : "/nfs" - powervs_netweaver_network_services_config = { - nfs = { enable = local.nfs_host_or_ip_path != "" ? true : false, nfs_server_path = local.nfs_server_path, nfs_client_path = local.nfs_client_path } - dns = { enable = local.dns_host_or_ip != "" ? true : false, dns_server_ip = local.dns_host_or_ip } - ntp = { enable = local.ntp_host_or_ip != "" ? true : false, ntp_server_ip = local.ntp_host_or_ip } - } -} - -##################################################### -# Create SAP network for the SAP System -##################################################### - -module "powervs_create_sap_network" { - source = "../../../modules/powervs_create_private_network" - powervs_zone = var.powervs_zone - - powervs_resource_group_name = local.powervs_resource_group_name - powervs_workspace_name = local.powervs_workspace_name - powervs_sap_network = local.powervs_sap_network -} - -module "powervs_attach_sap_network" { - source = "../../../modules/powervs_attach_private_network" - depends_on = [module.powervs_create_sap_network] - count = local.per_enabled ? 0 : 1 - - powervs_zone = var.powervs_zone - powervs_resource_group_name = local.powervs_resource_group_name - powervs_workspace_name = local.powervs_workspace_name - powervs_sap_network_name = local.powervs_sap_network.name - powervs_cloud_connection_count = local.cloud_connection_count -} - -##################################################### -# Deploy share fs instance -##################################################### - -locals { - - powervs_share_hostname = "${var.prefix}-share" - powervs_share_os_image = var.os_image_distro == "SLES" ? var.powervs_default_images.sles_nw_image : var.powervs_default_images.rhel_nw_image -} - -module "powervs_sharefs_instance" { - source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-powervs-instance.git?ref=v0.3.2" - depends_on = [module.powervs_attach_sap_network] - count = var.powervs_create_separate_fs_share ? 1 : 0 - - pi_zone = var.powervs_zone - pi_resource_group_name = local.powervs_resource_group_name - pi_workspace_name = local.powervs_workspace_name - pi_sshkey_name = local.powervs_sshkey_name - pi_instance_name = local.powervs_share_hostname - pi_os_image_name = local.powervs_share_os_image - pi_networks = local.powervs_networks - pi_sap_profile_id = null - pi_number_of_processors = "0.5" - pi_memory_size = "2" - pi_server_type = "s922" - pi_cpu_proc_type = "shared" - pi_storage_config = var.powervs_share_storage_config - pi_instance_init = local.powervs_instance_init - pi_proxy_settings = local.powervs_proxy_settings - pi_network_services_config = local.powervs_network_services_config - -} - -module "sharefs_instance_init" { - source = "./submodule/sharefs_instance_init" - depends_on = [module.powervs_sharefs_instance] - count = var.powervs_create_separate_fs_share ? 1 : 0 - - access_host_or_ip = local.access_host_or_ip - target_server_ip = module.powervs_sharefs_instance[0].pi_instance_mgmt_ip - ssh_private_key = var.ssh_private_key - service_config = local.sharefs_nfs_server_config -} - -##################################################### -# Deploy SAP HANA Instance -##################################################### -locals { - - powervs_hana_hostname = "${var.prefix}-${var.powervs_hana_instance_name}" - powervs_hana_os_image = var.os_image_distro == "SLES" ? var.powervs_default_images.sles_hana_image : var.powervs_default_images.rhel_hana_image -} - -module "powervs_hana_storage_calculation" { - - source = "../../../modules/powervs_hana_storage_config" - powervs_hana_sap_profile_id = var.powervs_hana_sap_profile_id - powervs_hana_additional_storage_config = var.powervs_hana_additional_storage_config - powervs_hana_custom_storage_config = var.powervs_hana_custom_storage_config -} - -module "powervs_hana_instance" { - source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-powervs-instance.git?ref=v0.3.2" - depends_on = [module.powervs_attach_sap_network] - - pi_zone = var.powervs_zone - pi_resource_group_name = local.powervs_resource_group_name - pi_workspace_name = local.powervs_workspace_name - pi_sshkey_name = local.powervs_sshkey_name - pi_instance_name = local.powervs_hana_hostname - pi_os_image_name = local.powervs_hana_os_image - pi_networks = local.powervs_networks - pi_sap_profile_id = var.powervs_hana_sap_profile_id - pi_storage_config = module.powervs_hana_storage_calculation.hana_storage_config - pi_instance_init = local.powervs_instance_init - pi_proxy_settings = local.powervs_proxy_settings - pi_network_services_config = local.powervs_network_services_config - -} - -locals { - powervs_hana_instance_ips = split(", ", module.powervs_hana_instance.pi_instance_private_ips) - powervs_hana_instance_sap_ip = local.powervs_hana_instance_ips[index([for ip in local.powervs_hana_instance_ips : alltrue([for i, v in split(".", ip) : tonumber(split(".", cidrhost(local.powervs_sap_network.cidr, 0))[i]) <= tonumber(v) && tonumber(v) <= tonumber(split(".", cidrhost(local.powervs_sap_network.cidr, -1))[i])])], true)] -} -##################################################### -# Deploy SAP Netweaver Instance -##################################################### - -locals { - - powervs_netweaver_hostname = "${var.prefix}-${var.powervs_netweaver_instance_name}" - powervs_netweaver_os_image = var.os_image_distro == "SLES" ? var.powervs_default_images.sles_nw_image : var.powervs_default_images.rhel_nw_image - netweaver_sapmnt_storage = [{ "name" : "sapmnt", "size" : "300", "count" : "1", "tier" : "tier3", "mount" : "/sapmnt" }] - powervs_netweaver_storage_config = var.powervs_create_separate_fs_share ? var.powervs_netweaver_storage_config : concat(var.powervs_netweaver_storage_config, local.netweaver_sapmnt_storage) - -} - -module "powervs_netweaver_instance" { - source = "git::https://github.com/terraform-ibm-modules/terraform-ibm-powervs-instance.git?ref=v0.3.2" - depends_on = [module.powervs_attach_sap_network, module.sharefs_instance_init] - count = var.powervs_netweaver_instance_count - - pi_zone = var.powervs_zone - pi_resource_group_name = local.powervs_resource_group_name - pi_workspace_name = local.powervs_workspace_name - pi_sshkey_name = local.powervs_sshkey_name - pi_instance_name = "${local.powervs_netweaver_hostname}-${count.index + 1}" - pi_os_image_name = local.powervs_netweaver_os_image - pi_networks = local.powervs_networks - pi_sap_profile_id = null - pi_number_of_processors = var.powervs_netweaver_cpu_number - pi_memory_size = var.powervs_netweaver_memory_size - pi_server_type = "s922" - pi_cpu_proc_type = "shared" - pi_storage_config = local.powervs_netweaver_storage_config - pi_instance_init = local.powervs_instance_init - pi_proxy_settings = local.powervs_proxy_settings - pi_network_services_config = local.powervs_netweaver_network_services_config - -} - -##################################################### -# Prepare OS for SAP -##################################################### - -locals { - target_server_ips = concat([module.powervs_hana_instance.pi_instance_mgmt_ip], module.powervs_netweaver_instance[*].pi_instance_mgmt_ip) - sap_solutions = concat(["HANA"], [for ip in module.powervs_netweaver_instance[*].pi_instance_mgmt_ip : "NETWEAVER"]) -} - -module "ansible_sap_instance_init" { - - source = "../../../modules/ansible_sap_instance_init" - depends_on = [module.powervs_hana_instance, module.powervs_netweaver_instance] - - access_host_or_ip = local.access_host_or_ip - target_server_ips = local.target_server_ips - ssh_private_key = var.ssh_private_key - sap_solutions = local.sap_solutions - sap_domain = var.sap_domain - -} - -moved { - from = module.sap_instance_init - to = module.ansible_sap_instance_init -} diff --git a/solutions/sap-ready-to-go/module/outputs.tf b/solutions/sap-ready-to-go/module/outputs.tf deleted file mode 100644 index 2a8e6339..00000000 --- a/solutions/sap-ready-to-go/module/outputs.tf +++ /dev/null @@ -1,46 +0,0 @@ -output "access_host_or_ip" { - description = "Public IP of Provided Bastion/JumpServer Host" - value = local.access_host_or_ip -} - -output "powervs_hana_instance_ips" { - description = "All private IPS of HANA instance" - value = module.powervs_hana_instance.pi_instance_private_ips -} - -output "powervs_hana_instance_management_ip" { - description = "Management IP of HANA Instance" - value = module.powervs_hana_instance.pi_instance_mgmt_ip -} - -output "powervs_hana_instance_sap_ip" { - description = "SAP IP of PowerVS HANA Instance" - value = local.powervs_hana_instance_sap_ip -} - -output "powervs_netweaver_instance_ips" { - description = "All private IPS of NetWeaver instances" - value = var.powervs_netweaver_instance_count >= 1 ? module.powervs_netweaver_instance[*].pi_instance_private_ips : [""] -} - -output "powervs_netweaver_instance_management_ips" { - description = "Management IPS of NetWeaver instances" - value = var.powervs_netweaver_instance_count >= 1 ? join(",", module.powervs_netweaver_instance[*].pi_instance_mgmt_ip) : "" -} - -output "powervs_share_fs_ips" { - description = "Private IPs of the Share FS instance." - value = var.powervs_create_separate_fs_share ? module.powervs_sharefs_instance[0].pi_instance_mgmt_ip : "" -} - -output "powervs_lpars_data" { - description = "All private IPS of PowerVS instances and Jump IP to access the host." - value = { - "access_host_or_ip" = local.access_host_or_ip - "powervs_hana_instance_management_ip" = module.powervs_hana_instance.pi_instance_mgmt_ip - "powervs_hana_instance_ips" = module.powervs_hana_instance.pi_instance_private_ips - "powervs_netweaver_instances_management_ip" = var.powervs_netweaver_instance_count >= 1 ? join(",", module.powervs_netweaver_instance[*].pi_instance_mgmt_ip) : "" - "powervs_netweaver_ips" = var.powervs_netweaver_instance_count >= 1 ? module.powervs_netweaver_instance[*].pi_instance_private_ips : [""] - "powervs_share_fs_ip" = var.powervs_create_separate_fs_share ? module.powervs_sharefs_instance[0].pi_instance_mgmt_ip : "" - } -} diff --git a/solutions/sap-ready-to-go/module/submodule/sharefs_instance_init/main.tf b/solutions/sap-ready-to-go/module/submodule/sharefs_instance_init/main.tf deleted file mode 100644 index 5b9ef37f..00000000 --- a/solutions/sap-ready-to-go/module/submodule/sharefs_instance_init/main.tf +++ /dev/null @@ -1,52 +0,0 @@ -locals { - scr_scripts_dir = "${path.module}/templates" - dst_scripts_dir = "/root/terraform_scripts" - - ansible_configure_network_services_playbook_name = "powervs-services.yml" - src_script_configure_network_services_tftpl_path = "${local.scr_scripts_dir}/configure_network_services.sh.tftpl" - dst_script_configure_network_services_sh_path = "${local.dst_scripts_dir}/server_config.sh" - dst_ansible_vars_path = "${local.dst_scripts_dir}/server_config.yml" - -} -resource "null_resource" "sharefs_nfs_server" { - connection { - type = "ssh" - user = "root" - bastion_host = var.access_host_or_ip - host = var.target_server_ip - private_key = var.ssh_private_key - agent = false - timeout = "10m" - } - - provisioner "file" { - - ######### Write the HANA installation variables in ansible var file. #### - content = <ansible.cfg - -if [[ " $${power_linux_sap_arr[@]} " =~ " $${playbook_name} " ]]; then - unbuffer ansible-playbook --connection=local -i 'localhost,' ~/.ansible/collections/ansible_collections/ibm/power_linux_sap/playbooks/$${playbook_name} --extra-vars "@$${ansible_vars_location}" - status=$? - [ $status -eq 0 ] && echo \"Playbook command successful\" || exit 1 -fi diff --git a/solutions/sap-ready-to-go/module/submodule/sharefs_instance_init/variables.tf b/solutions/sap-ready-to-go/module/submodule/sharefs_instance_init/variables.tf deleted file mode 100644 index 783236ef..00000000 --- a/solutions/sap-ready-to-go/module/submodule/sharefs_instance_init/variables.tf +++ /dev/null @@ -1,21 +0,0 @@ -variable "access_host_or_ip" { - description = "Jump/Bastion server public IP address to reach the target/server_host ip to configure the DNS,NTP,NFS,SQUID services." - type = string -} - -variable "target_server_ip" { - description = "Target/server_host ip on which the DNS,NTP,NFS,SQUID services will be configured." - type = string -} - -variable "ssh_private_key" { - description = "Private SSH key used to login to IBM PowerVS instances.Entered data must be in heredoc strings format (https://www.terraform.io/language/expressions/strings#heredoc-strings). The key is not uploaded or stored." - type = string - sensitive = true -} - -variable "service_config" { - description = "An object which contains configuration for NFS, NTP, DNS, Squid Services." - type = any - default = {} -} diff --git a/solutions/sap-ready-to-go/module/submodule/sharefs_instance_init/versions.tf b/solutions/sap-ready-to-go/module/submodule/sharefs_instance_init/versions.tf deleted file mode 100644 index 78392fb0..00000000 --- a/solutions/sap-ready-to-go/module/submodule/sharefs_instance_init/versions.tf +++ /dev/null @@ -1,20 +0,0 @@ -##################################################### -# PowerVs SAP System Module -##################################################### - -terraform { - required_version = ">= 1.3" - required_providers { - # tflint-ignore: terraform_unused_required_providers - ibm = { - source = "IBM-Cloud/ibm" - version = ">= 1.49.0" - } - # tflint-ignore: terraform_unused_required_providers - null = { - source = "hashicorp/null" - version = ">= 3.2.1" - } - - } -} diff --git a/solutions/sap-ready-to-go/module/variables.tf b/solutions/sap-ready-to-go/module/variables.tf deleted file mode 100644 index 66085ac8..00000000 --- a/solutions/sap-ready-to-go/module/variables.tf +++ /dev/null @@ -1,263 +0,0 @@ -variable "powervs_zone" { - description = "IBM Cloud data center location where IBM PowerVS Workspace exists." - type = string -} - -variable "powervs_resource_group_name" { - description = "Existing IBM Cloud resource group name." - type = string -} - -variable "powervs_workspace_name" { - description = "Existing Name of PowerVS workspace." - type = string -} - -variable "powervs_sshkey_name" { - description = "Existing PowerVS SSH Key Name." - type = string -} - -variable "prefix" { - description = "Unique prefix for resources to be created (e.g., SAP system name). Max length must be less than or equal to 6." - type = string - validation { - condition = length(var.prefix) <= 6 - error_message = "Prefix length exceeds 6 characters" - } -} - -variable "ssh_private_key" { - description = "Private SSH key (RSA format) used to login to IBM PowerVS instances. Should match to uploaded public SSH key referenced by 'ssh_public_key' which was created previously. Entered data must be in [heredoc strings format](https://www.terraform.io/language/expressions/strings#heredoc-strings). The key is not uploaded or stored. For more information about SSH keys, see [SSH keys](https://cloud.ibm.com/docs/vpc?topic=vpc-ssh-keys)." - type = string - sensitive = true -} - -variable "cloud_connection_count" { - description = "Existing number of Cloud connections to which new subnet must be attached." - type = string - default = 2 -} - -variable "additional_networks" { - description = "Existing list of subnets name to be attached to PowerVS instances. First network has to be a management network." - type = list(string) - default = ["mgmt_net", "bkp_net"] -} - -variable "powervs_sap_network_cidr" { - description = "Network range for separate SAP network. E.g., '10.53.1.0/24'" - type = string - default = "10.53.1.0/24" -} - -variable "os_image_distro" { - description = "Image distribution to use for all instances(Shared, HANA, Netweaver). OS release versions may be specified in 'var.powervs_default_images' optional parameters below." - type = string - default = "RHEL" - - validation { - condition = (upper(var.os_image_distro) == "RHEL" || upper(var.os_image_distro) == "SLES") - error_message = "Supported values are 'RHEL' or 'SLES' only." - } -} - -##################################################### -# PowerVS Shared FS Instance parameters -##################################################### - -variable "powervs_create_separate_fs_share" { - description = "Deploy separate IBM PowerVS instance(0.5 cpus, 2 GB memory size, shared processor on s922.) as central file system share. All filesystems defined in 'powervs_share_storage_config' optional variable will be NFS exported and mounted on Netweaver PowerVS instances." - type = bool -} - -##################################################### -# PowerVS HANA Instance parameters -##################################################### - -variable "powervs_hana_instance_name" { - description = "SAP HANA hostname (non FQDN). Will get the form of -. Max length of final hostname must be <= 13 characters." - type = string - default = "hana" -} - -variable "powervs_hana_sap_profile_id" { - description = "SAP HANA profile to use. Must be one of the supported profiles. See [here](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-power-vs). File system sizes are automatically calculated. Override automatic calculation by setting values in optional sap_hana_custom_storage_config parameter." - type = string - default = "ush1-4x256" -} - -##################################################### -# PowerVS NetWeaver Instance parameters -##################################################### - -variable "powervs_netweaver_instance_count" { - description = "Number of SAP NetWeaver instances that should be created." - type = number - default = 1 -} - -variable "powervs_netweaver_instance_name" { - description = "SAP Netweaver hostname (non FQDN). Will get the form of --. Max length of final hostname must be <= 13 characters." - type = string - default = "nw" -} - -variable "powervs_netweaver_cpu_number" { - description = "Number of CPUs for each SAP NetWeaver instance." - type = string - default = "3" -} - -variable "powervs_netweaver_memory_size" { - description = "Memory size for each SAP NetWeaver instance." - type = string - default = "32" -} - -##################################################### -# PVS SAP instance Initialization -##################################################### - -variable "access_host_or_ip" { - description = "The public IP address or hostname for the access host. The address is used to reach the target or server_host IP address and to configure the DNS, NTP, NFS, and Squid proxy services. Set to null or empty if not configuring OS." - type = string -} - -variable "proxy_host_or_ip_port" { - description = "Proxy hostname or IP address with port. E.g., 10.10.10.4:3128 ." - type = string - - validation { - condition = can(regex("\\b(?:(?:2(?:[0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9])\\.){3}(?:(?:2([0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9]))\\b:[0-9]+", var.proxy_host_or_ip_port)) - error_message = "Proxy hostname or IP address with port. E.g., 10.10.10.4:3128 ." - } -} - -variable "dns_host_or_ip" { - description = "Private IP address of DNS server, resolver or forwarder. Set empty if not configuring OS." - type = string -} - -variable "ntp_host_or_ip" { - description = "Private IP address of NTP time server or forwarder. Set empty if not configuring OS." - type = string -} - -variable "nfs_host_or_ip_path" { - description = "Full path on NFS server (in form :, e.g., '10.20.10.4:/nfs'). Set to empty if not configuring OS." - type = string - - validation { - condition = can(regex("\\b(?:(?:2(?:[0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9])\\.){3}(?:(?:2([0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9]))\\b:\\/[A-Za-z0-9]+", var.nfs_host_or_ip_path)) || var.nfs_host_or_ip_path == "" - error_message = "Full path on NFS server (in form :, e.g., '10.20.10.4:/nfs') or it should be empty" - } -} - -variable "sap_domain" { - description = "SAP domain to be set for entire landscape." - type = string - default = "sap.com" -} - -##################################################### -# Optional Parameters -##################################################### - -variable "powervs_share_storage_config" { - description = "File systems to be created and attached to PowerVS instance for shared storage file systems. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." - type = list(object({ - name = string - size = string - count = string - tier = string - mount = string - })) - default = [{ - "name" : "sapmnt", - "size" : "300", - "count" : "1", - "tier" : "tier3", - "mount" : "/sapmnt" - }, - { - "name" : "trans", - "size" : "50", - "count" : "1", - "tier" : "tier3", - "mount" : "/usr/trans" - }] -} - -variable "powervs_hana_custom_storage_config" { - description = "Custom File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." - type = list(object({ - name = string - size = string - count = string - tier = string - mount = string - })) - default = [{ - "name" : "", - "size" : "", - "count" : "", - "tier" : "", - "mount" : "" - }] -} - -variable "powervs_hana_additional_storage_config" { - description = "Additional File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." - type = list(object({ - name = string - size = string - count = string - tier = string - mount = string - })) - default = [{ - "name" : "usrsap", - "size" : "50", - "count" : "1", - "tier" : "tier3", - "mount" : "/usr/sap" - - }] -} - -variable "powervs_netweaver_storage_config" { - description = "File systems to be created and attached to PowerVS instance for SAP NetWeaver. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." - type = list(object({ - name = string - size = string - count = string - tier = string - mount = string - })) - default = [ - { - "name" : "usrsap", - "size" : "50", - "count" : "1", - "tier" : "tier3", - "mount" : "/usr/sap" - } - ] -} - -variable "powervs_default_images" { - description = "Default SuSE and Red Hat Linux images to use for SAP HANA and SAP NetWeaver PowerVS instances." - type = object({ - sles_hana_image = string - sles_nw_image = string - rhel_hana_image = string - rhel_nw_image = string - }) - default = { - "sles_hana_image" : "SLES15-SP4-SAP" - "rhel_hana_image" : "RHEL8-SP6-SAP" - "sles_nw_image" : "SLES15-SP4-SAP-NETWEAVER" - "rhel_nw_image" : "RHEL8-SP6-SAP-NETWEAVER" - } -} diff --git a/solutions/sap-ready-to-go/outputs.tf b/solutions/sap-ready-to-go/outputs.tf index 7e92edc4..1fbfa612 100644 --- a/solutions/sap-ready-to-go/outputs.tf +++ b/solutions/sap-ready-to-go/outputs.tf @@ -1,34 +1,34 @@ output "access_host_or_ip" { description = "Public IP of Provided Bastion/JumpServer Host" - value = module.sap_system.access_host_or_ip + value = nonsensitive(var.powervs_instance_init_linux.bastion_host_ip) } output "powervs_hana_instance_ips" { description = "All private IPS of HANA instance" - value = module.sap_system.powervs_hana_instance_ips + value = module.sap_system.pi_hana_instance_ips } output "powervs_hana_instance_management_ip" { description = "Management IP of HANA Instance" - value = module.sap_system.powervs_hana_instance_management_ip + value = module.sap_system.pi_hana_instance_management_ip } output "powervs_netweaver_instance_ips" { description = "All private IPS of NetWeaver instances" - value = module.sap_system.powervs_netweaver_instance_ips + value = module.sap_system.pi_netweaver_instance_ips } output "powervs_netweaver_instance_management_ips" { description = "Management IPS of NetWeaver instances" - value = module.sap_system.powervs_netweaver_instance_management_ips + value = module.sap_system.pi_netweaver_instance_management_ips } output "powervs_share_fs_ips" { description = "Private IPs of the Share FS instance." - value = module.sap_system.powervs_share_fs_ips + value = module.sap_system.pi_sharefs_instance_ips } output "powervs_lpars_data" { description = "All private IPS of PowerVS instances and Jump IP to access the host." - value = module.sap_system.powervs_lpars_data + value = module.sap_system.pi_lpars_data } diff --git a/solutions/sap-ready-to-go/provider.tf b/solutions/sap-ready-to-go/provider.tf new file mode 100644 index 00000000..ffbf0d10 --- /dev/null +++ b/solutions/sap-ready-to-go/provider.tf @@ -0,0 +1,25 @@ +locals { + ibm_powervs_zone_region_map = { + "lon04" = "lon" + "lon06" = "lon" + "eu-de-1" = "eu-de" + "eu-de-2" = "eu-de" + "tor01" = "tor" + "mon01" = "mon" + "osa21" = "osa" + "tok04" = "tok" + "syd04" = "syd" + "syd05" = "syd" + "sao01" = "sao" + "us-south" = "us-south" + "dal10" = "us-south" + "dal12" = "us-south" + "us-east" = "us-east" + } +} + +provider "ibm" { + region = lookup(local.ibm_powervs_zone_region_map, var.powervs_zone, null) + zone = var.powervs_zone + ibmcloud_api_key = var.ibmcloud_api_key != null ? var.ibmcloud_api_key : null +} diff --git a/solutions/sap-ready-to-go/variables.tf b/solutions/sap-ready-to-go/variables.tf index 5a342946..ee6ab8a8 100644 --- a/solutions/sap-ready-to-go/variables.tf +++ b/solutions/sap-ready-to-go/variables.tf @@ -1,3 +1,9 @@ +##################################################### +# +# Required Parameters +# +##################################################### + variable "ibmcloud_api_key" { description = "The IBM Cloud platform API key needed to deploy IAM enabled resources." type = string @@ -9,21 +15,6 @@ variable "powervs_zone" { type = string } -variable "powervs_resource_group_name" { - description = "Existing IBM Cloud resource group name." - type = string -} - -variable "powervs_workspace_name" { - description = "Existing Name of PowerVS workspace." - type = string -} - -variable "powervs_sshkey_name" { - description = "Existing PowerVS SSH Key Name." - type = string -} - variable "prefix" { description = "Unique prefix for resources to be created (e.g., SAP system name). Max length must be less than or equal to 6." type = string @@ -33,169 +24,146 @@ variable "prefix" { } } -variable "ssh_private_key" { - description = "Private SSH key (RSA format) used to login to IBM PowerVS instances. Should match to uploaded public SSH key referenced by 'ssh_public_key' which was created previously. Entered data must be in [heredoc strings format](https://www.terraform.io/language/expressions/strings#heredoc-strings). The key is not uploaded or stored. For more information about SSH keys, see [SSH keys](https://cloud.ibm.com/docs/vpc?topic=vpc-ssh-keys)." +variable "powervs_workspace_guid" { + description = "PowerVS infrastructure workspace guid. The GUID of the resource instance." type = string - sensitive = true } -variable "cloud_connection_count" { - description = "Existing number of Cloud connections to which new subnet must be attached." +variable "powervs_ssh_public_key_name" { + description = "Existing PowerVS SSH Public Key Name." type = string - default = 2 } -variable "additional_networks" { - description = "Existing list of subnets name to be attached to PowerVS instances. First network has to be a management network." - type = list(string) - default = ["mgmt_net", "bkp_net"] +variable "powervs_networks" { + description = "Existing list of subnets to be attached to PowerVS instances. The first element will become the primary interface. Run 'ibmcloud pi networks' to list available private subnets." + type = list( + object({ + name = string + id = string + cidr = optional(string) + }) + ) } variable "powervs_sap_network_cidr" { - description = "Network range for separate SAP network. E.g., '10.53.1.0/24'" + description = "Additional private subnet for SAP communication which will be created. CIDR for SAP network. E.g., '10.53.0.0/24'" type = string - default = "10.53.1.0/24" } -variable "os_image_distro" { - description = "Image distribution to use for all instances(Shared, HANA, Netweaver). OS release versions may be specified in 'var.powervs_default_images' optional parameters below." - type = string - default = "RHEL" - - validation { - condition = (upper(var.os_image_distro) == "RHEL" || upper(var.os_image_distro) == "SLES") - error_message = "Supported values are 'RHEL' or 'SLES' only." - } -} - -##################################################### -# PowerVS Shared FS Instance parameters -##################################################### - -variable "powervs_create_separate_fs_share" { - description = "Deploy separate IBM PowerVS instance(0.5 cpus, 2 GB memory size, shared processor on s922.) as central file system share. All filesystems defined in 'powervs_share_storage_config' optional variable will be NFS exported and mounted on Netweaver PowerVS instances." - type = bool -} - -##################################################### -# PowerVS HANA Instance parameters -##################################################### +variable "powervs_create_sharefs_instance" { + description = "value" + type = object({ + enable = bool + image_id = string + }) -variable "powervs_hana_instance_name" { - description = "SAP HANA hostname (non FQDN). Will get the form of -. Max length of final hostname must be <= 13 characters." - type = string - default = "hana" } -variable "powervs_hana_sap_profile_id" { - description = "SAP HANA profile to use. Must be one of the supported profiles. See [here](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-power-vs). File system sizes are automatically calculated. Override automatic calculation by setting values in optional sap_hana_custom_storage_config parameter." +variable "powervs_hana_instance_image_id" { + description = "Image ID to be used for PowerVS HANA instance. Run 'ibmcloud pi images' to list available images." type = string - default = "ush1-4x256" -} - -##################################################### -# PowerVS NetWeaver Instance parameters -##################################################### - -variable "powervs_netweaver_instance_count" { - description = "Number of SAP NetWeaver instances that should be created." - type = number - default = 1 } -variable "powervs_netweaver_instance_name" { - description = "SAP Netweaver hostname (non FQDN). Will get the form of --. Max length of final hostname must be <= 13 characters." +variable "powervs_netweaver_instance_image_id" { + description = "Image ID to be used for PowerVS Netweaver instance. Run 'ibmcloud pi images' to list available images." type = string - default = "nw" } -variable "powervs_netweaver_cpu_number" { - description = "Number of CPUs for each SAP NetWeaver instance." - type = string - default = "3" +variable "powervs_instance_init_linux" { + description = "Configures a PowerVS linux instance to have internet access by setting proxy on it, updates os and create filesystems using ansible collection [ibm.power_linux_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/). where 'proxy_host_or_ip_port' E.g., 10.10.10.4:3128 , 'bastion_host_ip' is public IP of bastion/jump host to access the private IP of created linux PowerVS instance." + sensitive = true + type = object( + { + enable = bool + bastion_host_ip = string + ssh_private_key = string + proxy_host_or_ip_port = string + no_proxy_hosts = string + } + ) } -variable "powervs_netweaver_memory_size" { - description = "Memory size for each SAP NetWeaver instance." - type = string - default = "32" -} ##################################################### -# PVS SAP instance Initialization +# +# Optional Parameters +# ##################################################### -variable "access_host_or_ip" { - description = "The public IP address or hostname for the access host. The address is used to reach the target or server_host IP address and to configure the DNS, NTP, NFS, and Squid proxy services. Set to null or empty if not configuring OS." - type = string -} - -variable "proxy_host_or_ip_port" { - description = "Proxy hostname or IP address with port. E.g., 10.10.10.4:3128 ." - type = string - - validation { - condition = can(regex("\\b(?:(?:2(?:[0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9])\\.){3}(?:(?:2([0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9]))\\b:[0-9]+", var.proxy_host_or_ip_port)) - error_message = "Proxy hostname or IP address with port. E.g., 10.10.10.4:3128 ." - } -} - -variable "dns_host_or_ip" { - description = "Private IP address of DNS server, resolver or forwarder. Set empty if not configuring OS." - type = string -} - -variable "ntp_host_or_ip" { - description = "Private IP address of NTP time server or forwarder. Set empty if not configuring OS." +variable "cloud_connection_count" { + description = "Existing number of Cloud connections to which new subnet must be attached. Will be ignored in case of PER enabled DC." type = string + default = 2 } -variable "nfs_host_or_ip_path" { - description = "Full path on NFS server (in form :, e.g., '10.20.10.4:/nfs'). Set to empty if not configuring OS." - type = string - - validation { - condition = can(regex("\\b(?:(?:2(?:[0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9])\\.){3}(?:(?:2([0-4][0-9]|5[0-5])|[0-1]?[0-9]?[0-9]))\\b:\\/[A-Za-z0-9]+", var.nfs_host_or_ip_path)) || var.nfs_host_or_ip_path == "" - error_message = "Full path on NFS server (in form :, e.g., '10.20.10.4:/nfs') or it should be empty" +variable "powervs_sharefs_instance" { + description = "Deploy separate IBM PowerVS instance as central file system share. All filesystems defined in 'powervs_sharefs_instance_storage_config' variable will be NFS exported and mounted on Netweaver PowerVS instances if enabled. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." + type = object({ + name = string + processors = string + memory = string + proc_type = string + storage_config = list(object({ + name = string + size = string + count = string + tier = string + mount = string + })) + }) + default = { + name = "share" + processors = "0.5" + memory = "2" + proc_type = "shared" + storage_config = [{ + "name" : "sapmnt", + "size" : "300", + "count" : "1", + "tier" : "tier3", + "mount" : "/sapmnt" + }, + { + "name" : "trans", + "size" : "50", + "count" : "1", + "tier" : "tier3", + "mount" : "/usr/trans" + }] } } -variable "sap_domain" { - description = "SAP domain to be set for entire landscape." - type = string - default = "sap.com" -} - -##################################################### -# Optional Parameters -##################################################### +################################### +# PowerVS HANA Instance parameters +################################### -variable "powervs_share_storage_config" { - description = "File systems to be created and attached to PowerVS instance for shared storage file systems. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." - type = list(object({ - name = string - size = string - count = string - tier = string - mount = string - })) - default = [{ - "name" : "sapmnt", - "size" : "300", - "count" : "1", - "tier" : "tier3", - "mount" : "/sapmnt" - }, - { - "name" : "trans", +variable "powervs_hana_instance" { + description = "SAP HANA hostname (non FQDN) will get the form of -. SAP HANA profile to use. Must be one of the supported profiles. See [here](https://cloud.ibm.com/docs/sap?topic=sap-hana-iaas-offerings-profiles-power-vs). File system sizes are automatically calculated. Override automatic calculation by setting values in optional 'powervs_hana_instance_custom_storage_config' parameter. Additional File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." + type = object({ + name = string + sap_profile_id = string + additional_storage_config = list(object({ + name = string + size = string + count = string + tier = string + mount = string + })) + }) + default = { + name = "hana" + sap_profile_id = "ush1-4x256" + additional_storage_config = [{ + "name" : "usrsap", "size" : "50", "count" : "1", "tier" : "tier3", - "mount" : "/usr/trans" - }] + "mount" : "/usr/sap" + }] + } } -variable "powervs_hana_custom_storage_config" { +variable "powervs_hana_instance_custom_storage_config" { description = "Custom File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." type = list(object({ name = string @@ -213,57 +181,66 @@ variable "powervs_hana_custom_storage_config" { }] } -variable "powervs_hana_additional_storage_config" { - description = "Additional File systems to be created and attached to PowerVS instance for SAP HANA. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." - type = list(object({ - name = string - size = string - count = string - tier = string - mount = string - })) - default = [{ - "name" : "usrsap", - "size" : "50", - "count" : "1", - "tier" : "tier3", - "mount" : "/usr/sap" - - }] -} +######################################## +# PowerVS NetWeaver Instance parameters +######################################## -variable "powervs_netweaver_storage_config" { - description = "File systems to be created and attached to PowerVS instance for SAP NetWeaver. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS." - type = list(object({ - name = string - size = string - count = string - tier = string - mount = string - })) - default = [ - { +variable "powervs_netweaver_instance" { + description = "'instance_count' is number of SAP NetWeaver instances that should be created. 'size' is in GB. 'count' specify over how many storage volumes the file system will be striped. 'tier' specifies the storage tier in PowerVS workspace. 'mount' specifies the target mount point on OS. " + type = object({ + instance_count = number + name = string + processors = string + memory = string + proc_type = string + storage_config = list(object({ + name = string + size = string + count = string + tier = string + mount = string + })) + }) + default = { + instance_count = 1 + name = "nw" + processors = "3" + memory = "32" + proc_type = "shared" + storage_config = [{ "name" : "usrsap", "size" : "50", "count" : "1", "tier" : "tier3", "mount" : "/usr/sap" - } - ] + }] + } } -variable "powervs_default_images" { - description = "Default SuSE and Red Hat Linux images to use for SAP HANA and SAP NetWeaver PowerVS instances." - type = object({ - sles_hana_image = string - sles_nw_image = string - rhel_hana_image = string - rhel_nw_image = string - }) +###################################### +# PVS SAP instance Network Services +###################################### + +variable "sap_network_services_config" { + description = "Configures network services NTP, NFS and DNS on PowerVS instance. Requires 'powervs_instance_init_linux' to be specified as internet access is required to download ansible collection [ibm.power_linux_sap collection](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/) to configure these services." + type = object( + { + nfs = object({ enable = bool, nfs_server_path = string, nfs_client_path = string }) + dns = object({ enable = bool, dns_server_ip = string }) + ntp = object({ enable = bool, ntp_server_ip = string }) + } + ) + default = { - "sles_hana_image" : "SLES15-SP4-SAP" - "rhel_hana_image" : "RHEL8-SP6-SAP" - "sles_nw_image" : "SLES15-SP4-SAP-NETWEAVER" - "rhel_nw_image" : "RHEL8-SP6-SAP-NETWEAVER" + nfs = { enable = false, nfs_server_path = "", nfs_client_path = "" } + dns = { enable = false, dns_server_ip = "" } + ntp = { enable = false, ntp_server_ip = "" } } + +} + +variable "sap_domain" { + description = "SAP domain to be set for entire landscape." + type = string + default = "sap.com" } diff --git a/tests/go.mod b/tests/go.mod index 3bb9abc4..5f3cb4ac 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -5,6 +5,7 @@ go 1.21 toolchain go1.21.3 require ( + github.com/gruntwork-io/terratest v0.46.1 github.com/stretchr/testify v1.8.4 github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper v1.23.14 ) @@ -59,7 +60,6 @@ require ( github.com/google/uuid v1.3.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.4 // indirect github.com/googleapis/gax-go/v2 v2.11.0 // indirect - github.com/gruntwork-io/terratest v0.46.1 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-getter v1.7.1 // indirect diff --git a/tests/pr_test.go b/tests/pr_test.go index dea5448a..444ec97a 100644 --- a/tests/pr_test.go +++ b/tests/pr_test.go @@ -2,63 +2,87 @@ package test import ( + "os" + "strings" "testing" + "github.com/gruntwork-io/terratest/modules/ssh" "github.com/stretchr/testify/assert" + "github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/cloudinfo" "github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testhelper" ) // Use existing resource group const resourceGroup = "geretain-test-resources" -const defaultExampleTerraformDir = "solutions/basic" +const defaultExampleTerraformDir = "solutions/e2e" + +var sharedInfoSvc *cloudinfo.CloudInfoService + +// TestMain will be run before any parallel tests, used to set up a shared InfoService object to track region usage +// for multiple tests + +func TestMain(m *testing.M) { + sharedInfoSvc, _ = cloudinfo.NewCloudInfoServiceFromEnv("TF_VAR_ibmcloud_api_key", cloudinfo.CloudInfoServiceOptions{}) + + // creating ssh keys + tSsh := new(testing.T) + rsaKeyPair, _ := ssh.GenerateRSAKeyPairE(tSsh, 4096) + sshPublicKey := strings.TrimSuffix(rsaKeyPair.PublicKey, "\n") // removing trailing new lines + sshPrivateKey := "<