Skip to content

IBM-Cloud/sandbox-benchmark-for-vpc

Repository files navigation

IBM Cloud Virtual Servers for VPC Sandbox

Overview

This Terraform module deploys the following VPC infrastructure to deploy sandbox environment on IBM Cloud:

  • VPC
  • Subnet
  • Public gateway
  • Security groups
  • IAM Trusted Profile
  • Dashboard portal VSI
  • Bastion host VSI
  • Bastion host FIP
  • LogDNA (optional component)

VPC Deployment Model

It's recommended to use the IBM Cloud Schematics workspace to deploy the sandbox environment on IBM Cloud VPC. Using Schematics is no additional cost and provides a way for you to easily manage your Terraform lifecycle.

For more information on IBM Cloud Schematics, see IBM Cloud Schematics.

You can run this Terraform module locally when you supply the necessary variables. See Assigning values to root module variables.

You can follow the Sandbox User Guide to deploy the Sandbox environment on IBM Cloud.

Setup requirements

Prerequisites

Upgrading your IBM Cloud account

To order and use IBM Cloud services, billing information is required for your account. See Upgrading Your Account.

Install Terraform

If you want to run Terraform locally, see Install Terraform.

IBM Cloud API Key

You must supply an IBM Cloud API key so that Terraform can connect to the IBM Cloud Terraform provider. This API key is used to order resources by using the identity of the user. For more information, see Create API Key.

IBM Cloud Schematics access policies

You must create the proper Schematics access policies for a user to deploy the sandbox environment on IBM Cloud VPC using IBM Cloud Schematics. For more information, see IBM Cloud Schematics Access.

Variable behavior

There are a number of variables defined in variables.tf used by this Terraform module to deploy and configure your sandbox infrastructure. See variables.tf for full list of variables with their descriptions, defaults, and conditions.

IBM Cloud

When you deploy the sandbox environment on VPC using IBM Cloud topology, the following infrastructure is created by default:

  • 1 x VPC
  • 1 x /24 Subnet (256 IPs)
  • 1 x Public gateway
  • 1 x Dashboard portal VSI
  • 1 x Bastion host VSI
  • 1 x Bastion host FIP
  • 1 x IAM Trusted Profile
  • 1 x LogDNA (optional component)
  • 2 Security groups

Dashboard VSI

Dashboard VSI downloads and installs the sandbox dashboard application, during post-provisioning using cloud-init/user_data . See main.tf

  • Dashboard Portal can only be accessible from Bastion host.
  • You can log into the Dashboard Portal with your username and password and provision the SPR and CLX application VSIs.
  • To provision the application VSIs, IAM Trusted Profile is used to authenticate with IBM Cloud.
  • You can deploy your own workload by providing your installer and runner scripts from the dashboard UI.

NOTE: Don't attach FIP to dashboard VSI; it can only be accessible from the bastion hgost.

Bastion host

Linux Bastion host with VNC Server: You can access the dashboard portal VSI through the bastion host only. You can bind/unbind the FIP in the bastion host as per your usage. The bastion Terraform module provides the commands to access the sandbox dashboard through the bastion tunnel after successful provisioning of the resources.

IAM Trusted Profile

Terraform IAC creates a trusted profile for compute resource identities in IBM Cloud Identity and Access Management, and then assigns access rights for IAM-enabled services to a virtual server instance. The following roles are provided to the IAM Trusted profiles: "Writer", "Viewer", "Reader", "Editor. This profile is used by the dashboard VSI to authenticate with IBM Cloud.

Security groups

  • Bastion host
  • Dashboard VSI

You can pass the remote_allowed_ips for the bastion host security group during Terraform provisioning to open 22(SSH) port for specific IPs. The performance dashboard security group has open traffic for ports 80(UI), 22(SSH) and 8080(API) only for bastion host security group.

Post deploy

This Terraform module provides the commands to access the sandbox dashboard application through the bastion tunnel after successful provisioning of the resources. It provides you with the following command to run in your local terminal so you can access the sandbox dashboard:

http://localhost:38080

ssh -i [SSHKeyPath] -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -L 38080:[dashboard-internalIP]:80 root@[bastion_fip].

Support

Though the materials provided herein are not supported by the IBM Service organization, your comments are welcomed by the developers, who reserve the right to revise or remove the materials at any time. For reporting a problem, providing suggestions, or comments regarding the IBM Cloud Virtual Servers for VPC Sandbox, users can open a GitHub issue. All issues will be addressed as best effort by developers.

Please note that there are no warranties of any kind, and there is no service or technical support available for these materials from IBM. As a recommended practice, carefully review any materials before using them.

If you have problems or questions when you are using the IBM Sandbox for VPC, you can use the following options:

References

Requirements

Name Version
terraform >= 1.0.0
ibm 1.62.0
random 3.5.1

Modules

Name Source Version
bastion_host ./modules/instance n/a
logdna ./modules/logdna n/a

Resources

Name Type
ibm_iam_trusted_profile.profile_id resource
ibm_iam_trusted_profile_policy.rg_policy resource
ibm_iam_trusted_profile_policy.vpc_policy resource
ibm_is_floating_ip.main resource
ibm_is_instance.dashboard-vm resource
ibm_is_public_gateway.gateway resource
ibm_is_security_group.login_sg resource
ibm_is_security_group_rule.dashboard_api_rule resource
ibm_is_security_group_rule.dashboard_outbound resource
ibm_is_security_group_rule.dashboard_ssh_self resource
ibm_is_security_group_rule.dashboard_ui_rule resource
ibm_is_security_group_rule.login_egress_tcp resource
ibm_is_security_group_rule.login_ingress_tcp resource
ibm_is_subnet.subnets resource
ibm_is_vpc.sandbox-vpc resource
ibm_is_vpc_address_prefix.prefixes resource
random_string.resource_identifier resource
ibm_is_image.linux data source
ibm_is_ssh_key.ssh_key_id data source
ibm_resource_group.resource_group data source

Inputs

Name Description Type Default Required
address_prefix_cidrs Address prefixes to create in the VPC list(string) [] no
basename Basename of the created resource string "sbox" no
dashboard-machine-type Application 1 VM machine types string "bx2d-4x16" no
ibmcloud_api_key The IBM Cloud platform API key needed to deploy IAM enabled resources string n/a yes
ibmcloud_ssh_key_name The IBM Cloud platform SSH key name used to deploy sandbox instances string n/a yes
logdna_enable_platform Enables logging bool false no
logdna_ingestion_key Provide existing LogDNA instance ingestion key. To get ingestion key, please follow this https://cloud.ibm.com/docs/log-analysis?topic=log-analysis-ingestion_key&interface=ui. If not set, a new instance of LogDNA will be created when logdna_integration is true. string "" no
logdna_integration Set to false if LogDNA not needed, only recommend disabling for non-production environments. bool true no
logdna_name Name for LogDNA Instance. string "logging" no
logdna_plan Service plan used for new LogDNA instance, valid options are lite, 7-day, 14-day, 30-day, hipaa string "lite" no
personal_access_token Personal access token, Internal IBM use only string "" no
region IBM Cloud region where all resources will be deployed. SPR VSIs are available in Dallas, London, Frankfurt etc. Please refer this string "us-south" no
remote_allowed_ips List of ips to allow access to this bastion host list(string) n/a yes
resource_group The IBM resource group name to be associated with this IBM Cloud VPC Sandbox deployment string "Default" no
sandbox_ui_repo_url Sandbox UI repo download URL, Sample repo URL https://github.com/username/repository-name/archive/master.zip string "https://github.com/IBM-Cloud/sandbox-benchmark-dashboard-for-vpc/archive/main.zip" no
sandbox_uipassword Sandbox UI password. Password must contain at least one uppercase character, one lowercase character, one number, and cannot contain the word 'password'. Password must be 12 to 63 characters long. string n/a yes
subnet_cidrs Subnet cidrs to use in each zone, required when using address_prefix_cidrs list(string) [] no
subnet_ipv4_count Count of ipv4 address in each zone, ignored when using address_prefix_cidrs number 256 no
zones IBM Cloud zone name within the selected region where the Sandbox infrastructure should be deployed. Learn more list(string)
[
"us-south-1"
]
no

Outputs

Name Description
access_info Provides the commands needed to access the instances via the bastion tunnel
trusted_profile The ID of the Trusted profile
vpc_name The ID of the vpc