An open API service indexing awesome lists of open source software.

https://github.com/terraform-ibm-modules/terraform-ibm-powervs-instance

Creates and configures Power Virtual Server instance
https://github.com/terraform-ibm-modules/terraform-ibm-powervs-instance

ansible linux powervs-instance powervs-workspace terraform

Last synced: about 1 month ago
JSON representation

Creates and configures Power Virtual Server instance

Awesome Lists containing this project

README

        

# IBM Power Virtual Server instance module

[![Graduated (Supported)](https://img.shields.io/badge/status-Graduated%20(Supported)-brightgreen?style=plastic)](https://terraform-ibm-modules.github.io/documentation/#/badge-status)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![latest release](https://img.shields.io/github/v/release/terraform-ibm-modules/terraform-ibm-powervs-instance?logo=GitHub&sort=semver)](https://github.com/terraform-ibm-modules/terraform-ibm-powervs-instance/releases/latest)
[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://renovatebot.com/)

## Overview
* [terraform-ibm-powervs-instance](#terraform-ibm-powervs-instance)
* [Submodules](./modules)
* [pi-instance](./modules/pi-instance)
* [Examples](./examples)
* [Basic Power Virtual Server infrastructure with a Power Virtual Server instance](./examples/basic)
* [Basic Power Virtual Server instance with linux OS initialization](./examples/single-instance-linux)
* [Contributing](#contributing)

## 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](https://galaxy.ansible.com/ui/repo/published/ibm/power_linux_sap/). Tested with RHEL8.4, RHEL 8.6, RHEL8.8, RHEL9.2, RHEL9.4, SLES15-SP4, SLES15-SP5, SLES15-SP6 images.

For more information about IBM Power Virtual Server see the [getting started](https://cloud.ibm.com/docs/power-iaas?topic=power-iaas-getting-started) IBM Cloud docs.

## terraform-ibm-powervs-instance

### Usage

```hcl
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_affinity_policy = var.pi_affinity_policy #(optional, default null)
pi_affinity = var.pi_affinity #(optional, default check vars)
pi_anti_affinity = var.pi_anti_affinity #(optional, default check vars)
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)
pi_user_tags = var.pi_user_tags #(optional, default null)
pi_user_data = var.pi_user_data #(optional, default null)
ansible_vault_password = var.ansible_vault_password #(optional, default null)
}
```

## 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](#requirement\_terraform) | >= 1.9.0 |
| [ibm](#requirement\_ibm) | >= 1.71.3 |

### Modules

| Name | Source | Version |
|------|--------|---------|
| [pi\_instance](#module\_pi\_instance) | ./modules/pi-instance | n/a |
| [pi\_instance\_init\_linux](#module\_pi\_instance\_init\_linux) | ./modules/ansible | n/a |

### Resources

No resources.

### Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [ansible\_vault\_password](#input\_ansible\_vault\_password) | Vault password to encrypt OS registration parameters. Only required with customer provided linux subscription (specified in pi\_instance\_init\_linux.custom\_os\_registration). Password requirements: 15-100 characters and at least one uppercase letter, one lowercase letter, one number, and one special character. Allowed characters: A-Z, a-z, 0-9, !#$%&()*+-.:;<=>?@[]\_{\|}~. | `string` | `null` | no |
| [pi\_affinity](#input\_pi\_affinity) | Defines affinity settings for instances or volumes. If requesting affinity, set this object with either one of 'affinity\_instance' or 'affinity\_volume'. Otherwise value must be null. 'affinity\_instance' specifies the name of the target PVM instance, while 'affinity\_volume' designates a volume to establish storage affinity. |

object({
affinity_instance = optional(string)
affinity_volume = optional(string)
})
| `null` | no |
| [pi\_affinity\_policy](#input\_pi\_affinity\_policy) | Specifies the affinity policy for the PVM instance. Allowed values: 'affinity' or 'anti-affinity'. If set to 'affinity', provide the 'pi\_affinity' input. If set to 'anti-affinity', provide the 'pi\_anti\_affinity' input. This policy will be ignored if 'pi\_boot\_image\_storage\_pool' is specified. | `string` | `null` | no |
| [pi\_anti\_affinity](#input\_pi\_anti\_affinity) | Defines anti-affinity settings for instances or volumes. If requesting anti-affinity, set this object with either one of 'anti\_affinity\_instances' or 'anti\_affinity\_volumes'. Otherwise value must be null. 'anti\_affinity\_instances' is a list of PVM instance names to enforce anti-affinity, while 'anti\_affinity\_volumes' is a list of volumes to apply the storage anti-affinity policy. |
object({
anti_affinity_instances = optional(list(string))
anti_affinity_volumes = optional(list(string))
})
| `null` | no |
| [pi\_boot\_image\_storage\_pool](#input\_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](#input\_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](#input\_pi\_cpu\_proc\_type) | The type of processor mode in which the VM will run with shared, capped or dedicated. Required when not creating SAP instances. Conflicts with 'pi\_sap\_profile\_id'. | `string` | `null` | no |
| [pi\_existing\_volume\_ids](#input\_pi\_existing\_volume\_ids) | List of existing volume ids that must be attached to the instance. | `list(string)` | `null` | no |
| [pi\_image\_id](#input\_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](#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 'bastion\_host\_ip' is public IP of bastion/jump host to access the 'ansible\_host\_or\_ip' private IP of ansible node. Additionally, specify whether IBM provided or customer provided linux subscription should be used. For IBM provided subscription leave custom\_os\_registration empty. For customer provided subscription set a username and a password inside custom\_os\_registration. Customer provided linux subscription requires the use of either an IBM provided image ending in BYOL or a custom image. The 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
custom_os_registration = optional(object({
username = string
password = string
}))
}
)
|
{
"ansible_host_or_ip": "",
"bastion_host_ip": "",
"enable": false,
"ssh_private_key": ""
}
| no |
| [pi\_instance\_name](#input\_pi\_instance\_name) | Name of instance which will be created. | `string` | n/a | yes |
| [pi\_memory\_size](#input\_pi\_memory\_size) | The amount of memory that you want to assign to your instance in GB. Required when not creating SAP instances. Conflicts with 'pi\_sap\_profile\_id'. | `string` | `null` | no |
| [pi\_network\_services\_config](#input\_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](#input\_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)
ip = optional(string)
})
)
| n/a | yes |
| [pi\_number\_of\_processors](#input\_pi\_number\_of\_processors) | The number of vCPUs to assign to the VM as visible within the guest Operating System. Required when not creating SAP instances. Conflicts with 'pi\_sap\_profile\_id'. | `string` | `null` | no |
| [pi\_placement\_group\_id](#input\_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](#input\_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](#input\_pi\_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). 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](#input\_pi\_server\_type) | The type of system on which to create the VM. Supported values are e980/s922/e1080/s1022. Required when not creating SAP instances. Conflicts with 'pi\_sap\_profile\_id'. | `string` | `null` | no |
| [pi\_ssh\_public\_key\_name](#input\_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](#input\_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. 'pool' specifies the volume pool where the volume will be created. 'sharable' specifies if volume can be shared across PVM instances. |
list(object({
name = string
size = string
count = string
tier = string
mount = string
pool = optional(string)
sharable = optional(bool)
}))
| `null` | no |
| [pi\_user\_data](#input\_pi\_user\_data) | The user data cloud-init to pass to the instance during creation. It can be a base64 encoded or an unencoded string. If it is an unencoded string, the provider will encode it before it passing it down. | `string` | `null` | no |
| [pi\_user\_tags](#input\_pi\_user\_tags) | List of Tag names for IBM Cloud PowerVS instance and volumes. Can be set to null. | `list(string)` | `null` | no |
| [pi\_workspace\_guid](#input\_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](#output\_pi\_instance\_id) | he unique identifier of the instance. The ID is composed of /. |
| [pi\_instance\_instance\_id](#output\_pi\_instance\_instance\_id) | The unique identifier of PowerVS instance. |
| [pi\_instance\_name](#output\_pi\_instance\_name) | Name of PowerVS instance. |
| [pi\_instance\_primary\_ip](#output\_pi\_instance\_primary\_ip) | IP address of the primary network interface of IBM PowerVS instance. |
| [pi\_instance\_private\_ips](#output\_pi\_instance\_private\_ips) | All private IP addresses (as a list) of IBM PowerVS instance. |
| [pi\_storage\_configuration](#output\_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](https://github.com/terraform-ibm-modules/.github/blob/main/.github/SUPPORT.md).

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.