Skip to content

terraform-ibm-modules/terraform-ibm-powervs-instance

Repository files navigation

IBM Power Virtual Server instance module

Graduated (Supported) semantic-release pre-commit latest release Renovate enabled

Overview

Summary

This root module automates and provisions an IBM® Power Virtual Server instance with following components:

  • Creates an IBM® Power Virtual Server Instance.
  • Attaches existing private subnets to the instance.
  • Optionally creates volumes and attaches it to the instance.
  • Optionally attaches existing volume ids to the instance.
  • Optional instance initialization for ibm provided subscription linux images only ( configures proxy settings, creates filesystems, connects to network management services like DNS, NTP and NFS) using ansible galaxy collection roles ibm.power_linux_sap collection. Tested with RHEL8.4, RHEL 8.6, RHEL8.8, RHEL9.2, SLES15-SP4 and SLES15-SP5 images.

For more information about IBM Power Virtual Server see the getting started IBM Cloud docs.

terraform-ibm-powervs-instance

Usage

provider "ibm" {
  region           = var.pi_region
  zone             = var.pi_zone
  ibmcloud_api_key = var.ibmcloud_api_key != null ? var.ibmcloud_api_key : null
}

module "pi_instance" {
    source     = "terraform-ibm-modules/powervs-instance/ibm"
    version    = "x.x.x" # Replace "x.x.x" with a GIT release version to lock into a specific release

    pi_workspace_guid          = var.pi_workspace_guid
    pi_ssh_public_key_name     = var.pi_ssh_public_key_name
    pi_image_id                = var.pi_image_id
    pi_networks                = var.pi_networks
    pi_instance_name           = var.pi_instance_name
    pi_sap_profile_id          = var.pi_sap_profile_id           #(optional, default null)
    pi_server_type             = var.pi_server_type              #(optional, default null)
    pi_number_of_processors    = var.pi_number_of_processors     #(optional, default null)
    pi_memory_size             = var.pi_memory_size              #(optional, default null)
    pi_cpu_proc_type           = var.pi_cpu_proc_type            #(optional, default check vars)
    pi_boot_image_storage_pool = vat.pi_boot_image_storage_pool  #(optional, default null)
    pi_boot_image_storage_tier = var.pi_boot_image_storage_tier  #(optional, default null)
    pi_replicants              = var.pi_replicants               #(optional, default null)
    pi_placement_group_id      = var.pi_placement_group_id       #(optional, default null)
    pi_existing_volume_ids     = var.pi_existing_volume_ids      #(optional, default null)
    pi_storage_config          = var.pi_storage_config           #(optional, default check vars)
    pi_instance_init_linux     = var.pi_instance_init_linux      #(optional, default check vars)
    pi_network_services_config = var.pi_network_services_config  #(optional, default check vars)
}

Required IAM access policies

You need the following permissions to run this module.

  • Account Management
    • Resource Group service
      • Viewer platform access
    • IAM Services
      • Workspace for Power Virtual Server service
      • Power Virtual Server service
        • Editor platform access
      • VPC Infrastructure Services service
        • Editor platform access
      • Transit Gateway service
        • Editor platform access
      • Direct Link service
        • Editor platform access

Requirements

Name Version
terraform >= 1.3
ibm >=1.67.0

Modules

Name Source Version
pi_instance ./modules/pi-instance n/a
pi_instance_init_linux ./modules/ansible n/a

Resources

No resources.

Inputs

Name Description Type Default Required
pi_boot_image_storage_pool Storage Pool for server deployment; Only valid when you deploy one of the IBM supplied stock images. Storage pool for a custom image (an imported image or an image that is created from a VM capture) defaults to the storage pool the image was created in. string null no
pi_boot_image_storage_tier Storage type for server deployment. If storage type is not provided the storage type will default to tier3. Possible values tier0, tier1 and tier3 string null no
pi_cpu_proc_type Dedicated or shared processors. Required when not creating SAP instances. Conflicts with 'pi_sap_profile_id'. string null no
pi_existing_volume_ids List of existing volume ids that must be attached to the instance. list(string) null no
pi_image_id Image ID used for PowerVS instance. Run 'ibmcloud pi images' to list available images. string n/a yes
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 where 'bastion_host_ip' is public IP of bastion/jump host to access the 'ansible_host_or_ip' private IP of ansible node. This ansible host must have access to the power virtual server instance and ansible host OS must be RHEL distribution.
object(
{
enable = bool
bastion_host_ip = string
ansible_host_or_ip = string
ssh_private_key = string
}
)
{
"ansible_host_or_ip": "",
"bastion_host_ip": "",
"enable": false,
"ssh_private_key": ""
}
no
pi_instance_name Name of instance which will be created. string n/a yes
pi_memory_size Amount of memory. Required when not creating SAP instances. Conflicts with 'pi_sap_profile_id'. string null no
pi_network_services_config Configures network services proxy, NTP, NFS and DNS on PowerVS instance. Requires 'pi_instance_init_linux' to be specified to configure these services. The 'opts' attribute can take in comma separated values.
object(
{
squid = object({ enable = bool, squid_server_ip_port = string, no_proxy_hosts = string })
nfs = object({ enable = bool, nfs_server_path = string, nfs_client_path = string, opts = string, fstype = 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,
"fstype": "",
"nfs_client_path": "",
"nfs_server_path": "",
"opts": ""
},
"ntp": {
"enable": false,
"ntp_server_ip": ""
},
"squid": {
"enable": false,
"no_proxy_hosts": "",
"squid_server_ip_port": ""
}
}
no
pi_networks Existing list of private subnet ids to be attached to an instance. 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_number_of_processors Number of processors. Required when not creating SAP instances. Conflicts with 'pi_sap_profile_id'. string null no
pi_placement_group_id The ID of the placement group that the instance is in or empty quotes '' to indicate it is not in a placement group. pi_replicants cannot be used when specifying a placement group ID. string null no
pi_replicants The number of instances that you want to provision with the same configuration. If this parameter is not set, 1 is used by default. The replication policy that you want to use, either affinity, anti-affinity or none. If this parameter is not set, none is used by default. pi_placement_group_id cannot be used when specifying pi_replicants
object({
count = number
policy = string
})
null no
pi_sap_profile_id SAP HANA profile to use. Must be one of the supported profiles. See here. If this is mentioned then pi_server_type, pi_cpu_proc_type, pi_number_of_processors and pi_memory_size will not be taken into account. string null no
pi_server_type Processor type e980/s922/e1080/s1022. Required when not creating SAP instances. Conflicts with 'pi_sap_profile_id'. string null no
pi_ssh_public_key_name Existing PowerVS SSH Public key name. Run 'ibmcloud pi keys' to list available keys. string n/a yes
pi_storage_config File systems to be created and attached to PowerVS instance. '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 mount point on the OS.
list(object({
name = string
size = string
count = string
tier = string
mount = string
pool = optional(string)
}))
null no
pi_workspace_guid Existing GUID of the PowerVS workspace. The GUID of the service instance associated with an account. string n/a yes

Outputs

Name Description
pi_instance_id he unique identifier of the instance. The ID is composed of <power_instance_id>/<instance_id>.
pi_instance_instance_id The unique identifier of PowerVS instance.
pi_instance_name Name of PowerVS instance.
pi_instance_primary_ip IP address of the primary network interface of IBM PowerVS instance.
pi_instance_private_ips All private IP addresses (as a list) of IBM PowerVS instance.
pi_storage_configuration Storage configuration of PowerVS instance.

Contributing

You can report issues and request features for this module in GitHub issues in the module repo. See Report an issue or request a feature.

To set up your local development environment, see Local development setup in the project documentation.