A simple Terraform configuration to quickly deploy IBM PowerVS instances for development and experimentation.
- Terraform >= 1.0
- IBM Cloud account with PowerVS service access
- IBM Cloud API Key (Create one here)
- SSH key pair for instance access
ssh-keygen -t ed25519 -f ./power_vsThis creates two files:
power_vs(private key - keep secure!)power_vs.pub(public key - used by Terraform)
Copy the example configuration:
cp terraform.tfvars.example terraform.tfvarsEdit terraform.tfvars and set your values:
ibm_cloud_api_key = "your-api-key-here"
pi_ssh_key_path = "./power_vs.pub"
pi_instance_name = "my-dev-instance"Initialize Terraform:
terraform initReview the deployment plan:
terraform planDeploy the infrastructure:
terraform applyType yes when prompted to confirm.
After deployment completes, Terraform will output connection details:
# View all outputs
terraform output
# Get SSH command
terraform output ssh_commandConnect using:
ssh -i ./power_vs root@<instance-ip>| Variable | Description | Default | Options |
|---|---|---|---|
pi_memory |
Memory in GB | 8 |
Min: 2, Max: depends on system type |
pi_processors |
vCPUs | 0.25 |
0.25, 0.5, 1, 2, 4, 8, etc. |
See IBM PowerVS Compute options for more information on the available system types.
| Type | Description | Use Case |
|---|---|---|
s922 |
POWER9 (9009-22A) | Great for testing (default) |
s1022 |
POWER10 (9105-22A) | General purpose |
s1122 |
POWER11 (9824-22A) | Latest generation |
e980 |
Enterprise POWER9 (9080-M9S) | Enterprise workloads |
e1050 |
Enterprise POWER10 (9043-MRX) | Enterprise mid-range |
e1080 |
Enterprise POWER10 (9080-HEX) | Maximum performance |
| Type | Description | Best For |
|---|---|---|
shared |
Shared processors (default) | Development, testing, cost-effective |
dedicated |
Dedicated processors | Production workloads |
capped |
Capped shared processors | Predictable performance |
| Tier | Description | IOPS | Cost |
|---|---|---|---|
tier3 |
Standard (default) | 3 IOPS/GB | Lower |
tier1 |
High performance | 10 IOPS/GB | Higher |
You can optionally attach an additional data volume to your instance for extra storage:
| Variable | Description | Default | Options |
|---|---|---|---|
pi_create_secondary_volume |
Enable secondary volume | false |
true or false |
pi_secondary_volume_size |
Volume size in GB | 100 |
Min: 10 |
pi_secondary_volume_type |
Storage tier for volume | tier3 |
tier1, tier3 |
Example configuration:
pi_create_secondary_volume = true
pi_secondary_volume_size = 200
pi_secondary_volume_type = "tier3"After deployment, the volume is automatically attached to your instance; you'll still need to rescan, format, and mount it from within the OS.
Volume outputs are available after deployment:
terraform output secondary_volume_id
terraform output secondary_volume_sizeThis configuration automatically imports images from the IBM Cloud catalog into your PowerVS workspace. You need to provide the pi_image_id - the catalog image ID to import.
List available images in the IBM Cloud catalog:
# List all catalog images for PowerVS
ibmcloud pi image list-catalogAIX Images:
- AIX 7.4 (7300-04-01):
627a4b93-e631-41b8-90b3-cf00553fbe76
Linux Images:
- CentOS-Stream-10:
5d543226-04c0-4ca2-bbe2-337cfe18bae7 - RHEL/CentOS-Stream/SLES: Check catalog for latest IDs
IBM i Images:
- Check catalog for latest IBM i image IDs
pi_image_id = "5d543226-04c0-4ca2-bbe2-337cfe18bae7"The image will be imported into your workspace on first terraform apply and reused for subsequent deployments.
terraform show- Edit
terraform.tfvars - Run
terraform planto preview changes - Run
terraform applyto apply changes
When you're done experimenting:
terraform destroyType yes to confirm deletion of all resources.
If you get authentication errors:
# Verify your API key is valid
ibmcloud login --apikey YOUR_API_KEY
# Check your account has PowerVS access
ibmcloud resource service-instances --service-name power-iaasIf you can't connect via SSH:
- Verify the instance is running:
terraform output instance_status - Check the external IP:
terraform output instance_external_ip - Ensure your SSH key permissions:
chmod 600 ./power_vs - Wait 2-3 minutes after deployment for the instance to fully boot
If the image ID is invalid:
# List available images
ibmcloud pi workspace target WORKSPACE_ID
ibmcloud pi images.
├── main.tf # Main Terraform configuration
├── vars.tf # Variable definitions
├── outputs.tf # Output definitions
├── terraform.tfvars.example # Example configuration
├── terraform.tfvars # Your configuration (gitignored)
└── README.md # This file- Never commit
terraform.tfvarsor SSH private keys to version control - Rotate your IBM Cloud API keys regularly
- Use dedicated API keys for automation (not your personal key)
- Restrict SSH access using security groups (add to configuration as needed)
- Delete resources when not in use to avoid unnecessary costs
For issues with:
- This Terraform code: Open an issue in this repository
- IBM Cloud/PowerVS: Contact IBM Cloud Support
- Terraform: Check Terraform Documentation
This project is provided as-is for educational and development purposes.