Skip to content

Latest commit

 

History

History
81 lines (66 loc) · 4.88 KB

README.md

File metadata and controls

81 lines (66 loc) · 4.88 KB

Instance Module Example

This module is used to create an Instance

Example Usage

data "ibm_is_vpc" "vpc" {
  name = var.vpc
}

data "ibm_resource_group" "resource_group" {
  name = (var.resource_group != null ? var.resource_group : "default")
}

module "instance" {
  source = "terraform-ibm-modules/vpc/ibm//modules/instance"

  number_of_instances           = var.number_of_instances
  name                      = var.name
  vpc_id                    = data.ibm_is_vpc.vpc.id
  resource_group_id         = data.ibm_resource_group.resource_group.id
  location                  = var.location
  image                     = var.image
  profile                   = var.profile
  ssh_keys                  = var.ssh_keys
  primary_network_interface = var.primary_network_interface
  user_data                 = var.user_data
  boot_volume               = var.boot_volume
  network_interfaces        = var.network_interfaces
  data_volumes              = var.data_volumes
  tags                      = var.tags
}

Requirements

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

Modules

No modules.

Resources

Name Type
ibm_is_instance.instances resource
ibm_is_virtual_network_interface.additional_vnis resource
ibm_is_virtual_network_interface.primary_vni resource

Inputs

Name Description Type Default Required
boot_volume List of boot volume that are to be attached to the instance
list(object({
name = string
encryption = string
}))
[] no
data_volumes List of volume ids that are to be attached to the instance list(string) [] no
image Image ID for the instance string n/a yes
location Instance zone string n/a yes
name Name of the Instance string n/a yes
network_interfaces List of network_interfaces that are to be attached to the instance
list(object({
subnet = string
interface_name = string
security_groups = optional(list(string))
primary_ipv4_address = optional(string)
allow_ip_spoofing = optional(bool)
}))
[] no
number_of_instances number of Instances number 1 no
primary_network_interface List of primary_network_interface that are to be attached to the instance
list(object({
subnet = string
interface_name = string
security_groups = optional(list(string))
primary_ipv4_address = optional(string)
allow_ip_spoofing = optional(bool)
}))
n/a yes
profile Profile type for the Instance string n/a yes
resource_group_id Resource group ID string null no
ssh_keys List of ssh key IDs the instance list(string) n/a yes
tags List of Tags for the Instance list(string) null no
use_legacy_network_interface Set this to true to use legacy network interface for the created instances. bool false no
user_data User Data for the instance string null no
vpc_id VPC ID string n/a yes

Outputs

Name Description
instance_data Data of all the instances created.
instance_ids The ID of the Instances