diff --git a/modules/sap_maxdb/README.md b/modules/sap_maxdb/README.md deleted file mode 100644 index d9c28fd8..00000000 --- a/modules/sap_maxdb/README.md +++ /dev/null @@ -1,40 +0,0 @@ -TODO add README info - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| can\_ip\_forward | Whether sending and receiving of packets with non-matching source or destination IPs is allowed. | `bool` | `true` | no | -| custom\_metadata | Optional - default is empty. Custom metadata to be added to the VM. | `map(string)` | `{}` | no | -| instance\_name | Hostname of the GCE instance | `string` | n/a | yes | -| linux\_image | Linux image name to use. family/sles-12-sp2-sap or family/sles-12-sp2-sap will use the latest SLES 12 SP2 or SP3 image | `string` | n/a | yes | -| linux\_image\_project | The project which the Linux image belongs to | `string` | n/a | yes | -| machine\_type | Machine type to deploy | `string` | n/a | yes | -| maxdb\_backup\_size | OPTIONAL - Size of the /maxdbbackup volume. If set to 0, no disk will be created | `number` | `0` | no | -| maxdb\_data\_size | Size of /sapdb/[DBSID]/sapdata - Which holds the database data files | `number` | `30` | no | -| maxdb\_data\_ssd | SSD toggle for the data drive. If set to true, the data disk will be SSD | `bool` | `true` | no | -| maxdb\_log\_size | Size of /sapdb/[DBSID]/saplog - Which holds the database transaction logs | `number` | `8` | no | -| maxdb\_log\_ssd | SSD toggle for the log drive. If set to true, the log disk will be SSD | `bool` | `true` | no | -| maxdb\_root\_size | Size of /sapdb - the root directory of the database instance | `number` | `8` | no | -| maxdb\_sid | The database instance/SID name | `string` | n/a | yes | -| network\_tags | OPTIONAL - Network tags can be associated to your instance on deployment. This can be used for firewalling or routing purposes | `list(string)` | `[]` | no | -| post\_deployment\_script | OPTIONAL - gs:// or https:// location of a script to execute on the created VM's post deployment | `string` | `""` | no | -| primary\_startup\_url | Startup script to be executed when the VM boots, should not be overridden | `string` | `"curl -s https://storage.googleapis.com/cloudsapdeploy/terraform/latest/terraform/sap_maxdb/startup.sh | bash -x -s https://storage.googleapis.com/cloudsapdeploy/terraform/latest/terraform"` | no | -| project\_id | Project id where the instances will be created | `string` | n/a | yes | -| public\_ip | OPTIONAL - Defines whether a public IP address should be added to your VM. By default this is set to Yes. Note that if you set this to No without appropriate network nat and tags in place, there will be no route to the internet and thus the installation will fail | `bool` | `true` | no | -| reservation\_name | Use a reservation specified by RESERVATION\_NAME.
By default ANY\_RESERVATION is used when this variable is empty.
In order for a reservation to be used it must be created with the
"Select specific reservation" selected (specificReservationRequired set to true)
Be sure to create your reservation with the correct Min CPU Platform for the
following instance types:
n1-highmem-32 : Intel Broadwell
n1-highmem-64 : Intel Broadwell
n1-highmem-96 : Intel Skylake
n1-megamem-96 : Intel Skylake
m1-megamem-96 : Intel Skylake
All other instance types can have automatic Min CPU Platform" | `string` | `""` | no | -| sap\_deployment\_debug | OPTIONAL - If this value is set to anything, the deployment will generates verbose deployment logs. Only turn this setting on if a Google support engineer asks you to enable debugging | `bool` | `false` | no | -| sap\_mnt\_size | OPTIONAL - Only required if you plan on deploying SAP NetWeaver on the same VM as the ase database instance. If set to 0, no disk will be created | `number` | `0` | no | -| service\_account | OPTIONAL - Ability to define a custom service account instead of using the default project service account | `string` | `""` | no | -| subnetwork | The sub network to deploy the instance in | `string` | n/a | yes | -| swap\_size | OPTIONAL - Only required if you plan on deploying SAP NetWeaver on the same VM as the ase database instance. If set to 0, no disk will be created | `number` | `0` | no | -| usr\_sap\_size | OPTIONAL - Only required if you plan on deploying SAP NetWeaver on the same VM as the ase database instance. If set to 0, no disk will be created | `number` | `0` | no | -| zone | Zone to create the resources in | `string` | n/a | yes | - -## Outputs - -| Name | Description | -|------|-------------| -| sap\_maxdb\_self\_link | SAP MaxDB self-link for instance created | - - diff --git a/modules/sap_maxdb/main.tf b/modules/sap_maxdb/main.tf deleted file mode 100644 index a4d6ce56..00000000 --- a/modules/sap_maxdb/main.tf +++ /dev/null @@ -1,198 +0,0 @@ -# -# Terraform SAP Max DB for Google Cloud -# -# Version: DATETIME_OF_BUILD -# - -################################################################################ -# Local variables -################################################################################ -locals { - zone_split = split("-", var.zone) - shared_vpc = split("/", var.subnetwork) - subnetwork = length(local.shared_vpc) > 1 ? ( - "https://www.googleapis.com/compute/v1/projects/${local.shared_vpc[0]}/regions/${local.region}/subnetworks/${local.shared_vpc[1]}") : ( - "https://www.googleapis.com/compute/v1/projects/${var.project_id}/regions/${local.region}/subnetworks/${var.subnetwork}") - region = "${local.zone_split[0]}-${local.zone_split[1]}" - max_data_disk_type = var.maxdb_data_ssd ? "pd-ssd" : "pd-balanced" - max_log_disk_type = var.maxdb_log_ssd ? "pd-ssd" : "pd-balanced" - primary_startup_url = var.sap_deployment_debug ? replace(var.primary_startup_url, "bash -s", "bash -x -s") : var.primary_startup_url -} - -################################################################################ -# disks -################################################################################ -# boot -resource "google_compute_disk" "max_db_boot_disk" { - name = "${var.instance_name}-boot" - type = "pd-balanced" - size = 30 # GB - zone = var.zone - project = var.project_id - image = "${var.linux_image_project}/${var.linux_image}" -} - -# /sapdb -resource "google_compute_disk" "max_db_root_disk" { - name = "${var.instance_name}-maxdbroot" - type = "pd-balanced" - size = var.maxdb_root_size - zone = var.zone - project = var.project_id -} - -# /sapdb/SID/saplog -resource "google_compute_disk" "max_db_log_disk" { - name = "${var.instance_name}-maxdblog" - type = local.max_log_disk_type - size = var.maxdb_log_size - zone = var.zone - project = var.project_id -} - -# /sapdb/SID/sapdata -resource "google_compute_disk" "max_db_data_disk" { - name = "${var.instance_name}-maxdbdata" - type = local.max_data_disk_type - size = var.maxdb_data_size - zone = var.zone - project = var.project_id -} - -# /maxdbbackup -resource "google_compute_disk" "max_db_backup_disk" { - name = "${var.instance_name}-maxdbbackup" - type = "pd-balanced" - size = var.maxdb_backup_size - zone = var.zone - project = var.project_id -} - -# OPTIONAL - /usr/sap -resource "google_compute_disk" "max_db_usr_disk" { - count = var.usr_sap_size > 0 ? 1 : 0 - name = "${var.instance_name}-usrsap" - type = "pd-balanced" - size = var.usr_sap_size - zone = var.zone - project = var.project_id -} - -# OPTIONAL - /sapmnt -resource "google_compute_disk" "max_db_sapmnt" { - count = var.sap_mnt_size > 0 ? 1 : 0 - name = "${var.instance_name}-sapmnt" - type = "pd-balanced" - size = var.sap_mnt_size - zone = var.zone - project = var.project_id -} - -# OPTIONAL - swap disk -resource "google_compute_disk" "max_db_swap" { - count = var.swap_size > 0 ? 1 : 0 - name = "${var.instance_name}-swap" - type = "pd-balanced" - size = var.swap_size - zone = var.zone - project = var.project_id -} - -################################################################################ -# instances -################################################################################ -resource "google_compute_instance" "sap_maxdb" { - name = var.instance_name - zone = var.zone - project = var.project_id - machine_type = var.machine_type - min_cpu_platform = "Automatic" - boot_disk { - auto_delete = true - device_name = "boot" - source = google_compute_disk.max_db_boot_disk.self_link - } - - attached_disk { - device_name = google_compute_disk.max_db_root_disk.name - source = google_compute_disk.max_db_root_disk.self_link - } - - attached_disk { - device_name = google_compute_disk.max_db_log_disk.name - source = google_compute_disk.max_db_log_disk.self_link - } - - attached_disk { - device_name = google_compute_disk.max_db_data_disk.name - source = google_compute_disk.max_db_data_disk.self_link - } - - attached_disk { - device_name = google_compute_disk.max_db_backup_disk.name - source = google_compute_disk.max_db_backup_disk.self_link - } - - dynamic "attached_disk" { - for_each = var.usr_sap_size > 0 ? [1] : [] - content { - device_name = google_compute_disk.max_db_usr_disk.name - source = google_compute_disk.max_db_usr_disk.self_link - } - } - dynamic "attached_disk" { - for_each = var.sap_mnt_size > 0 ? [1] : [] - content { - device_name = google_compute_disk.max_db_sapmnt.name - source = google_compute_disk.max_db_sapmnt.self_link - } - } - dynamic "attached_disk" { - for_each = var.swap_size > 0 ? [1] : [] - content { - device_name = google_compute_disk.max_db_swap.name - source = google_compute_disk.max_db_swap.self_link - } - } - can_ip_forward = var.can_ip_forward - network_interface { - subnetwork = local.subnetwork - # we only include access_config if public_ip is true, an empty access_config - # will create an ephemeral public ip - dynamic "access_config" { - for_each = var.public_ip ? [1] : [] - content { - } - } - } - tags = var.network_tags - service_account { - # An empty string service account will default to the projects default compute engine service account - email = var.service_account - scopes = [ - "https://www.googleapis.com/auth/cloud-platform" - ] - } - dynamic "reservation_affinity" { - for_each = length(var.reservation_name) > 1 ? [1] : [] - content { - type = "SPECIFIC_RESERVATION" - specific_reservation { - key = "compute.googleapis.com/reservation-name" - values = [var.reservation_name] - } - } - } - metadata = merge(var.custom_metadata, { - startup-script = local.primary_startup_url - post_deployment_script = var.post_deployment_script - sap_deployment_debug = var.sap_deployment_debug - maxdb_sid = var.maxdb_sid - template-type = "TERRAFORM" - }) - - lifecycle { - # Ignore changes in the instance metadata, since it is modified by the SAP startup script. - ignore_changes = [metadata] - } -} diff --git a/modules/sap_maxdb/outputs.tf b/modules/sap_maxdb/outputs.tf deleted file mode 100644 index 2a5e505f..00000000 --- a/modules/sap_maxdb/outputs.tf +++ /dev/null @@ -1,4 +0,0 @@ -output "sap_maxdb_self_link" { - description = "SAP MaxDB self-link for instance created" - value = google_compute_instance.sap_maxdb.self_link -} diff --git a/modules/sap_maxdb/variables.tf b/modules/sap_maxdb/variables.tf deleted file mode 100644 index 611779ba..00000000 --- a/modules/sap_maxdb/variables.tf +++ /dev/null @@ -1,180 +0,0 @@ - -variable "project_id" { - type = string - description = "Project id where the instances will be created" -} - -variable "zone" { - description = "Zone to create the resources in" - type = string -} - -variable "instance_name" { - description = "Hostname of the GCE instance" - type = string -} - -variable "machine_type" { - description = "Machine type to deploy" - type = string -} - -variable "subnetwork" { - description = "The sub network to deploy the instance in" - type = string -} - -variable "linux_image" { - description = "Linux image name to use. family/sles-12-sp2-sap or family/sles-12-sp2-sap will use the latest SLES 12 SP2 or SP3 image" - type = string -} - -variable "linux_image_project" { - description = "The project which the Linux image belongs to" - type = string -} - -variable "maxdb_sid" { - description = "The database instance/SID name" - type = string - validation { - condition = length(var.maxdb_sid) == 3 && can(regex("^([A-Z][A-Z0-9][A-Z0-9])", var.maxdb_sid)) - error_message = "The maxdb_sid must have a length of 3 and match the regex: '([A-Z][A-Z0-9][A-Z0-9])'." - } -} - -variable "maxdb_root_size" { - description = "Size of /sapdb - the root directory of the database instance" - type = number - default = 8 - validation { - condition = var.maxdb_root_size >= 8 - error_message = "The variable maxdb_root_size must be 8 or larger." - } -} - -variable "maxdb_data_size" { - description = "Size of /sapdb/[DBSID]/sapdata - Which holds the database data files" - type = number - default = 30 - validation { - condition = var.maxdb_data_size >= 30 - error_message = "The variable maxdb_data_size must be 30 or larger." - } -} - -variable "maxdb_log_size" { - description = "Size of /sapdb/[DBSID]/saplog - Which holds the database transaction logs" - type = number - default = 8 - validation { - condition = var.maxdb_log_size >= 8 - error_message = "The variable maxdb_log_size must be 8 or larger." - } -} - -variable "maxdb_data_ssd" { - description = "SSD toggle for the data drive. If set to true, the data disk will be SSD" - type = bool - default = true -} - -variable "maxdb_log_ssd" { - description = "SSD toggle for the log drive. If set to true, the log disk will be SSD" - type = bool - default = true -} - -variable "maxdb_backup_size" { - description = "OPTIONAL - Size of the /maxdbbackup volume. If set to 0, no disk will be created" - type = number - default = 0 -} - -variable "usr_sap_size" { - description = "OPTIONAL - Only required if you plan on deploying SAP NetWeaver on the same VM as the ase database instance. If set to 0, no disk will be created" - type = number - default = 0 -} - -variable "sap_mnt_size" { - description = "OPTIONAL - Only required if you plan on deploying SAP NetWeaver on the same VM as the ase database instance. If set to 0, no disk will be created" - type = number - default = 0 -} - -variable "swap_size" { - description = "OPTIONAL - Only required if you plan on deploying SAP NetWeaver on the same VM as the ase database instance. If set to 0, no disk will be created" - type = number - default = 0 -} - -variable "network_tags" { - description = "OPTIONAL - Network tags can be associated to your instance on deployment. This can be used for firewalling or routing purposes" - type = list(string) - default = [] -} - -variable "public_ip" { - description = "OPTIONAL - Defines whether a public IP address should be added to your VM. By default this is set to Yes. Note that if you set this to No without appropriate network nat and tags in place, there will be no route to the internet and thus the installation will fail" - type = bool - default = true -} - -variable "sap_deployment_debug" { - description = "OPTIONAL - If this value is set to anything, the deployment will generates verbose deployment logs. Only turn this setting on if a Google support engineer asks you to enable debugging" - type = bool - default = false -} - -variable "post_deployment_script" { - description = "OPTIONAL - gs:// or https:// location of a script to execute on the created VM's post deployment" - type = string - default = "" -} - -variable "primary_startup_url" { - description = "Startup script to be executed when the VM boots, should not be overridden" - type = string - default = "curl -s https://storage.googleapis.com/cloudsapdeploy/terraform/latest/terraform/sap_maxdb/startup.sh | bash -x -s https://storage.googleapis.com/cloudsapdeploy/terraform/latest/terraform" -} - -variable "service_account" { - description = "OPTIONAL - Ability to define a custom service account instead of using the default project service account" - type = string - default = "" -} - -variable "reservation_name" { - type = string - description = <<-EOT - Use a reservation specified by RESERVATION_NAME. - By default ANY_RESERVATION is used when this variable is empty. - In order for a reservation to be used it must be created with the - "Select specific reservation" selected (specificReservationRequired set to true) - Be sure to create your reservation with the correct Min CPU Platform for the - following instance types: - n1-highmem-32 : Intel Broadwell - n1-highmem-64 : Intel Broadwell - n1-highmem-96 : Intel Skylake - n1-megamem-96 : Intel Skylake - m1-megamem-96 : Intel Skylake - All other instance types can have automatic Min CPU Platform" - EOT - default = "" -} - -# -# DO NOT MODIFY unless you know what you are doing -# -variable "can_ip_forward" { - type = bool - description = "Whether sending and receiving of packets with non-matching source or destination IPs is allowed." - default = true -} - -variable "custom_metadata" { - type = map(string) - description = "Optional - default is empty. Custom metadata to be added to the VM." - default = {} -} diff --git a/modules/sap_maxdb/versions.tf b/modules/sap_maxdb/versions.tf deleted file mode 100644 index f839869f..00000000 --- a/modules/sap_maxdb/versions.tf +++ /dev/null @@ -1,9 +0,0 @@ -terraform { - required_version = ">=0.12.6" - required_providers { - google = { - source = "hashicorp/google" - version = ">= 4.0.0, < 6" - } - } -}