Skip to content

Instantly share code, notes, and snippets.

@mungi
Created July 13, 2018 13:58
Show Gist options
  • Save mungi/464d514fe2bde33d805114d0d8abcedb to your computer and use it in GitHub Desktop.
Save mungi/464d514fe2bde33d805114d0d8abcedb to your computer and use it in GitHub Desktop.
VM: 1x8x25, 1Gbps NIC, 20TB outbound
variable "group" {
default = "a"
}
variable "datacenter" {
default = "seo01"
}
variable "vm-type" {
default = "M1_1X8X25"
}
data "ibm_compute_ssh_key" "ssh-key" {
label = "mungi"
}
variable "count" {
default = 10
}
provider "ibm" {
}
resource "ibm_security_group" "pub-sg" {
name = "${format("pub-sg-%s",var.group)}"
description = "${format("Security Group for Public Group %s",var.group)}"
}
resource "ibm_security_group" "prv-sg" {
name = "${format("prv-sg-%s",var.group)}"
description = "${format("Security Group for Private Group %s",var.group)}"
}
resource "ibm_compute_vm_instance" "vm-group" {
count = "${var.count}"
# FQDN
hostname = "${format("pool-%s-%02d", var.group, count.index + 1)}"
domain = "mungi.kr"
# Location
datacenter = "${var.datacenter}"
# Type - Spec
flavor_key_name = "${var.vm-type}"
# Network
network_speed = 1000
public_bandwidth_limited = 20000
private_vlan_id = 1541997
private_subnet = "10.178.209.0/25"
os_reference_code = "CENTOS_LATEST"
disks = []
local_disk = false
# Hourly / Monthly
hourly_billing = false
# Security Group
public_security_group_ids = ["${ibm_security_group.pub-sg.id}"]
private_security_group_ids = ["${ibm_security_group.prv-sg.id}"]
ssh_key_ids = ["${data.ibm_compute_ssh_key.ssh-key.id}"]
# Max wait
wait_time_minutes = 10
tags = ["pool","centos","vm"]
notes = "Pooling Group ${var.group}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment