Skip to content

Commit 1cd206a

Browse files
authored
Enhancement: support for burstable instances #66 (#89)
1 parent 4269df7 commit 1cd206a

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ terraform.tfvars
77
.DS_Store
88
.idea
99
.vscode
10-
10+
.terraform.lock.hcl
1111
tests
1212

1313

docs/terraformoptions.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@
121121
|`null`
122122
|no
123123

124+
|[[baseline_ocpu_utilization]] <<input_baseline_ocpu_utilization,baseline_ocpu_utilization>>
125+
|(Updatable) The baseline OCPU utilization for a subcore burstable VM instance.
126+
|`string`
127+
|`BASELINE_1_1`
128+
|no
129+
124130
|[[input_instance_flex_ocpus]] <<input_instance_flex_ocpus,instance_flex_ocpus>>
125131
|(Updatable) The total number of OCPUs available to the instance.
126132
|`number`

examples/instances_flex_shape/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ module "instance_flex" {
3535
source_type = var.source_type
3636
instance_flex_memory_in_gbs = var.instance_flex_memory_in_gbs # only used if shape is Flex type
3737
instance_flex_ocpus = 1 # only used if shape is Flex type
38+
baseline_ocpu_utilization = var.baseline_ocpu_utilization
3839
# operating system parameters
3940
ssh_public_keys = var.ssh_public_keys
4041
# networking parameters

main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ resource "oci_core_instance" "instance" {
8080
// Else use values from data.oci_core_shapes.current_ad for var.shape
8181
memory_in_gbs = local.shape_is_flex == true && var.instance_flex_memory_in_gbs != null ? var.instance_flex_memory_in_gbs : local.shapes_config[var.shape]["memory_in_gbs"]
8282
ocpus = local.shape_is_flex == true && var.instance_flex_ocpus != null ? var.instance_flex_ocpus : local.shapes_config[var.shape]["ocpus"]
83+
baseline_ocpu_utilization = var.baseline_ocpu_utilization
8384
}
8485

8586
create_vnic_details {
@@ -160,4 +161,4 @@ resource "oci_core_public_ip" "public_ip" {
160161

161162
freeform_tags = local.merged_freeform_tags
162163
defined_tags = var.defined_tags
163-
}
164+
}

variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,17 @@ variable "shape" {
9191
default = "VM.Standard2.1"
9292
}
9393

94+
variable "baseline_ocpu_utilization" {
95+
description = "(Updatable) The baseline OCPU utilization for a subcore burstable VM instance"
96+
type = string
97+
default = "BASELINE_1_1"
98+
99+
validation {
100+
condition = contains(["BASELINE_1_8", "BASELINE_1_2", "BASELINE_1_1"], var.baseline_ocpu_utilization)
101+
error_message = "Accepted values are BASELINE_1_8, BASELINE_1_2 or BASELINE_1_1."
102+
}
103+
}
104+
94105
variable "source_ocid" {
95106
description = "The OCID of an image or a boot volume to use, depending on the value of source_type."
96107
type = string

0 commit comments

Comments
 (0)