fbpx

This page demonstrates how to create an Ocean Custom Launch Specification resource using the Spotinst Terraform plugin.

This post assumes that you already have a Spotinst account and went through Spotinst Terraform Installation & Configuration

Example Usage – Ocean Launch Specification
resource "spotinst_ocean_aws_launch_spec" "example" {
  ocean_id  = "o-123456"
  image_id  = "ami-123456"
  user_data = "echo hello world"
  iam_instance_profile = "iam-profile"
  security_groups = ["awseb-12345"]

  labels {
    key   = "fakeKey"
    value = "fakeValue"
  }
  
  taints {
    key    = "taint key updated"
    value  = "taint value updated"
    effect = "NoExecute"
  }
  
  autoscale_headrooms {
    num_of_units = 5
    cpu_per_unit = 1000
    gpu_per_unit = 0
    memory_per_unit = 2048
  }
}

 

Argument Reference

ParameterTypeDescription
ocean_id * String

The Ocean cluster ID.

Example: o-123456
image_id String

ID of the image used to launch the instances.

Example: ami-123456
user_data String

Base64-encoded MIME user data to make available to the instances.

Example: echo hello world
iam_instance_profile String

The ARN or name of an IAM instance profile to associate with launched instances.

Example: iam-profile
security_groups Array<String>

Optionally adds security group IDs.

Example: ["sg-12345"]
labels Object

Optionally adds labels to instances launched in an Ocean cluster.

labels.key * String

The label key.

Example: fakeKey
labels.value * String

The label value.

Example: fakeValue
taints Object

Optionally adds taints to instances launched in an Ocean cluster.

taints.key * String

The tag key.

taints.value * String

The tag value.

taints.effect * String

The effect of the taint. Valid values: "NoSchedule", "PreferNoSchedule", "NoExecute".

autoscale_headrooms Object

Set custom headroom per launch spec. Provide list of headrooms object.

autoscale_headrooms.num_of_units * Integer

The number of units to retain as headroom, where each unit has the defined headroom CPU, memory and GPU.

autoscale_headrooms.cpu_per_unit Integer

Optionally configure the number of CPUs to allocate for each headroom unit. CPUs are denoted in CPU units, where 1024 units = 1 vCPU.

autoscale_headrooms.gpu_per_unit Integer

Optionally configure the number of GPUS to allocate for each headroom unit.

autoscale_headrooms.memory_per_unit Integer

Optionally configure the amount of memory (MiB) to allocate for each headroom unit.