Skip to content

Commit dad6bbc

Browse files
committed
terraform/OCI: Remove TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA
Chandan and I have noticed that "enable extra disks, select 2 per instance" is pretty much exactly the same as "don't enable extra disks". Simplify the extra disks selector by removing the check box and making "2 disks per instance" the default. Reviewed-by: Luis Chamberlain <[email protected]> Reviewed-by: Chandan Babu R <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent ba9155e commit dad6bbc

File tree

5 files changed

+17
-134
lines changed

5 files changed

+17
-134
lines changed

playbooks/roles/gen_tfvars/templates/oci/terraform.tfvars.j2

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,10 @@ oci_instance_flex_memory_in_gbs = {{ terraform_oci_instance_flex_memory_in_gbs }
1313
oci_os_image_ocid = "{{ terraform_oci_os_image_ocid }}"
1414
oci_assign_public_ip = "{{ terraform_oci_assign_public_ip | lower }}"
1515
oci_subnet_ocid = "{{ terraform_oci_subnet_ocid }}"
16-
oci_volumes_enable_extra = "{{ terraform_oci_volumes_enable_extra | lower }}"
17-
{% if terraform_oci_volumes_enable_extra %}
1816
oci_volumes_per_instance = {{ terraform_oci_volumes_per_instance }}
1917
oci_volumes_size = {{ terraform_oci_volumes_size }}
20-
{% else %}
21-
oci_data_volume_display_name = "{{ terraform_oci_data_volume_display_name }}"
2218
oci_data_volume_device_file_name = "{{ terraform_oci_data_volume_device_file_name }}"
23-
oci_sparse_volume_display_name = "{{ terraform_oci_sparse_volume_display_name }}"
2419
oci_sparse_volume_device_file_name = "{{ terraform_oci_sparse_volume_device_file_name }}"
25-
{% endif %}
2620

2721
ssh_config_pubkey_file = "{{ kdevops_terraform_ssh_config_pubkey_file }}"
2822
ssh_config_user = "{{ kdevops_terraform_ssh_config_user }}"

scripts/terraform.Makefile

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,6 @@ else
5454
TERRAFORM_EXTRA_VARS += terraform_oci_assign_public_ip=false
5555
endif
5656
TERRAFORM_EXTRA_VARS += terraform_oci_subnet_ocid=$(subst ",,$(CONFIG_TERRAFORM_OCI_SUBNET_OCID))
57-
58-
ifeq (y, $(CONFIG_TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA))
59-
TERRAFORM_EXTRA_VARS += terraform_oci_volumes_enable_extra=true
60-
else
61-
TERRAFORM_EXTRA_VARS += terraform_oci_volumes_enable_extra=false
62-
TERRAFORM_EXTRA_VARS += terraform_oci_data_volume_display_name=$(subst ",,$(CONFIG_TERRAFORM_OCI_DATA_VOLUME_DISPLAY_NAME))
63-
TERRAFORM_EXTRA_VARS += terraform_oci_sparse_volume_display_name=$(subst ",,$(CONFIG_TERRAFORM_OCI_SPARSE_VOLUME_DISPLAY_NAME))
64-
endif
65-
TERRAFORM_EXTRA_VARS += terraform_oci_data_volume_device_file_name=$(subst ",,$(CONFIG_TERRAFORM_OCI_DATA_VOLUME_DEVICE_FILE_NAME))
66-
TERRAFORM_EXTRA_VARS += terraform_oci_sparse_volume_device_file_name=$(subst ",,$(CONFIG_TERRAFORM_OCI_SPARSE_VOLUME_DEVICE_FILE_NAME))
67-
6857
endif
6958

7059
ifeq (y,$(CONFIG_TERRAFORM_OPENSTACK))

terraform/oci/kconfigs/Kconfig.storage

Lines changed: 14 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,50 @@
1-
config TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA
2-
bool "Enable additional block devices"
3-
default n
4-
help
5-
Enable this to provision up to 10 extra block devices
6-
on each target node.
7-
8-
if TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA
9-
101
choice
112
prompt "Count of extra block volumes"
12-
default TERRAFORM_OCI_VOLUMES_PER_INSTANCE_4
3+
default TERRAFORM_OCI_VOLUMES_PER_INSTANCE_2
134
help
14-
The count of extra block devices attached to each target
15-
node.
5+
The count of extra block devices attached to each
6+
instance.
7+
8+
config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_0
9+
bool "0"
10+
11+
config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_1
12+
bool "1"
1613

1714
config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_2
1815
bool "2"
19-
help
20-
Provision 2 extra volumes per target node.
2116

2217
config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_3
2318
bool "3"
24-
help
25-
Provision 3 extra volumes per target node.
2619

2720
config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_4
2821
bool "4"
29-
help
30-
Provision 4 extra volumes per target node.
3122

3223
config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_5
3324
bool "5"
34-
help
35-
Provision 5 extra volumes per target node.
3625

3726
config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_6
3827
bool "6"
39-
help
40-
Provision 6 extra volumes per target node.
4128

4229
config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_7
4330
bool "7"
44-
help
45-
Provision 7 extra volumes per target node.
4631

4732
config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_8
4833
bool "8"
49-
help
50-
Provision 8 extra volumes per target node.
5134

5235
config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_9
5336
bool "9"
54-
help
55-
Provision 9 extra volumes per target node.
5637

5738
config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_10
5839
bool "10"
59-
help
60-
Provision 10 extra volumes per target node.
6140

6241
endchoice
6342

6443
config TERRAFORM_OCI_VOLUMES_PER_INSTANCE
6544
int
6645
output yaml
46+
default 0 if TERRAFORM_OCI_VOLUMES_PER_INSTANCE_0
47+
default 1 if TERRAFORM_OCI_VOLUMES_PER_INSTANCE_1
6748
default 2 if TERRAFORM_OCI_VOLUMES_PER_INSTANCE_2
6849
default 3 if TERRAFORM_OCI_VOLUMES_PER_INSTANCE_3
6950
default 4 if TERRAFORM_OCI_VOLUMES_PER_INSTANCE_4
@@ -76,7 +57,7 @@ config TERRAFORM_OCI_VOLUMES_PER_INSTANCE
7657

7758
choice
7859
prompt "Volume size for each additional volume"
79-
default TERRAFORM_OCI_VOLUMES_SIZE_50G
60+
default TERRAFORM_OCI_VOLUMES_SIZE_128G
8061
help
8162
OCI implements volume sizes between 50G and 32T. In some
8263
cases, 50G volumes are in the free tier.
@@ -141,44 +122,16 @@ config TERRAFORM_OCI_VOLUMES_SIZE
141122
default 4096 if TERRAFORM_OCI_VOLUMES_SIZE_4096G
142123
default 8192 if TERRAFORM_OCI_VOLUMES_SIZE_8192G
143124

144-
endif # TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA
145-
146-
if !TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA
147-
148-
config TERRAFORM_OCI_DATA_VOLUME_DISPLAY_NAME
149-
string "Display name to use for the data volume"
150-
default "data"
151-
help
152-
Human readable data volume instance name
153-
Read this:
154-
https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
155-
156-
endif # !TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA
157-
158125
config TERRAFORM_OCI_DATA_VOLUME_DEVICE_FILE_NAME
159126
string "Data volume's device file name"
127+
output yaml
160128
default "/dev/oracleoci/oraclevdb"
161129
help
162130
Data volume's device file name
163-
Read this:
164-
https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
165-
166-
if !TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA
167-
168-
config TERRAFORM_OCI_SPARSE_VOLUME_DISPLAY_NAME
169-
string "Display name to use for the sparse volume"
170-
default "sparse"
171-
help
172-
Human readable sparse volume instance name
173-
Read this:
174-
https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
175-
176-
endif # !TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA
177131

178132
config TERRAFORM_OCI_SPARSE_VOLUME_DEVICE_FILE_NAME
179133
string "Sparse volume's device file name"
134+
output yaml
180135
default "/dev/oracleoci/oraclevdc"
181136
help
182137
Sparse volume's device file name
183-
Read this:
184-
https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm

terraform/oci/main.tf

Lines changed: 1 addition & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -40,46 +40,8 @@ resource "oci_core_instance" "kdevops_instance" {
4040
preserve_boot_volume = false
4141
}
4242

43-
resource "oci_core_volume" "kdevops_data_disk" {
44-
count = var.oci_volumes_enable_extra == "true" ? 0 : local.kdevops_num_boxes
45-
46-
availability_domain = data.oci_identity_availability_domain.kdevops_av_domain.name
47-
compartment_id = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
48-
display_name = var.oci_data_volume_display_name
49-
size_in_gbs = 50
50-
}
51-
52-
resource "oci_core_volume" "kdevops_sparse_disk" {
53-
count = var.oci_volumes_enable_extra == "true" ? 0 : local.kdevops_num_boxes
54-
55-
availability_domain = data.oci_identity_availability_domain.kdevops_av_domain.name
56-
compartment_id = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
57-
display_name = var.oci_sparse_volume_display_name
58-
size_in_gbs = 120
59-
}
60-
61-
resource "oci_core_volume_attachment" "kdevops_data_volume_attachment" {
62-
count = var.oci_volumes_enable_extra == "true" ? 0 : local.kdevops_num_boxes
63-
64-
attachment_type = "paravirtualized"
65-
instance_id = element(oci_core_instance.kdevops_instance.*.id, count.index)
66-
volume_id = element(oci_core_volume.kdevops_data_disk.*.id, count.index)
67-
68-
device = var.oci_data_volume_device_file_name
69-
}
70-
71-
resource "oci_core_volume_attachment" "kdevops_sparse_disk_attachment" {
72-
count = var.oci_volumes_enable_extra == "true" ? 0 : local.kdevops_num_boxes
73-
74-
attachment_type = "paravirtualized"
75-
instance_id = element(oci_core_instance.kdevops_instance.*.id, count.index)
76-
volume_id = element(oci_core_volume.kdevops_sparse_disk.*.id, count.index)
77-
78-
device = var.oci_sparse_volume_device_file_name
79-
}
80-
8143
module "volumes" {
82-
count = var.oci_volumes_enable_extra == "true" ? local.kdevops_num_boxes : 0
44+
count = local.kdevops_num_boxes
8345
source = "./volumes"
8446

8547
vol_availability_domain = data.oci_identity_availability_domain.kdevops_av_domain.name

terraform/oci/vars.tf

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,6 @@ variable "oci_subnet_ocid" {
5555
type = string
5656
}
5757

58-
variable "oci_volumes_enable_extra" {
59-
description = "Create additional block volumes per instance"
60-
type = bool
61-
}
62-
6358
variable "oci_volumes_per_instance" {
6459
description = "The count of additional block volumes per instance"
6560
type = number
@@ -70,22 +65,12 @@ variable "oci_volumes_size" {
7065
type = number
7166
}
7267

73-
variable "oci_data_volume_display_name" {
74-
description = "Display name to use for the data volume"
75-
type = string
76-
}
77-
78-
variable oci_data_volume_device_file_name {
68+
variable "oci_data_volume_device_file_name" {
7969
description = "Data volume's device file name"
8070
type = string
8171
}
8272

83-
variable "oci_sparse_volume_display_name" {
84-
description = "Display name to use for the sparse volume"
85-
type = string
86-
}
87-
88-
variable oci_sparse_volume_device_file_name {
73+
variable "oci_sparse_volume_device_file_name" {
8974
description = "Sparse volume's device file name"
9075
type = string
9176
}

0 commit comments

Comments
 (0)