Skip to content

terraform-ibm-modules/terraform-ibm-bare-metal-vpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bare Metal Server for VPC module

Stable (With quality checks) latest release pre-commit Renovate enabled semantic-release

The IBM Cloud Bare Metal Server Deployment Module provisions IBM Cloud Bare Metal Servers for VPC in a flexible and scalable manner. It supports deploying single or multiple servers, dynamically distributing them across one or more subnets while ensuring each instance is uniquely named.

  • Automates complex bare metal deployments in IBM Cloud.
  • Ensures high availability with intelligent subnet selection.
  • Handles Terraform plan-time issues gracefully.

Overview

terraform-ibm-bare-metal-vpc

Usage

Deploy Single Host

Creates a single Bare Metal server on the provided subnet.

terraform {
  required_version = ">= 1.9.0"
  required_providers {
    ibm = {
      source  = "IBM-Cloud/ibm"
      version = "X.Y.Z"  # Lock into a provider version that satisfies the module constraints
    }
  }
}

locals {
    region = "eu-gb"
}

provider "ibm" {
  ibmcloud_api_key = "XXXXXXXXXX"  # replace with apikey value
  region           = local.region
}

module "slz_baremetal" {
  source                = "terraform-ibm-modules/bare-metal-vpc/ibm/modules/baremetal"
  version               = "X.X.X" # Replace "X.X.X" with a release version to lock
  server_count          = 1
  name                  = "slz-bms"
  profile               = "cx2d-metal-96x192"
  image_id              = "r022-a327ec71-6f38-4bdc-99c8-33e723786a91"
  subnet_id             = "r022-d72dc796-b08a-4f8e-a5aa-6c523284173d"
  ssh_key_ids           = ["r022-89b37a2e-e78d-46b8-8989-5f8d00cd44d2"]
  bandwidth             = 100000
  create_security_group = false
  security_group_ids    = ["r018-c76a3522-77aa-41eb-b6bf-76cf5416f9ad"]
  user_data             = "service httpd start"
  allowed_vlan_ids      = ["100", "102"]
  access_tags           = null
  resource_group_id     = "xxxxxxxxxxxxxxxxx"
}

Deploy Multiple Hosts

Creates 3 Bare Metal servers on the provided subnets in a round-robin method.

terraform {
  required_version = ">= 1.9.0"
  required_providers {
    ibm = {
      source  = "IBM-Cloud/ibm"
      version = "X.Y.Z"  # Lock into a provider version that satisfies the module constraints
    }
  }
}

locals {
    region = "eu-gb"
}

provider "ibm" {
  ibmcloud_api_key = "XXXXXXXXXX"  # replace with apikey value
  region           = local.region
}

module "slz_baremetal" {
  source                = "terraform-ibm-modules/bare-metal-vpc/ibm"
  version               = "X.X.X" # Replace "X.X.X" with a release version to lock
  server_count          = 3
  prefix                = "slz-bms"
  profile               = "cx2d-metal-96x192"
  image_id              = "r022-a327ec71-6f38-4bdc-99c8-33e723786a91"
  subnet_ids            = ["r022-d72dc796-b08a-4f8e-a5aa-6c523284173d","r092-d72ddcds96-b0sa-4f8e-a5aa-6c523284s173d"]
  ssh_key_ids           = ["r022-89b37a2e-e78d-46b8-8989-5f8d00cd44d2"]
  bandwidth             = 100000
  create_security_group = false
  security_group_ids    = ["r018-c76a3522-77aa-41eb-b6bf-76cf5416f9ad"]
  user_data             = "service httpd start"
  allowed_vlans_ids     = ["100", "102"]
  access_tags           = null
  resource_group_id     = "xxxxxxxxxxxxxxxxx"
}

Required IAM access policies

You need the following permissions to run this module.

  • Account Management
    • Resource Group service
      • Viewer platform access
  • IAM Services
    • VPC Infrastructure Services service
      • Editor platform access

Requirements

Name Version
terraform >= 1.9.0
ibm >= 1.75.2, < 2.0.0

Modules

Name Source Version
baremetal ./modules/baremetal n/a
sg_group terraform-ibm-modules/security-group/ibm 2.6.2

Resources

Name Type
ibm_is_subnet.selected data source
ibm_is_subnet.subnet data source
ibm_is_vpc.vpc data source

Inputs

Name Description Type Default Required
access_tags A list of access management tags to be attached to the bare metal server for categorization and policy enforcement. list(string) [] no
allowed_vlan_ids A list of VLAN IDs that are permitted for the bare metal server, ensuring network isolation and control. Example: [100, 102] list(number) [] no
bandwidth The allocated bandwidth (in Mbps) for the bare metal server to manage network traffic. If unset, default values apply. number null no
create_security_group Setting to true will be create a new security group bool false no
image_id The unique identifier of the operating system image to be installed on the bare metal server. string n/a yes
prefix The base name for the bare metal server. If multiple instances are created, an index will be appended for uniqueness. string n/a yes
profile The hardware profile defining the CPU, memory, and storage configuration of the bare metal server. string n/a yes
resource_group_id ID of the resource group where you want to create the service. string null no
security_group_ids IDs of additional security groups to be added to BMS deployment primary interface. A BMS interface can have a maximum of 5 security groups. list(string) [] no
security_group_rules A list of security group rules to be added to the default vpc security group
list(
object({
name = string
direction = optional(string, "inbound")
remote = string
tcp = optional(
object({
port_max = optional(number)
port_min = optional(number)
})
)
udp = optional(
object({
port_max = optional(number)
port_min = optional(number)
})
)
icmp = optional(
object({
type = optional(number)
code = optional(number)
})
)
})
)
[] no
server_count Specifies the number of bare metal server instances to provision. If greater than one, multiple instances will be created and distributed across the available subnets in a round-robin manner. For example, if the server count is 3 and there are 2 subnets, Server 1 and Server 3 will be deployed on Subnet 1, while Server 2 will be deployed on Subnet 2. number 1 no
ssh_key_ids A list of SSH key IDs that will be used for secure access to the bare metal server. list(string) n/a yes
subnet_ids A list of subnet IDs where the bare metal server will be deployed, ensuring proper network segmentation. list(string) n/a yes
tags List of tags to apply to resources created by this module. list(string) [] no
user_data User data to initialize BMS deployment string null no

Outputs

Name Description
baremetal_servers IDs and names of the provisioned bare metal servers
server_count The number of servers to be created.
subnet_details The details of the subnets selected for the baremetal servers.
subnet_ids The list of subnet IDs passed to the root module.

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.

About

Configure a Bare Metal Server for VPC

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •