Skip to contentSkip to conversation

Simplify OCI configuration menu

RFC PATCH In review [email protected] 4 participants 39 messages Apr 1, 2025 – Apr 9, 2025

lore
Share & tools
lore
#0 lore raw

cover Simplify OCI configuration menu

From: Chuck Lever <[email protected]>

Over the past month or two I've had to set up kdevops with all four major public cloud providers in order to test the new volume_group role on each of them. There are a lot of similarities amongst the providers, and one of them is that set-up is probably much more complicated than necessary for all of them.

I've come up with some simplifications that can apply to all of the providers, but I'd like to start with OCI because it looks to me like it's the one that has the most users currently. Let's figure out what OCI configuration needs to look like (ie, what changes its users will tolerate!) and make the other providers work the same way.

This series features a number of changes:

- The configuration is split into several submenus, just like the cloud console, to help humans navigate the complexity

- A number of internal simplifications will help us keep up with changes and new features in the provider. In particular, splitting things into smaller files will make it simpler to add scripts to poll provider feature changes and adjust the kdevops menus accordingly

- Free-form strings and "copy this OCID from the console" are replaced with "choose from this menu of known-working options". This includes selection of region, availability domain, shape, and source image

- I've added an option to provision a VCN instead of assuming a pre-existing one, similar to how the other providers work

Some of this stuff will make immediate sense, and some might be controversial. All comments are welcome.

https://github.com/chucklever/kdevops branch => terraform-oci

Chuck Lever (31):
terraform/OCI: Remove terraform_oci_instance_display_name terraform/OCI: One default value to rule them terraform/OCI: Add an "Identity & Access" submenu terraform/OCI: Add a "Resource location" submenu terraform/OCI: Add a "Compute" Kconfig submenu terraform/OCI: Add a "Storage" Kconfig submenu terraform/OCI: Add a "Networking" Kconfig submenu terraform/OCI: Use "output yaml" for the tenancy OCID terraform/OCI: Use "output yaml" for the user OCID terraform/OCI: Use "output yaml" for the signing key terraform/OCI: Use "output yaml" for the fingerprint terraform/OCI: Add a Region selector
terraform/OCI: Add an availability domain selector terraform/OCI: Select your compartment by name instead of by OCID terraform/OCI: Use "output yaml" for the instance shape setting terraform/OCI: Add a shape selector for Flex shapes terraform/OCI: Use "output yaml" for the OCPUs setting terraform/OCI: Use "output yaml" for the memory_in_gbs setting terraform/OCI: Add a shape family selector terraform/OCI: Add a bare metal shape selector terraform/OCI: Use "output yaml" for the source image setting terraform/OCI: Simplify image selection
terraform/OCI: Remove TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA terraform/OCI: Use "output yaml" for the assign_public_ip" setting terraform/OCI: Use "output yaml" for the subnet_ocid setting terraform/OCI: Add a default VCN
terraform/OCI: Add a Kconfig switch to create a VCN on the fly terraform/OCI: Run "terraform fmt" on provider.tf terraform/OCI: Run "terraform fmt" on main.tf terraform/OCI: Nit: alphabetize vars.tf
terraform/OCI: Update the OCI section of docs/kdevops-terraform.md

 docs/kdevops-terraform.md                     | 117 +++----
 playbooks/roles/gen_tfvars/defaults/main.yml  |  20 +-
 .../templates/oci/terraform.tfvars.j2         |  20 +-
 scripts/terraform.Makefile                    |  31 --
 terraform/oci/Kconfig                         | 289 +-----------------
 terraform/oci/kconfigs/Kconfig.compute        |  72 +++++
 terraform/oci/kconfigs/Kconfig.identity       |  35 +++
 terraform/oci/kconfigs/Kconfig.location       |  52 ++++
 terraform/oci/kconfigs/Kconfig.network        |  39 +++
 terraform/oci/kconfigs/Kconfig.storage        | 137 +++++++++
 .../oci/kconfigs/images/Kconfig.OracleLinux   | 237 ++++++++++++++
 terraform/oci/kconfigs/images/Kconfig.Ubuntu  | 162 ++++++++++
 terraform/oci/kconfigs/images/Kconfig.custom  |  20 ++
 .../kconfigs/regions/Kconfig.ap-hyderabad-1   |  28 ++
 .../oci/kconfigs/regions/Kconfig.ap-mumbai-1  |  27 ++
 .../kconfigs/regions/Kconfig.ca-montreal-1    |  28 ++
 .../oci/kconfigs/regions/Kconfig.ca-toronto-1 |  28 ++
 .../oci/kconfigs/regions/Kconfig.us-ashburn-1 |  36 +++
 .../oci/kconfigs/regions/Kconfig.us-chicago-1 |  36 +++
 .../oci/kconfigs/regions/Kconfig.us-phoenix-1 |  36 +++
 .../oci/kconfigs/regions/Kconfig.us-sanjose-1 |  28 ++
 terraform/oci/kconfigs/shapes/Kconfig.bm      |  83 +++++
 terraform/oci/kconfigs/shapes/Kconfig.flex    | 104 +++++++
 terraform/oci/main.tf                         | 195 +++++++++---
 terraform/oci/provider.tf                     |  10 +-
 terraform/oci/vars.tf                         | 158 +++++-----
 26 files changed, 1472 insertions(+), 556 deletions(-)
 create mode 100644 terraform/oci/kconfigs/Kconfig.compute
 create mode 100644 terraform/oci/kconfigs/Kconfig.identity
 create mode 100644 terraform/oci/kconfigs/Kconfig.location
 create mode 100644 terraform/oci/kconfigs/Kconfig.network
 create mode 100644 terraform/oci/kconfigs/Kconfig.storage
 create mode 100644 terraform/oci/kconfigs/images/Kconfig.OracleLinux
 create mode 100644 terraform/oci/kconfigs/images/Kconfig.Ubuntu
 create mode 100644 terraform/oci/kconfigs/images/Kconfig.custom
 create mode 100644 terraform/oci/kconfigs/regions/Kconfig.ap-hyderabad-1
 create mode 100644 terraform/oci/kconfigs/regions/Kconfig.ap-mumbai-1
 create mode 100644 terraform/oci/kconfigs/regions/Kconfig.ca-montreal-1
 create mode 100644 terraform/oci/kconfigs/regions/Kconfig.ca-toronto-1
 create mode 100644 terraform/oci/kconfigs/regions/Kconfig.us-ashburn-1
 create mode 100644 terraform/oci/kconfigs/regions/Kconfig.us-chicago-1
 create mode 100644 terraform/oci/kconfigs/regions/Kconfig.us-phoenix-1
 create mode 100644 terraform/oci/kconfigs/regions/Kconfig.us-sanjose-1
 create mode 100644 terraform/oci/kconfigs/shapes/Kconfig.bm
 create mode 100644 terraform/oci/kconfigs/shapes/Kconfig.flex
Signature · 1 line
2.48.1
#1 lore raw

RFC PATCH 1/31 terraform/OCI: Remove terraform_oci_instance_display_name

From: Chuck Lever <[email protected]>

This variable is neither set via Kconfig nor referenced in terraform/oci/main.tf.

---
 playbooks/roles/gen_tfvars/defaults/main.yml                 | 1 -
 playbooks/roles/gen_tfvars/templates/oci/terraform.tfvars.j2 | 1 -
 terraform/oci/vars.tf                                        | 5 -----
 3 files changed, 7 deletions(-)
playbooks/roles/gen_tfvars/defaults/main.yml +0 -1
index fa317939d82d..e892d85572a8 100644
@@ -60,7 +60,6 @@ terraform_oci_instance_flex_ocpus: "invalid"
 terraform_oci_instance_flex_memory_in_gbs: "invalid"
 terraform_oci_os_image_ocid: "invalid"
 terraform_oci_assign_public_ip: "invalid"
-terraform_oci_instance_display_name: "invalid"
 terraform_oci_subnet_ocid: "invalid"
 terraform_oci_data_volume_display_name: "invalid"
 terraform_oci_data_volume_device_file_name: "invalid"
playbooks/roles/gen_tfvars/templates/oci/terraform.tfvars.j2 +0 -1
index 2d45fd77d510..f7b9ffb48c64 100644
@@ -10,7 +10,6 @@ oci_instance_flex_ocpus = {{ terraform_oci_instance_flex_ocpus }}
 oci_instance_flex_memory_in_gbs = {{ terraform_oci_instance_flex_memory_in_gbs }}
 oci_os_image_ocid = "{{ terraform_oci_os_image_ocid }}"
 oci_assign_public_ip = "{{ terraform_oci_assign_public_ip | lower }}"
-oci_instance_display_name = "{{ terraform_oci_instance_display_name }}"
 oci_subnet_ocid = "{{ terraform_oci_subnet_ocid }}"
 oci_volumes_enable_extra = "{{ terraform_oci_volumes_enable_extra | lower }}"
 {% if terraform_oci_volumes_enable_extra %}
terraform/oci/vars.tf +0 -5
index 077a9a4afdaa..f43e1ee281fc 100644
@@ -55,11 +55,6 @@ variable "oci_os_image_ocid" {
   default = ""
 }
 
-variable "oci_instance_display_name" {
-  description = "Name of the instance"
-  default = ""
-}
-
 variable "oci_assign_public_ip" {
   description = "Assign public IP to the instance"
   default = false
Signature · 1 line
2.48.1
#2 lore raw

RFC PATCH 2/31 terraform/OCI: One default value to rule them

In reply to [email protected]

From: Chuck Lever <[email protected]>

There are 3 sets of default values for each terraform setting.

1. The default value set in terraform/oci/Kconfig
2. The default value in playbooks/roles/gen_tfvars/defaults/main.yml
3. The default value specified in terraform/oci/vars.tf

Often these defaults are different values. It's confusing for developers, but worse is that it can result in hard-to-diagnose terraform provider error messages (eg, "Where did that 'invalid' come from?").

IMO a better plan is to let Kconfig provide the only default value, and remove the other two. We then have a single authoritative default value for each setting.

If a required variable is missing a value during "terraform plan", that will always be a local bug, not something exposed to the provider to report via an obscure error message.

There are two exceptions:

- For Kconfig booleans, often the variable is defined with a "y" value in the "true" case, but not defined at all in the "false" case. So for booleans, the gen_tfvars template needs a default value in gen_tfvars/defaults/main.yml of "false".

- Where a terraform resource expects an argument to be not present in some configurations, then vars.tf needs to explicitly define a default value of "null". Only in those cases it is OK for no value to be provided by Kconfig.

This is a refactoring change; no behavior change is intended.

---
 playbooks/roles/gen_tfvars/defaults/main.yml | 18 +--------
 terraform/oci/vars.tf                        | 42 ++++++++++----------
 2 files changed, 21 insertions(+), 39 deletions(-)
playbooks/roles/gen_tfvars/defaults/main.yml +1 -17
index e892d85572a8..f64102b2fbf5 100644
@@ -48,23 +48,7 @@ terraform_gce_scatch_disk_type: "invalid"
 terraform_gce_image_name: "invalid"
 terraform_gce_credentials: "invalid"
 
-terraform_oci_region: "invalid"
-terraform_oci_tenancy_ocid: "invalid"
-terraform_oci_user_ocid: "invalid"
-terraform_oci_user_private_key_path: "invalid"
-terraform_oci_user_fingerprint: "invalid"
-terraform_oci_availablity_domain_ocid: "invalid"
-terraform_oci_compartment_ocid: "invalid"
-terraform_oci_shape: "invalid"
-terraform_oci_instance_flex_ocpus: "invalid"
-terraform_oci_instance_flex_memory_in_gbs: "invalid"
-terraform_oci_os_image_ocid: "invalid"
-terraform_oci_assign_public_ip: "invalid"
-terraform_oci_subnet_ocid: "invalid"
-terraform_oci_data_volume_display_name: "invalid"
-terraform_oci_data_volume_device_file_name: "invalid"
-terraform_oci_sparse_volume_display_name: "invalid"
-terraform_oci_sparse_volume_device_file_name: "invalid"
+terraform_oci_assign_public_ip: "false"
 
 terraform_openstack_cloud_name: "invalid"
 terraform_openstack_instance_prefix: "invalid"
terraform/oci/vars.tf +20 -22

123 lines not on this page · raw message

Signature · 1 line
2.48.1
#3 lore raw

RFC PATCH 3/31 terraform/OCI: Add an "Identity & Access" submenu

In reply to [email protected]

From: Chuck Lever <[email protected]>

To follow the same topic organization as the web cloud console, move the identity and access selectors into a submenu.

---
 terraform/oci/Kconfig                   | 32 ++++---------------------
 terraform/oci/kconfigs/Kconfig.identity | 27 +++++++++++++++++++++
 2 files changed, 31 insertions(+), 28 deletions(-)
 create mode 100644 terraform/oci/kconfigs/Kconfig.identity
terraform/oci/Kconfig +4 -28
index 00f03163ed83..446a49e76b57 100644
@@ -1,5 +1,9 @@
 if TERRAFORM_OCI
 
+menu "Identity & Access"
+source "terraform/oci/kconfigs/Kconfig.identity"
+endmenu
+
 config TERRAFORM_OCI_REGION
 	string "OCI Region"
 	help
@@ -7,34 +11,6 @@ config TERRAFORM_OCI_REGION
 	  Read this:
 	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
 
-config TERRAFORM_OCI_TENANCY_OCID
-	string "OCI tenant OCID"
-	help
-	  The OCI ID of the tenancy to use.
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
-
-config TERRAFORM_OCI_USER_OCID
-	string "OCI user OCID"
-	help
-	  The OCI ID of the user to use.
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
-
-config TERRAFORM_OCI_USER_PRIVATE_KEY_PATH
-	string "OCI user private key path"
-	help
-	  Path to the file containing the private key of the user.
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
-
-config TERRAFORM_OCI_USER_FINGERPRINT
-	string "OCI user fingerprint"
-	help
-	  Fingerprint for the key pair being used.
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
-
 config TERRAFORM_OCI_AVAILABLITY_DOMAIN
 	string "OCI availablity domain"
 	help
terraform/oci/kconfigs/Kconfig.identity new file +27 -0
new file mode 100644
index 000000000000..928c700d9bd4
@@ -0,0 +1,27 @@
+config TERRAFORM_OCI_TENANCY_OCID
+	string "OCI tenant OCID"
+	help
+	  The OCI ID of the tenancy to use.
+	  Read this:
+	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
+
+config TERRAFORM_OCI_USER_OCID
+	string "OCI user OCID"
+	help
+	  The OCI ID of the user to use.
+	  Read this:
+	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
+
+config TERRAFORM_OCI_USER_PRIVATE_KEY_PATH
+	string "OCI user private key path"
+	help
+	  Path to the file containing the private key of the user.
+	  Read this:
+	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
+
+config TERRAFORM_OCI_USER_FINGERPRINT
+	string "OCI user fingerprint"
+	help
+	  Fingerprint for the key pair being used.
+	  Read this:
+	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
Signature · 1 line
2.48.1
#4 lore raw

RFC PATCH 4/31 terraform/OCI: Add a "Resource location" submenu

In reply to [email protected]

From: Chuck Lever <[email protected]>

Introduce the strategy of moving these submenus to their own separate Kconfig files to eventually enable their generation by querying the provider with a script (similar to "make refs-default"). This would allow the Kconfig menu content to be adjusted based on the intersection of what is currently available on the provider platform and what is accessible to the tenant.

---
 terraform/oci/Kconfig                   | 24 +++---------------------
 terraform/oci/kconfigs/Kconfig.location | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 21 deletions(-)
 create mode 100644 terraform/oci/kconfigs/Kconfig.location
terraform/oci/Kconfig +3 -21
index 446a49e76b57..31bd2ca617f6 100644
@@ -1,30 +1,12 @@
 if TERRAFORM_OCI
 
+menu "Resource location"
+source "terraform/oci/kconfigs/Kconfig.location"
+endmenu
 menu "Identity & Access"
 source "terraform/oci/kconfigs/Kconfig.identity"
 endmenu
 
-config TERRAFORM_OCI_REGION
-	string "OCI Region"
-	help
-	  This option will set the OCI resource location.
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
-
-config TERRAFORM_OCI_AVAILABLITY_DOMAIN
-	string "OCI availablity domain"
-	help
-	  The name of the availability domain.
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
-
-config TERRAFORM_OCI_COMPARTMENT_OCID
-	string "OCI compartment OCID"
-	help
-	  The OCI ID of user's compartment.
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
-
 config TERRAFORM_OCI_SHAPE
 	string "OCI shape name"
 	help
terraform/oci/kconfigs/Kconfig.location new file +20 -0
new file mode 100644
index 000000000000..9e06aa9332f8
@@ -0,0 +1,20 @@
+config TERRAFORM_OCI_REGION
+	string "OCI Region"
+	help
+	  This option will set the OCI resource location.
+	  Read this:
+	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
+
+config TERRAFORM_OCI_AVAILABLITY_DOMAIN
+	string "OCI availablity domain"
+	help
+	  The name of the availability domain.
+	  Read this:
+	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
+
+config TERRAFORM_OCI_COMPARTMENT_OCID
+	string "OCI compartment OCID"
+	help
+	  The OCI ID of user's compartment.
+	  Read this:
+	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
Signature · 1 line
2.48.1
#5 lore raw

RFC PATCH 5/31 terraform/OCI: Add a "Compute" Kconfig submenu

In reply to [email protected]

From: Chuck Lever <[email protected]>

The image and shape are typically selected in the same panel on the OCI cloud console.

---
 terraform/oci/Kconfig                  | 29 +++-----------------------
 terraform/oci/kconfigs/Kconfig.compute | 25 ++++++++++++++++++++++
 2 files changed, 28 insertions(+), 26 deletions(-)
 create mode 100644 terraform/oci/kconfigs/Kconfig.compute
terraform/oci/Kconfig +3 -26
index 31bd2ca617f6..897501a5aebb 100644
@@ -3,36 +3,13 @@ if TERRAFORM_OCI
 menu "Resource location"
 source "terraform/oci/kconfigs/Kconfig.location"
 endmenu
+menu "Compute"
+source "terraform/oci/kconfigs/Kconfig.compute"
+endmenu
 menu "Identity & Access"
 source "terraform/oci/kconfigs/Kconfig.identity"
 endmenu
 
-config TERRAFORM_OCI_SHAPE
-	string "OCI shape name"
-	help
-	  The name of the shape
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
-
-config TERRAFORM_OCI_INSTANCE_FLEX_OCPUS
-	int "Number of flexiable instance OCPUs"
-	default 2
-	help
-	  The number of OCPUs to use per flexible instance.
-
-config TERRAFORM_OCI_INSTANCE_FLEX_MEMORY_IN_GBS
-	int "How much RAM to use per flexible instance in GB"
-	default 4
-	help
-	  How much GiB of RAM to use per flexible instance.
-
-config TERRAFORM_OCI_OS_IMAGE_OCID
-	string "OCI OS image OCID"
-	help
-	  The OCI ID of the OS image to use.
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
-
 config TERRAFORM_OCI_ASSIGN_PUBLIC_IP
 	bool "Assign public IP address to the cloud instance"
 	default y
terraform/oci/kconfigs/Kconfig.compute new file +25 -0
new file mode 100644
index 000000000000..b794ef2d5190
@@ -0,0 +1,25 @@
+config TERRAFORM_OCI_SHAPE
+	string "OCI shape name"
+	help
+	  The name of the shape
+	  Read this:
+	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
+
+config TERRAFORM_OCI_INSTANCE_FLEX_OCPUS
+	int "Number of flexiable instance OCPUs"
+	default 2
+	help
+	  The number of OCPUs to use per flexible instance.
+
+config TERRAFORM_OCI_INSTANCE_FLEX_MEMORY_IN_GBS
+	int "How much RAM to use per flexible instance in GB"
+	default 4
+	help
+	  How much GiB of RAM to use per flexible instance.
+
+config TERRAFORM_OCI_OS_IMAGE_OCID
+	string "OCI OS image OCID"
+	help
+	  The OCI ID of the OS image to use.
+	  Read this:
+	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
Signature · 1 line
2.48.1
#6 lore raw

RFC PATCH 6/31 terraform/OCI: Add a "Storage" Kconfig submenu

In reply to [email protected]

From: Chuck Lever <[email protected]>

---
 terraform/oci/Kconfig                         | 188 +-----------------
 .../oci/{Kconfig => kconfigs/Kconfig.storage} |  29 ---
 2 files changed, 3 insertions(+), 214 deletions(-)
 copy terraform/oci/{Kconfig => kconfigs/Kconfig.storage} (86%)
terraform/oci/Kconfig +3 -185
index 897501a5aebb..c0b820f2cc43 100644
@@ -6,6 +6,9 @@ endmenu
 menu "Compute"
 source "terraform/oci/kconfigs/Kconfig.compute"
 endmenu
+menu "Storage"
+source "terraform/oci/kconfigs/Kconfig.storage"
+endmenu
 menu "Identity & Access"
 source "terraform/oci/kconfigs/Kconfig.identity"
 endmenu
@@ -25,189 +28,4 @@ config TERRAFORM_OCI_SUBNET_OCID
 	  Read this:
 	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
 
-config TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA
-	bool "Enable additional block devices"
-	default n
-	help
-	  Enable this to provision up to 10 extra block devices
-	  on each target node.
-
-if TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA
-
-choice
-	prompt "Count of extra block volumes"
-	default TERRAFORM_OCI_VOLUMES_PER_INSTANCE_4
-	help
-	  The count of extra block devices attached to each target
-	  node.
-
-config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_2
-	bool "2"
-	help
-	  Provision 2 extra volumes per target node.
-
-config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_3
-	bool "3"
-	help
-	  Provision 3 extra volumes per target node.
-
-config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_4
-	bool "4"
-	help
-	  Provision 4 extra volumes per target node.
-
-config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_5
-	bool "5"
-	help
-	  Provision 5 extra volumes per target node.
-
-config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_6
-	bool "6"
-	help
-	  Provision 6 extra volumes per target node.
-
-config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_7
-	bool "7"
-	help
-	  Provision 7 extra volumes per target node.
-
-config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_8
-	bool "8"
-	help
-	  Provision 8 extra volumes per target node.
-
-config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_9
-	bool "9"
-	help
-	  Provision 9 extra volumes per target node.
-
-config TERRAFORM_OCI_VOLUMES_PER_INSTANCE_10
-	bool "10"
-	help
-	  Provision 10 extra volumes per target node.
-
-endchoice
-
-config TERRAFORM_OCI_VOLUMES_PER_INSTANCE
-	int
-	output yaml
-	default 2 if TERRAFORM_OCI_VOLUMES_PER_INSTANCE_2
-	default 3 if TERRAFORM_OCI_VOLUMES_PER_INSTANCE_3
-	default 4 if TERRAFORM_OCI_VOLUMES_PER_INSTANCE_4
-	default 5 if TERRAFORM_OCI_VOLUMES_PER_INSTANCE_5
-	default 6 if TERRAFORM_OCI_VOLUMES_PER_INSTANCE_6
-	default 7 if TERRAFORM_OCI_VOLUMES_PER_INSTANCE_7
-	default 8 if TERRAFORM_OCI_VOLUMES_PER_INSTANCE_8
-	default 9 if TERRAFORM_OCI_VOLUMES_PER_INSTANCE_9
-	default 10 if TERRAFORM_OCI_VOLUMES_PER_INSTANCE_10
-
-choice
-	prompt "Volume size for each additional volume"
-	default TERRAFORM_OCI_VOLUMES_SIZE_50G
-	help
-	  OCI implements volume sizes between 50G and 32T. In some
-	  cases, 50G volumes are in the free tier.
-
-config TERRAFORM_OCI_VOLUMES_SIZE_50G
-	bool "50G"
-	help
-	  Extra block volumes are 50 GiB in size.
-
-config TERRAFORM_OCI_VOLUMES_SIZE_64G
-	bool "64G"
-	help
-	  Extra block volumes are 64 GiB in size.
-
-config TERRAFORM_OCI_VOLUMES_SIZE_128G
-	bool "128G"
-	help
-	  Extra block volumes are 128 GiB in size.
-
-config TERRAFORM_OCI_VOLUMES_SIZE_256G
-	bool "256G"
-	help
-	  Extra block volumes are 256 GiB in size.
-
-config TERRAFORM_OCI_VOLUMES_SIZE_512G
-	bool "512G"
-	help
-	  Extra block volumes are 512 GiB in size.
-
-config TERRAFORM_OCI_VOLUMES_SIZE_1024G
-	bool "1024G"
-	help
-	  Extra block volumes are 1024 GiB in size.
-
-config TERRAFORM_OCI_VOLUMES_SIZE_2048G
-	bool "2048G"
-	help
-	  Extra block volumes are 2048 GiB in size.
-
-config TERRAFORM_OCI_VOLUMES_SIZE_4096G
-	bool "4096G"
-	help
-	  Extra block volumes are 4096 GiB in size.
-
-config TERRAFORM_OCI_VOLUMES_SIZE_8192G
-	bool "8192G"
-	help
-	  Extra block volumes are 8192 GiB in size.
-
-endchoice
-
-config TERRAFORM_OCI_VOLUMES_SIZE
-	int
-	output yaml
-	default 50 if TERRAFORM_OCI_VOLUMES_SIZE_50G
-	default 64 if TERRAFORM_OCI_VOLUMES_SIZE_64G
-	default 128 if TERRAFORM_OCI_VOLUMES_SIZE_128G
-	default 256 if TERRAFORM_OCI_VOLUMES_SIZE_256G
-	default 512 if TERRAFORM_OCI_VOLUMES_SIZE_512G
-	default 1024 if TERRAFORM_OCI_VOLUMES_SIZE_1024G
-	default 2048 if TERRAFORM_OCI_VOLUMES_SIZE_2048G
-	default 4096 if TERRAFORM_OCI_VOLUMES_SIZE_4096G
-	default 8192 if TERRAFORM_OCI_VOLUMES_SIZE_8192G
-
-endif # TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA
-
-if !TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA
-
-config TERRAFORM_OCI_DATA_VOLUME_DISPLAY_NAME
-	string "Display name to use for the data volume"
-	default "data"
-	help
-	  Human readable data volume instance name
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
-
-endif # !TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA
-
-config TERRAFORM_OCI_DATA_VOLUME_DEVICE_FILE_NAME
-	string "Data volume's device file name"
-	default "/dev/oracleoci/oraclevdb"
-	help
-	  Data volume's device file name
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
-
-if !TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA
-
-config TERRAFORM_OCI_SPARSE_VOLUME_DISPLAY_NAME
-	string "Display name to use for the sparse volume"
-	default "sparse"
-	help
-	  Human readable sparse volume instance name
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
-
-endif # !TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA
-
-config TERRAFORM_OCI_SPARSE_VOLUME_DEVICE_FILE_NAME
-	string "Sparse volume's device file name"
-	default "/dev/oracleoci/oraclevdc"
-	help
-	  Sparse volume's device file name
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
-
 endif # TERRAFORM_OCI
terraform/oci/kconfigs/Kconfig.storage renamed from terraform/oci/Kconfig +0 -29
similarity index 86%
copy from terraform/oci/Kconfig
copy to terraform/oci/kconfigs/Kconfig.storage
index 897501a5aebb..8b2885a07d63 100644
@@ -1,30 +1,3 @@
-if TERRAFORM_OCI
-
-menu "Resource location"
-source "terraform/oci/kconfigs/Kconfig.location"
-endmenu
-menu "Compute"
-source "terraform/oci/kconfigs/Kconfig.compute"
-endmenu
-menu "Identity & Access"
-source "terraform/oci/kconfigs/Kconfig.identity"
-endmenu
-
-config TERRAFORM_OCI_ASSIGN_PUBLIC_IP
-	bool "Assign public IP address to the cloud instance"
-	default y
-	help
-          Select this field if public IP address has to be assigned to
-          the cloud instance. Otherwise a public IP address is
-          assigned.
-
-config TERRAFORM_OCI_SUBNET_OCID
-	string "OCI Subnet OCID"
-	help
-	  The OCI ID of the subnet.
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
-
 config TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA
 	bool "Enable additional block devices"
 	default n
@@ -209,5 +182,3 @@ config TERRAFORM_OCI_SPARSE_VOLUME_DEVICE_FILE_NAME
 	  Sparse volume's device file name
 	  Read this:
 	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
-
-endif # TERRAFORM_OCI
Signature · 1 line
2.48.1
#7 lore raw

RFC PATCH 7/31 terraform/OCI: Add a "Networking" Kconfig submenu

In reply to [email protected]

From: Chuck Lever <[email protected]>

---
 terraform/oci/Kconfig                  | 18 +++---------------
 terraform/oci/kconfigs/Kconfig.network | 14 ++++++++++++++
 2 files changed, 17 insertions(+), 15 deletions(-)
 create mode 100644 terraform/oci/kconfigs/Kconfig.network
terraform/oci/Kconfig +3 -15
index c0b820f2cc43..566442868a8b 100644
@@ -9,23 +9,11 @@ endmenu
 menu "Storage"
 source "terraform/oci/kconfigs/Kconfig.storage"
 endmenu
+menu "Network"
+source "terraform/oci/kconfigs/Kconfig.network"
+endmenu
 menu "Identity & Access"
 source "terraform/oci/kconfigs/Kconfig.identity"
 endmenu
 
-config TERRAFORM_OCI_ASSIGN_PUBLIC_IP
-	bool "Assign public IP address to the cloud instance"
-	default y
-	help
-          Select this field if public IP address has to be assigned to
-          the cloud instance. Otherwise a public IP address is
-          assigned.
-
-config TERRAFORM_OCI_SUBNET_OCID
-	string "OCI Subnet OCID"
-	help
-	  The OCI ID of the subnet.
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
-
 endif # TERRAFORM_OCI
terraform/oci/kconfigs/Kconfig.network new file +14 -0
new file mode 100644
index 000000000000..ab1914c6f6a6
@@ -0,0 +1,14 @@
+config TERRAFORM_OCI_ASSIGN_PUBLIC_IP
+	bool "Assign public IP address to the cloud instance"
+	default y
+	help
+	  Select this field if public IP address has to be assigned to
+	  the cloud instance. Otherwise a public IP address is
+	  assigned.
+
+config TERRAFORM_OCI_SUBNET_OCID
+	string "OCI Subnet OCID"
+	help
+	  The OCI ID of the subnet.
+	  Read this:
+	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
Signature · 1 line
2.48.1
#8 lore raw

RFC PATCH 8/31 terraform/OCI: Use "output yaml" for the tenancy OCID

In reply to [email protected]

From: Chuck Lever <[email protected]>

Refactor: Remove the line in terraform.Makefile that sets "terraform_oci_tenancy_ocid", and just pass it directly from Kconfig via an "output yaml" directive.

As an additional clean up, update the help text.

---
 scripts/terraform.Makefile              |  1 -
 terraform/oci/kconfigs/Kconfig.identity | 10 ++++++----
 2 files changed, 6 insertions(+), 5 deletions(-)
scripts/terraform.Makefile +0 -1
index 3235c1af84b9..1589585cd2bd 100644
@@ -96,7 +96,6 @@ endif
 
 ifeq (y,$(CONFIG_TERRAFORM_OCI))
 TERRAFORM_EXTRA_VARS += terraform_oci_region=$(subst ",,$(CONFIG_TERRAFORM_OCI_REGION))
-TERRAFORM_EXTRA_VARS += terraform_oci_tenancy_ocid=$(subst ",,$(CONFIG_TERRAFORM_OCI_TENANCY_OCID))
 TERRAFORM_EXTRA_VARS += terraform_oci_user_ocid=$(subst ",,$(CONFIG_TERRAFORM_OCI_USER_OCID))
 TERRAFORM_EXTRA_VARS += terraform_oci_user_private_key_path=$(subst ",,$(CONFIG_TERRAFORM_OCI_USER_PRIVATE_KEY_PATH))
 TERRAFORM_EXTRA_VARS += terraform_oci_user_fingerprint=$(subst ",,$(CONFIG_TERRAFORM_OCI_USER_FINGERPRINT))
terraform/oci/kconfigs/Kconfig.identity +6 -4
index 928c700d9bd4..3061c12f6de0 100644
@@ -1,9 +1,11 @@
 config TERRAFORM_OCI_TENANCY_OCID
-	string "OCI tenant OCID"
+	string "OCI tenancy OCID"
+	output yaml
 	help
-	  The OCI ID of the tenancy to use.
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
+	  The OCID of the tenancy in which to create kdevops
+	  resources. See:
+
+	  https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm#five
 
 config TERRAFORM_OCI_USER_OCID
 	string "OCI user OCID"
Signature · 1 line
2.48.1
#9 lore raw

RFC PATCH 9/31 terraform/OCI: Use "output yaml" for the user OCID

In reply to [email protected]

From: Chuck Lever <[email protected]>

Refactor: Remove the line in terraform.Makefile that sets "terraform_oci_user_ocid", and just pass it directly from Kconfig via an "output yaml" directive.

As an additional clean up, update the help text.

---
 scripts/terraform.Makefile              | 1 -
 terraform/oci/kconfigs/Kconfig.identity | 8 +++++---
 2 files changed, 5 insertions(+), 4 deletions(-)
scripts/terraform.Makefile +0 -1
index 1589585cd2bd..aced091fa08c 100644
@@ -96,7 +96,6 @@ endif
 
 ifeq (y,$(CONFIG_TERRAFORM_OCI))
 TERRAFORM_EXTRA_VARS += terraform_oci_region=$(subst ",,$(CONFIG_TERRAFORM_OCI_REGION))
-TERRAFORM_EXTRA_VARS += terraform_oci_user_ocid=$(subst ",,$(CONFIG_TERRAFORM_OCI_USER_OCID))
 TERRAFORM_EXTRA_VARS += terraform_oci_user_private_key_path=$(subst ",,$(CONFIG_TERRAFORM_OCI_USER_PRIVATE_KEY_PATH))
 TERRAFORM_EXTRA_VARS += terraform_oci_user_fingerprint=$(subst ",,$(CONFIG_TERRAFORM_OCI_USER_FINGERPRINT))
 TERRAFORM_EXTRA_VARS += terraform_oci_availablity_domain=$(subst ",,$(CONFIG_TERRAFORM_OCI_AVAILABLITY_DOMAIN))
terraform/oci/kconfigs/Kconfig.identity +5 -3
index 3061c12f6de0..392ac584a567 100644
@@ -9,10 +9,12 @@ config TERRAFORM_OCI_TENANCY_OCID
 
 config TERRAFORM_OCI_USER_OCID
 	string "OCI user OCID"
+	output yaml
 	help
-	  The OCI ID of the user to use.
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
+	  The OCID of the cloud user that kdevops should authenticate as.
+	  See:
+
+	  https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm#five
 
 config TERRAFORM_OCI_USER_PRIVATE_KEY_PATH
 	string "OCI user private key path"
Signature · 1 line
2.48.1
#10 lore raw

RFC PATCH 10/31 terraform/OCI: Use "output yaml" for the signing key

In reply to [email protected]

From: Chuck Lever <[email protected]>

Refactor: Remove the line in terraform.Makefile that sets "terraform_oci_user_private_key_path" and just pass it directly from Kconfig via an "output yaml" directive.

As an additional clean up, update the help text.

---
 scripts/terraform.Makefile              |  1 -
 terraform/oci/kconfigs/Kconfig.identity | 11 +++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)
scripts/terraform.Makefile +0 -1
index aced091fa08c..b631b4c09a0e 100644
@@ -96,7 +96,6 @@ endif
 
 ifeq (y,$(CONFIG_TERRAFORM_OCI))
 TERRAFORM_EXTRA_VARS += terraform_oci_region=$(subst ",,$(CONFIG_TERRAFORM_OCI_REGION))
-TERRAFORM_EXTRA_VARS += terraform_oci_user_private_key_path=$(subst ",,$(CONFIG_TERRAFORM_OCI_USER_PRIVATE_KEY_PATH))
 TERRAFORM_EXTRA_VARS += terraform_oci_user_fingerprint=$(subst ",,$(CONFIG_TERRAFORM_OCI_USER_FINGERPRINT))
 TERRAFORM_EXTRA_VARS += terraform_oci_availablity_domain=$(subst ",,$(CONFIG_TERRAFORM_OCI_AVAILABLITY_DOMAIN))
 TERRAFORM_EXTRA_VARS += terraform_oci_compartment_ocid=$(subst ",,$(CONFIG_TERRAFORM_OCI_COMPARTMENT_OCID))
terraform/oci/kconfigs/Kconfig.identity +7 -4
index 392ac584a567..87f5457995f5 100644
@@ -17,11 +17,14 @@ config TERRAFORM_OCI_USER_OCID
 	  https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm#five
 
 config TERRAFORM_OCI_USER_PRIVATE_KEY_PATH
-	string "OCI user private key path"
+	string "Pathname to private key file"
+	output yaml
 	help
-	  Path to the file containing the private key of the user.
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
+	  Pathname to the local file containing the signing key of
+	  the user. You can upload an pre-existing key, or generate
+	  one on the OCI cloud console and download it. See:
+
+	  https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm#two
 
 config TERRAFORM_OCI_USER_FINGERPRINT
 	string "OCI user fingerprint"
Signature · 1 line
2.48.1
#11 lore raw

RFC PATCH 11/31 terraform/OCI: Use "output yaml" for the fingerprint

In reply to [email protected]

From: Chuck Lever <[email protected]>

Refactor: Remove the line in terraform.Makefile that sets "terraform_oci_user_fingerprint" and just pass it directly from Kconfig via an "output yaml" directive.

As an additional clean up, update the help text.

---
 scripts/terraform.Makefile              | 1 -
 terraform/oci/kconfigs/Kconfig.identity | 9 +++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
scripts/terraform.Makefile +0 -1
index b631b4c09a0e..75ba9b97b518 100644
@@ -96,7 +96,6 @@ endif
 
 ifeq (y,$(CONFIG_TERRAFORM_OCI))
 TERRAFORM_EXTRA_VARS += terraform_oci_region=$(subst ",,$(CONFIG_TERRAFORM_OCI_REGION))
-TERRAFORM_EXTRA_VARS += terraform_oci_user_fingerprint=$(subst ",,$(CONFIG_TERRAFORM_OCI_USER_FINGERPRINT))
 TERRAFORM_EXTRA_VARS += terraform_oci_availablity_domain=$(subst ",,$(CONFIG_TERRAFORM_OCI_AVAILABLITY_DOMAIN))
 TERRAFORM_EXTRA_VARS += terraform_oci_compartment_ocid=$(subst ",,$(CONFIG_TERRAFORM_OCI_COMPARTMENT_OCID))
 TERRAFORM_EXTRA_VARS += terraform_oci_shape=$(subst ",,$(CONFIG_TERRAFORM_OCI_SHAPE))
terraform/oci/kconfigs/Kconfig.identity +5 -4
index 87f5457995f5..310cf19b7ca1 100644
@@ -27,8 +27,9 @@ config TERRAFORM_OCI_USER_PRIVATE_KEY_PATH
 	  https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm#two
 
 config TERRAFORM_OCI_USER_FINGERPRINT
-	string "OCI user fingerprint"
+	string "Signing key fingerprint"
+	output yaml
 	help
-	  Fingerprint for the key pair being used.
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
+	  Fingerprint for the signing key pair. See:
+
+	  https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm#four
Signature · 1 line
2.48.1
#12 lore raw

RFC PATCH 12/31 terraform/OCI: Add a Region selector

In reply to [email protected]

From: Chuck Lever <[email protected]>

Replace the free-form string region setting with a selector that chooses among already-validated settings. Some popular regions in the "commercial" realm are added. It should be easy to add more.

---
 scripts/terraform.Makefile              |  1 -
 terraform/oci/kconfigs/Kconfig.location | 53 ++++++++++++++++++++++---
 2 files changed, 48 insertions(+), 6 deletions(-)
scripts/terraform.Makefile +0 -1
index 75ba9b97b518..ea5309d5da2e 100644
@@ -95,7 +95,6 @@ TERRAFORM_EXTRA_VARS += terraform_gce_credentials=$(subst ",,$(CONFIG_TERRAFORM_
 endif
 
 ifeq (y,$(CONFIG_TERRAFORM_OCI))
-TERRAFORM_EXTRA_VARS += terraform_oci_region=$(subst ",,$(CONFIG_TERRAFORM_OCI_REGION))
 TERRAFORM_EXTRA_VARS += terraform_oci_availablity_domain=$(subst ",,$(CONFIG_TERRAFORM_OCI_AVAILABLITY_DOMAIN))
 TERRAFORM_EXTRA_VARS += terraform_oci_compartment_ocid=$(subst ",,$(CONFIG_TERRAFORM_OCI_COMPARTMENT_OCID))
 TERRAFORM_EXTRA_VARS += terraform_oci_shape=$(subst ",,$(CONFIG_TERRAFORM_OCI_SHAPE))
terraform/oci/kconfigs/Kconfig.location +48 -5

57 lines not on this page · raw message

Signature · 1 line
2.48.1
#13 lore raw

RFC PATCH 13/31 terraform/OCI: Add an availability domain selector

In reply to [email protected]

From: Chuck Lever <[email protected]>

In order to balance load, OCI adds a prefix to availability domain names. This prefix is fixed but unique for each user.

The user has to look up the prefixed name (at least once) before specifying an availability domain name for terraform, which is not user-friendly.

Fortunately, terraform provides a data source to look up the user's unique prefix and form the correct full domain name for terraform. So the Kconfig selector only needs to pick an integer from 1 to 3, and that hides a needless detail from our user.

---
 .../templates/oci/terraform.tfvars.j2         |  2 +-
 scripts/terraform.Makefile                    |  1 -
 terraform/oci/kconfigs/Kconfig.location       | 26 +++++---------
 .../kconfigs/regions/Kconfig.ap-hyderabad-1   | 28 +++++++++++++++
 .../oci/kconfigs/regions/Kconfig.ap-mumbai-1  | 27 ++++++++++++++
 .../kconfigs/regions/Kconfig.ca-montreal-1    | 28 +++++++++++++++
 .../oci/kconfigs/regions/Kconfig.ca-toronto-1 | 28 +++++++++++++++
 .../oci/kconfigs/regions/Kconfig.us-ashburn-1 | 36 +++++++++++++++++++
 .../oci/kconfigs/regions/Kconfig.us-chicago-1 | 36 +++++++++++++++++++
 .../oci/kconfigs/regions/Kconfig.us-phoenix-1 | 36 +++++++++++++++++++
 .../oci/kconfigs/regions/Kconfig.us-sanjose-1 | 28 +++++++++++++++
 terraform/oci/main.tf                         | 15 ++++----
 terraform/oci/vars.tf                         | 10 +++---
 13 files changed, 270 insertions(+), 31 deletions(-)
 create mode 100644 terraform/oci/kconfigs/regions/Kconfig.ap-hyderabad-1
 create mode 100644 terraform/oci/kconfigs/regions/Kconfig.ap-mumbai-1
 create mode 100644 terraform/oci/kconfigs/regions/Kconfig.ca-montreal-1
 create mode 100644 terraform/oci/kconfigs/regions/Kconfig.ca-toronto-1
 create mode 100644 terraform/oci/kconfigs/regions/Kconfig.us-ashburn-1
 create mode 100644 terraform/oci/kconfigs/regions/Kconfig.us-chicago-1
 create mode 100644 terraform/oci/kconfigs/regions/Kconfig.us-phoenix-1
 create mode 100644 terraform/oci/kconfigs/regions/Kconfig.us-sanjose-1
playbooks/roles/gen_tfvars/templates/oci/terraform.tfvars.j2 +1 -1
index f7b9ffb48c64..864d5d5a89f0 100644
@@ -3,7 +3,7 @@ oci_tenancy_ocid = "{{ terraform_oci_tenancy_ocid }}"
 oci_user_ocid = "{{ terraform_oci_user_ocid }}"
 oci_user_private_key_path = "{{ terraform_oci_user_private_key_path }}"
 oci_user_fingerprint = "{{ terraform_oci_user_fingerprint }}"
-oci_availablity_domain = "{{ terraform_oci_availablity_domain }}"
+oci_ad_number = {{ terraform_oci_ad_number }}
 oci_compartment_ocid = "{{ terraform_oci_compartment_ocid }}"
 oci_shape = "{{ terraform_oci_shape }}"
 oci_instance_flex_ocpus = {{ terraform_oci_instance_flex_ocpus }}
scripts/terraform.Makefile +0 -1
index ea5309d5da2e..0aca0b508086 100644
@@ -95,7 +95,6 @@ TERRAFORM_EXTRA_VARS += terraform_gce_credentials=$(subst ",,$(CONFIG_TERRAFORM_
 endif
 
 ifeq (y,$(CONFIG_TERRAFORM_OCI))
-TERRAFORM_EXTRA_VARS += terraform_oci_availablity_domain=$(subst ",,$(CONFIG_TERRAFORM_OCI_AVAILABLITY_DOMAIN))
 TERRAFORM_EXTRA_VARS += terraform_oci_compartment_ocid=$(subst ",,$(CONFIG_TERRAFORM_OCI_COMPARTMENT_OCID))
 TERRAFORM_EXTRA_VARS += terraform_oci_shape=$(subst ",,$(CONFIG_TERRAFORM_OCI_SHAPE))
 TERRAFORM_EXTRA_VARS += terraform_oci_instance_flex_ocpus=$(subst ",,$(CONFIG_TERRAFORM_OCI_INSTANCE_FLEX_OCPUS))
terraform/oci/kconfigs/Kconfig.location +8 -18
index 9ef81cedd235..7bf5ae49ba03 100644
@@ -36,24 +36,14 @@ config TERRAFORM_OCI_REGION_SJC
 
 endchoice
 
-config TERRAFORM_OCI_REGION
-	string
-	output yaml
-	default "ap-hyderabad-1" if TERRAFORM_OCI_REGION_HYD
-	default "ap-mumbai-1" if TERRAFORM_OCI_REGION_BOM
-	default "ca-montreal-1" if TERRAFORM_OCI_REGION_YUL
-	default "ca-toronto-1" if TERRAFORM_OCI_REGION_YYZ
-	default "us-ashburn-1" if TERRAFORM_OCI_REGION_IAD
-	default "us-chicago-1" if TERRAFORM_OCI_REGION_ORD
-	default "us-phoenix-1" if TERRAFORM_OCI_REGION_PHX
-	default "us-sanjose-1" if TERRAFORM_OCI_REGION_SJC
-
-config TERRAFORM_OCI_AVAILABLITY_DOMAIN
-	string "OCI availablity domain"
-	help
-	  The name of the availability domain.
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
+source "terraform/oci/kconfigs/regions/Kconfig.ap-hyderabad-1"
+source "terraform/oci/kconfigs/regions/Kconfig.ap-mumbai-1"
+source "terraform/oci/kconfigs/regions/Kconfig.ca-montreal-1"
+source "terraform/oci/kconfigs/regions/Kconfig.ca-toronto-1"
+source "terraform/oci/kconfigs/regions/Kconfig.us-ashburn-1"
+source "terraform/oci/kconfigs/regions/Kconfig.us-chicago-1"
+source "terraform/oci/kconfigs/regions/Kconfig.us-phoenix-1"
+source "terraform/oci/kconfigs/regions/Kconfig.us-sanjose-1"
 
 config TERRAFORM_OCI_COMPARTMENT_OCID
 	string "OCI compartment OCID"
terraform/oci/kconfigs/regions/Kconfig.ap-hyderabad-1 new file +28 -0
new file mode 100644
index 000000000000..f4ac37ef38da
@@ -0,0 +1,28 @@
+if TERRAFORM_OCI_REGION_HYD
+
+config TERRAFORM_OCI_REGION
+	string
+	output yaml
+	default "ap-hyderabad-1"
+
+choice
+	prompt "Availability Domain"
+	default TERRAFORM_OCI_REGION_HYD_AD1
+	help
+	  The number of the Availability Domain. This number
+	  corresponds to the integer at the end of the Availability
+	  Domain name.
+
+	  The OCI Fault Domain is chosen automatically.
+
+config TERRAFORM_OCI_REGION_HYD_AD1
+	bool "1"
+
+endchoice
+
+config TERRAFORM_OCI_AD_NUMBER
+	int
+	output yaml
+	default 1 if TERRAFORM_OCI_REGION_HYD_1_AD1
+
+endif # TERRAFORM_OCI_REGION_HYD_1
terraform/oci/kconfigs/regions/Kconfig.ap-mumbai-1 new file +27 -0
new file mode 100644
index 000000000000..f05b595c3993
@@ -0,0 +1,27 @@
+if TERRAFORM_OCI_REGION_BOM
+
+config TERRAFORM_OCI_REGION
+	string
+	output yaml
+	default "ap-mumbai-1"
+choice
+	prompt "Availability Domain"
+	default TERRAFORM_OCI_REGION_BOM_AD1
+	help
+	  The number of the Availability Domain. This number
+	  corresponds to the integer at the end of the Availability
+	  Domain name.
+
+	  The OCI Fault Domain is chosen automatically.
+
+config TERRAFORM_OCI_REGION_BOM_AD1
+	bool "1"
+
+endchoice
+
+config TERRAFORM_OCI_AD_NUMBER
+	int
+	output yaml
+	default 1 if TERRAFORM_OCI_REGION_BOM_AD1
+
+endif # TERRAFORM_OCI_REGION_BOM
terraform/oci/kconfigs/regions/Kconfig.ca-montreal-1 new file +28 -0
new file mode 100644
index 000000000000..ce71f531e488
@@ -0,0 +1,28 @@
+if TERRAFORM_OCI_REGION_YUL
+
+config TERRAFORM_OCI_REGION
+	string
+	output yaml
+	default "ca-montreal-1"
+
+choice
+	prompt "Availability Domain"
+	default TERRAFORM_OCI_REGION_YUL_AD1
+	help
+	  The number of the Availability Domain. This number
+	  corresponds to the integer at the end of the Availability
+	  Domain name.
+
+	  The OCI Fault Domain is chosen automatically.
+
+config TERRAFORM_OCI_REGION_YUL_AD1
+	bool "1"
+
+endchoice
+
+config TERRAFORM_OCI_AD_NUMBER
+	int
+	output yaml
+	default 1 if TERRAFORM_OCI_REGION_YUL_AD1
+
+endif # TERRAFORM_OCI_REGION_YUL
terraform/oci/kconfigs/regions/Kconfig.ca-toronto-1 new file +28 -0
new file mode 100644
index 000000000000..16053e94e983
@@ -0,0 +1,28 @@
+if TERRAFORM_OCI_REGION_YYZ
+
+config TERRAFORM_OCI_REGION
+	string
+	output yaml
+	default "ca-toronto-1"
+
+choice
+	prompt "Availability Domain"
+	default TERRAFORM_OCI_REGION_YYZ_AD1
+	help
+	  The number of the Availability Domain. This number
+	  corresponds to the integer at the end of the Availability
+	  Domain name.
+
+	  The OCI Fault Domain is chosen automatically.
+
+config TERRAFORM_OCI_REGION_YYZ_AD1
+	bool "1"
+
+endchoice
+
+config TERRAFORM_OCI_AD_NUMBER
+	int
+	output yaml
+	default 1 if TERRAFORM_OCI_REGION_YYZ_AD1
+
+endif # TERRAFORM_OCI_REGION_YYZ
terraform/oci/kconfigs/regions/Kconfig.us-ashburn-1 new file +36 -0
new file mode 100644
index 000000000000..9aa4d2714452
@@ -0,0 +1,36 @@
+if TERRAFORM_OCI_REGION_IAD
+
+config TERRAFORM_OCI_REGION
+	string
+	output yaml
+	default "us-ashburn-1"
+
+choice
+	prompt "Availability Domain"
+	default TERRAFORM_OCI_REGION_IAD_AD1
+	help
+	  The number of the Availability Domain. This number
+	  corresponds to the integer at the end of the Availability
+	  Domain name.
+
+	  The OCI Fault Domain is chosen automatically.
+
+config TERRAFORM_OCI_REGION_IAD_AD1
+	bool "1"
+
+config TERRAFORM_OCI_REGION_IAD_AD2
+	bool "2"
+
+config TERRAFORM_OCI_REGION_IAD_AD3
+	bool "3"
+
+endchoice
+
+config TERRAFORM_OCI_AD_NUMBER
+	int
+	output yaml
+	default 1 if TERRAFORM_OCI_REGION_IAD_AD1
+	default 2 if TERRAFORM_OCI_REGION_IAD_AD2
+	default 3 if TERRAFORM_OCI_REGION_IAD_AD3
+
+endif # TERRAFORM_OCI_REGION_IAD
terraform/oci/kconfigs/regions/Kconfig.us-chicago-1 new file +36 -0
new file mode 100644
index 000000000000..19c3b50c2772
@@ -0,0 +1,36 @@
+if TERRAFORM_OCI_REGION_ORD
+
+config TERRAFORM_OCI_REGION
+	string
+	output yaml
+	default "us-chicago-1"
+
+choice
+	prompt "Availability Domain"
+	default TERRAFORM_OCI_REGION_ORD_AD1
+	help
+	  The number of the Availability Domain. This number
+	  corresponds to the integer at the end of the Availability
+	  Domain name.
+
+	  The OCI Fault Domain is chosen automatically.
+
+config TERRAFORM_OCI_REGION_ORD_AD1
+	bool "1"
+
+config TERRAFORM_OCI_REGION_ORD_AD2
+	bool "2"
+
+config TERRAFORM_OCI_REGION_ORD_AD3
+	bool "3"
+
+endchoice
+
+config TERRAFORM_OCI_AD_NUMBER
+	int
+	output yaml
+	default 1 if TERRAFORM_OCI_REGION_ORD_AD1
+	default 2 if TERRAFORM_OCI_REGION_ORD_AD2
+	default 3 if TERRAFORM_OCI_REGION_ORD_AD3
+
+endif # TERRAFORM_OCI_REGION_ORD
terraform/oci/kconfigs/regions/Kconfig.us-phoenix-1 new file +36 -0
new file mode 100644
index 000000000000..eb8021191ba3
@@ -0,0 +1,36 @@
+if TERRAFORM_OCI_REGION_PHX
+
+config TERRAFORM_OCI_REGION
+	string
+	output yaml
+	default "us-phoenix-1"
+
+choice
+	prompt "Availability Domain"
+	default TERRAFORM_OCI_REGION_PHX_AD1
+	help
+	  The number of the Availability Domain. This number
+	  corresponds to the integer at the end of the Availability
+	  Domain name.
+
+	  The OCI Fault Domain is chosen automatically.
+
+config TERRAFORM_OCI_REGION_PHX_AD1
+	bool "1"
+
+config TERRAFORM_OCI_REGION_PHX_AD2
+	bool "2"
+
+config TERRAFORM_OCI_REGION_PHX_AD3
+	bool "3"
+
+endchoice
+
+config TERRAFORM_OCI_AD_NUMBER
+	int
+	output yaml
+	default 1 if TERRAFORM_OCI_REGION_PHX_AD1
+	default 2 if TERRAFORM_OCI_REGION_PHX_AD2
+	default 3 if TERRAFORM_OCI_REGION_PHX_AD3
+
+endif # TERRAFORM_OCI_REGION_PHX
terraform/oci/kconfigs/regions/Kconfig.us-sanjose-1 new file +28 -0
new file mode 100644
index 000000000000..69b4035f2b9b
@@ -0,0 +1,28 @@
+if TERRAFORM_OCI_REGION_SJC
+
+config TERRAFORM_OCI_REGION
+	string
+	output yaml
+	default "us-sanjose-1"
+
+choice
+	prompt "Availability Domain"
+	default TERRAFORM_OCI_REGION_SJC_AD1
+	help
+	  The number of the Availability Domain. This number
+	  corresponds to the integer at the end of the Availability
+	  Domain name.
+
+	  The OCI Fault Domain is chosen automatically.
+
+config TERRAFORM_OCI_REGION_SJC_AD1
+	bool "1"
+
+endchoice
+
+config TERRAFORM_OCI_AD_NUMBER
+	int
+	output yaml
+	default 1 if TERRAFORM_OCI_REGION_SJC_AD1
+
+endif # TERRAFORM_OCI_REGION_SJC
terraform/oci/main.tf +9 -6
index c96e050b36e2..5520fdbed517 100644
@@ -1,7 +1,12 @@
+data "oci_identity_availability_domain" "kdevops_av_domain" {
+  ad_number      = var.oci_ad_number
+  compartment_id = var.oci_tenancy_ocid
+}
+
 resource "oci_core_instance" "kdevops_instance" {
   count = local.kdevops_num_boxes
 
-  availability_domain = var.oci_availablity_domain
+  availability_domain = data.oci_identity_availability_domain.kdevops_av_domain.name
   compartment_id = var.oci_compartment_ocid
   shape = var.oci_shape
   shape_config {
@@ -30,9 +35,8 @@ resource "oci_core_instance" "kdevops_instance" {
 resource "oci_core_volume" "kdevops_data_disk" {
   count = var.oci_volumes_enable_extra == "true" ? 0 : local.kdevops_num_boxes
 
+  availability_domain = data.oci_identity_availability_domain.kdevops_av_domain.name
   compartment_id = var.oci_compartment_ocid
-
-  availability_domain = var.oci_availablity_domain
   display_name = var.oci_data_volume_display_name
   size_in_gbs = 50
 }
@@ -40,9 +44,8 @@ resource "oci_core_volume" "kdevops_data_disk" {
 resource "oci_core_volume" "kdevops_sparse_disk" {
   count = var.oci_volumes_enable_extra == "true" ? 0 : local.kdevops_num_boxes
 
+  availability_domain = data.oci_identity_availability_domain.kdevops_av_domain.name
   compartment_id = var.oci_compartment_ocid
-
-  availability_domain = var.oci_availablity_domain
   display_name = var.oci_sparse_volume_display_name
   size_in_gbs = 120
 }
@@ -71,7 +74,7 @@ module "volumes" {
   count  = var.oci_volumes_enable_extra == "true" ? local.kdevops_num_boxes : 0
   source = "./volumes"
 
-  vol_availability_domain = var.oci_availablity_domain
+  vol_availability_domain = data.oci_identity_availability_domain.kdevops_av_domain.name
   vol_compartment_ocid    = var.oci_compartment_ocid
   vol_instance_id         = element(oci_core_instance.kdevops_instance.*.id, count.index)
   vol_instance_name       = element(var.kdevops_nodes, count.index)
terraform/oci/vars.tf +5 -5
index 4c6383d9b231..05c3f3769e94 100644
@@ -1,3 +1,8 @@
+variable "oci_ad_number" {
+  description = "Suffix number of availability domain"
+  type        = number
+}
+
 variable "oci_region" {
   description = "An OCI region"
   type        = string
@@ -23,11 +28,6 @@ variable "oci_user_fingerprint" {
   type        = string
 }
 
-variable "oci_availablity_domain" {
-  description = "Name of availability domain"
-  type        = string
-}
-
 variable "oci_compartment_ocid" {
   description = "OCID of compartment"
   type        = string
Signature · 1 line
2.48.1
#14 lore raw

RFC PATCH 14/31 terraform/OCI: Select your compartment by name instead of by OCID

In reply to [email protected]

From: Chuck Lever <[email protected]>

Terraform provides a data source that can map a human-readable compartment name to an OCID. This avoids the need to copy and paste the compartment OCID blob from the OCI cloud console. Just use the human-readable compartment name.

---
 .../templates/oci/terraform.tfvars.j2          |  2 +-
 scripts/terraform.Makefile                     |  1 -
 terraform/oci/kconfigs/Kconfig.location        |  9 ++++-----
 terraform/oci/main.tf                          | 18 +++++++++++++-----
 terraform/oci/vars.tf                          | 10 +++++-----
 5 files changed, 23 insertions(+), 17 deletions(-)
playbooks/roles/gen_tfvars/templates/oci/terraform.tfvars.j2 +1 -1
index 864d5d5a89f0..be0c154802ff 100644
@@ -4,7 +4,7 @@ oci_user_ocid = "{{ terraform_oci_user_ocid }}"
 oci_user_private_key_path = "{{ terraform_oci_user_private_key_path }}"
 oci_user_fingerprint = "{{ terraform_oci_user_fingerprint }}"
 oci_ad_number = {{ terraform_oci_ad_number }}
-oci_compartment_ocid = "{{ terraform_oci_compartment_ocid }}"
+oci_compartment_name = "{{ terraform_oci_compartment_name }}"
 oci_shape = "{{ terraform_oci_shape }}"
 oci_instance_flex_ocpus = {{ terraform_oci_instance_flex_ocpus }}
 oci_instance_flex_memory_in_gbs = {{ terraform_oci_instance_flex_memory_in_gbs }}
scripts/terraform.Makefile +0 -1
index 0aca0b508086..02db2569ee08 100644
@@ -95,7 +95,6 @@ TERRAFORM_EXTRA_VARS += terraform_gce_credentials=$(subst ",,$(CONFIG_TERRAFORM_
 endif
 
 ifeq (y,$(CONFIG_TERRAFORM_OCI))
-TERRAFORM_EXTRA_VARS += terraform_oci_compartment_ocid=$(subst ",,$(CONFIG_TERRAFORM_OCI_COMPARTMENT_OCID))
 TERRAFORM_EXTRA_VARS += terraform_oci_shape=$(subst ",,$(CONFIG_TERRAFORM_OCI_SHAPE))
 TERRAFORM_EXTRA_VARS += terraform_oci_instance_flex_ocpus=$(subst ",,$(CONFIG_TERRAFORM_OCI_INSTANCE_FLEX_OCPUS))
 TERRAFORM_EXTRA_VARS += terraform_oci_instance_flex_memory_in_gbs=$(subst ",,$(CONFIG_TERRAFORM_OCI_INSTANCE_FLEX_MEMORY_IN_GBS))
terraform/oci/kconfigs/Kconfig.location +4 -5
index 7bf5ae49ba03..eff58202f8c7 100644
@@ -45,9 +45,8 @@ source "terraform/oci/kconfigs/regions/Kconfig.us-chicago-1"
 source "terraform/oci/kconfigs/regions/Kconfig.us-phoenix-1"
 source "terraform/oci/kconfigs/regions/Kconfig.us-sanjose-1"
 
-config TERRAFORM_OCI_COMPARTMENT_OCID
-	string "OCI compartment OCID"
+config TERRAFORM_OCI_COMPARTMENT_NAME
+	string "OCI compartment name"
+	output yaml
 	help
-	  The OCI ID of user's compartment.
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
+	  The compartment name where your instances are to be created.
terraform/oci/main.tf +13 -5
index 5520fdbed517..6991644d83b8 100644
@@ -1,3 +1,11 @@
+data "oci_identity_compartments" "kdevops_compartment" {
+  access_level              = "ANY"
+  compartment_id            = var.oci_tenancy_ocid
+  compartment_id_in_subtree = true
+  name                      = var.oci_compartment_name
+  state                     = "ACTIVE"
+}
+
 data "oci_identity_availability_domain" "kdevops_av_domain" {
   ad_number      = var.oci_ad_number
   compartment_id = var.oci_tenancy_ocid
@@ -7,8 +15,8 @@ resource "oci_core_instance" "kdevops_instance" {
   count = local.kdevops_num_boxes
 
   availability_domain = data.oci_identity_availability_domain.kdevops_av_domain.name
-  compartment_id = var.oci_compartment_ocid
-  shape = var.oci_shape
+  compartment_id      = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
+  shape               = var.oci_shape
   shape_config {
     memory_in_gbs = var.oci_instance_flex_memory_in_gbs
     ocpus = var.oci_instance_flex_ocpus
@@ -36,7 +44,7 @@ resource "oci_core_volume" "kdevops_data_disk" {
   count = var.oci_volumes_enable_extra == "true" ? 0 : local.kdevops_num_boxes
 
   availability_domain = data.oci_identity_availability_domain.kdevops_av_domain.name
-  compartment_id = var.oci_compartment_ocid
+  compartment_id = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
   display_name = var.oci_data_volume_display_name
   size_in_gbs = 50
 }
@@ -45,7 +53,7 @@ resource "oci_core_volume" "kdevops_sparse_disk" {
   count = var.oci_volumes_enable_extra == "true" ? 0 : local.kdevops_num_boxes
 
   availability_domain = data.oci_identity_availability_domain.kdevops_av_domain.name
-  compartment_id = var.oci_compartment_ocid
+  compartment_id = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
   display_name = var.oci_sparse_volume_display_name
   size_in_gbs = 120
 }
@@ -75,7 +83,7 @@ module "volumes" {
   source = "./volumes"
 
   vol_availability_domain = data.oci_identity_availability_domain.kdevops_av_domain.name
-  vol_compartment_ocid    = var.oci_compartment_ocid
+  vol_compartment_ocid    = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
   vol_instance_id         = element(oci_core_instance.kdevops_instance.*.id, count.index)
   vol_instance_name       = element(var.kdevops_nodes, count.index)
   vol_volume_count        = var.oci_volumes_per_instance
terraform/oci/vars.tf +5 -5
index 05c3f3769e94..f760fbb776fa 100644
@@ -3,6 +3,11 @@ variable "oci_ad_number" {
   type        = number
 }
 
+variable "oci_compartment_name" {
+  description = "Name of compartment in which to create resources"
+  type        = string
+}
+
 variable "oci_region" {
   description = "An OCI region"
   type        = string
@@ -28,11 +33,6 @@ variable "oci_user_fingerprint" {
   type        = string
 }
 
-variable "oci_compartment_ocid" {
-  description = "OCID of compartment"
-  type        = string
-}
-
 variable "oci_shape" {
   description = "Shape name"
   type        = string
Signature · 1 line
2.48.1
#15 lore raw

RFC PATCH 15/31 terraform/OCI: Use "output yaml" for the instance shape setting

In reply to [email protected]

From: Chuck Lever <[email protected]>

Refactor: Remove the line in terraform.Makefile that sets "terraform_oci_shape" and just pass it directly from Kconfig via an "output yaml" directive.

---
 scripts/terraform.Makefile             | 1 -
 terraform/oci/kconfigs/Kconfig.compute | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)
scripts/terraform.Makefile +0 -1
index 02db2569ee08..a1f510a33536 100644
@@ -95,7 +95,6 @@ TERRAFORM_EXTRA_VARS += terraform_gce_credentials=$(subst ",,$(CONFIG_TERRAFORM_
 endif
 
 ifeq (y,$(CONFIG_TERRAFORM_OCI))
-TERRAFORM_EXTRA_VARS += terraform_oci_shape=$(subst ",,$(CONFIG_TERRAFORM_OCI_SHAPE))
 TERRAFORM_EXTRA_VARS += terraform_oci_instance_flex_ocpus=$(subst ",,$(CONFIG_TERRAFORM_OCI_INSTANCE_FLEX_OCPUS))
 TERRAFORM_EXTRA_VARS += terraform_oci_instance_flex_memory_in_gbs=$(subst ",,$(CONFIG_TERRAFORM_OCI_INSTANCE_FLEX_MEMORY_IN_GBS))
 TERRAFORM_EXTRA_VARS += terraform_oci_os_image_ocid=$(subst ",,$(CONFIG_TERRAFORM_OCI_OS_IMAGE_OCID))
terraform/oci/kconfigs/Kconfig.compute +1 -0
index b794ef2d5190..c9e125dcf37a 100644
@@ -1,5 +1,6 @@
 config TERRAFORM_OCI_SHAPE
 	string "OCI shape name"
+	output yaml
 	help
 	  The name of the shape
 	  Read this:
Signature · 1 line
2.48.1
#16 lore raw

RFC PATCH 16/31 terraform/OCI: Add a shape selector for Flex shapes

In reply to [email protected]

From: Chuck Lever <[email protected]>

It's easier for users to select from a menu of choices rather than to enter a free-form string.

The selector is moved to a separate file to make it straightforward to update (either by a human or a script).

---
 terraform/oci/kconfigs/Kconfig.compute     | 20 +----
 terraform/oci/kconfigs/shapes/Kconfig.flex | 85 ++++++++++++++++++++++
 2 files changed, 86 insertions(+), 19 deletions(-)
 create mode 100644 terraform/oci/kconfigs/shapes/Kconfig.flex
terraform/oci/kconfigs/Kconfig.compute +1 -19
index c9e125dcf37a..dc6427d18f42 100644
@@ -1,22 +1,4 @@
-config TERRAFORM_OCI_SHAPE
-	string "OCI shape name"
-	output yaml
-	help
-	  The name of the shape
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
-
-config TERRAFORM_OCI_INSTANCE_FLEX_OCPUS
-	int "Number of flexiable instance OCPUs"
-	default 2
-	help
-	  The number of OCPUs to use per flexible instance.
-
-config TERRAFORM_OCI_INSTANCE_FLEX_MEMORY_IN_GBS
-	int "How much RAM to use per flexible instance in GB"
-	default 4
-	help
-	  How much GiB of RAM to use per flexible instance.
+source "terraform/oci/kconfigs/shapes/Kconfig.flex"
 
 config TERRAFORM_OCI_OS_IMAGE_OCID
 	string "OCI OS image OCID"
terraform/oci/kconfigs/shapes/Kconfig.flex new file +85 -0

85 lines not on this page · raw message

Signature · 1 line
2.48.1
#17 lore raw

RFC PATCH 17/31 terraform/OCI: Use "output yaml" for the OCPUs setting

In reply to [email protected]

From: Chuck Lever <[email protected]>

Refactor: Remove the line in terraform.Makefile that sets "terraform_oci_instance_flex_ocpus" and just pass it directly from Kconfig via an "output yaml" directive.

As an additional clean up, update the help text.

---
 scripts/terraform.Makefile                 |  1 -
 terraform/oci/kconfigs/shapes/Kconfig.flex | 16 ++++++++++++++--
 2 files changed, 14 insertions(+), 3 deletions(-)
scripts/terraform.Makefile +0 -1
index a1f510a33536..8e4973930125 100644
@@ -95,7 +95,6 @@ TERRAFORM_EXTRA_VARS += terraform_gce_credentials=$(subst ",,$(CONFIG_TERRAFORM_
 endif
 
 ifeq (y,$(CONFIG_TERRAFORM_OCI))
-TERRAFORM_EXTRA_VARS += terraform_oci_instance_flex_ocpus=$(subst ",,$(CONFIG_TERRAFORM_OCI_INSTANCE_FLEX_OCPUS))
 TERRAFORM_EXTRA_VARS += terraform_oci_instance_flex_memory_in_gbs=$(subst ",,$(CONFIG_TERRAFORM_OCI_INSTANCE_FLEX_MEMORY_IN_GBS))
 TERRAFORM_EXTRA_VARS += terraform_oci_os_image_ocid=$(subst ",,$(CONFIG_TERRAFORM_OCI_OS_IMAGE_OCID))
 ifeq (y, $(CONFIG_TERRAFORM_OCI_ASSIGN_PUBLIC_IP))
terraform/oci/kconfigs/shapes/Kconfig.flex +14 -2
index 80ebccc59d6a..d37a498aacd9 100644
@@ -73,10 +73,22 @@ config TERRAFORM_OCI_SHAPE
 	default "VM.Optimized3.Flex" if TERRAFORM_OCI_SHAPE_VM_OPTIMIZED3_FLEX
 
 config TERRAFORM_OCI_INSTANCE_FLEX_OCPUS
-	int "Number of flexible instance OCPUs"
+	int "Instance CPU count"
+	output yaml
 	default 2
 	help
-	  The number of OCPUs to use per flexible instance.
+	  The Oracle CPU (OCPU) represents physical CPU cores and is
+	  the unit of measurement for CPUs on x86 CPUs (AMD and
+	  Intel) and Arm CPUs (OCI Ampere Compute). A virtual CPU
+	  (vCPU), the industry-standard for measuring compute
+	  resources, represents one execution thread of a physical
+	  CPU core.
+
+	  Most CPU architectures, including x86, runs two threads
+	  per physical core, so one OCPU is the equal of two vCPUs
+	  for x86-based compute. For OCI Compute, the minimum unit
+	  of provisioning starts from one OCPU on both X86 (Intel
+	  and AMD) and OCI Ampere Compute processors.
 
 config TERRAFORM_OCI_INSTANCE_FLEX_MEMORY_IN_GBS
 	int "How much RAM to use per flexible instance in GB"
Signature · 1 line
2.48.1
#18 lore raw

RFC PATCH 18/31 terraform/OCI: Use "output yaml" for the memory_in_gbs setting

In reply to [email protected]

From: Chuck Lever <[email protected]>

Refactor: Remove the line in terraform.Makefile that sets "terraform_oci_instance_flex_memory_in_gbs" and just pass it directly from Kconfig via an "output yaml" directive.

As an additional clean up, update the help text.

---
 scripts/terraform.Makefile                 | 1 -
 terraform/oci/kconfigs/shapes/Kconfig.flex | 7 +++++--
 2 files changed, 5 insertions(+), 3 deletions(-)
scripts/terraform.Makefile +0 -1
index 8e4973930125..2750b63b01c0 100644
@@ -95,7 +95,6 @@ TERRAFORM_EXTRA_VARS += terraform_gce_credentials=$(subst ",,$(CONFIG_TERRAFORM_
 endif
 
 ifeq (y,$(CONFIG_TERRAFORM_OCI))
-TERRAFORM_EXTRA_VARS += terraform_oci_instance_flex_memory_in_gbs=$(subst ",,$(CONFIG_TERRAFORM_OCI_INSTANCE_FLEX_MEMORY_IN_GBS))
 TERRAFORM_EXTRA_VARS += terraform_oci_os_image_ocid=$(subst ",,$(CONFIG_TERRAFORM_OCI_OS_IMAGE_OCID))
 ifeq (y, $(CONFIG_TERRAFORM_OCI_ASSIGN_PUBLIC_IP))
 TERRAFORM_EXTRA_VARS += terraform_oci_assign_public_ip=true
terraform/oci/kconfigs/shapes/Kconfig.flex +5 -2
index d37a498aacd9..5ecccf400c6b 100644
@@ -91,7 +91,10 @@ config TERRAFORM_OCI_INSTANCE_FLEX_OCPUS
 	  and AMD) and OCI Ampere Compute processors.
 
 config TERRAFORM_OCI_INSTANCE_FLEX_MEMORY_IN_GBS
-	int "How much RAM to use per flexible instance in GB"
+	int "Instance memory size"
+	output yaml
 	default 4
 	help
-	  How much GiB of RAM to use per flexible instance.
+	  Memory per instance, in GiBs. The minimum value for this
+	  setting is a multiple of the number of OCPUS in each
+	  instance.
Signature · 1 line
2.48.1
#19 lore raw

RFC PATCH 19/31 terraform/OCI: Add a shape family selector

In reply to [email protected]

From: Chuck Lever <[email protected]>

I'd like to add bare metal shapes too, but they seem to be in a separate family in the OCI documentation.

---
 terraform/oci/kconfigs/Kconfig.compute     | 23 ++++++++++++++++++++++
 terraform/oci/kconfigs/shapes/Kconfig.flex |  4 ++++
 2 files changed, 27 insertions(+)
terraform/oci/kconfigs/Kconfig.compute +23 -0
index dc6427d18f42..281ef6d29c95 100644
@@ -1,3 +1,26 @@
+choice
+	prompt "OCI shape family"
+	default TERRAFORM_OCI_SHAPE_FAMILY_FLEX
+	help
+	  This option selects the class of virtual hardware (CPUs and
+	  memory) to provision for each target node. Most CPU
+	  architectures, including x86, run two threads per physical
+	  core, so one OCPU is the equal of two vCPUs for x86-based
+	  compute.
+
+	  Which shapes are available is limited by your subscription
+	  and what hardware has been deployed in your selected region.
+
+config TERRAFORM_OCI_SHAPE_FAMILY_FLEX
+	bool "Flex shapes"
+	help
+	  A flexible shape is a virtual machine that lets you
+	  customize the number of OCPUs and the amount of memory
+	  per instance. The network bandwidth and number of VNICs
+	  scale proportionately with the number of OCPUs.
+
+endchoice
+
 source "terraform/oci/kconfigs/shapes/Kconfig.flex"
 
 config TERRAFORM_OCI_OS_IMAGE_OCID
terraform/oci/kconfigs/shapes/Kconfig.flex +4 -0
index 5ecccf400c6b..67d50604bfcb 100644
@@ -1,3 +1,5 @@
+if TERRAFORM_OCI_SHAPE_FAMILY_FLEX
+
 choice
 	prompt "OCI shape"
 	default TERRAFORM_OCI_SHAPE_VM_STANDARD3_FLEX
@@ -98,3 +100,5 @@ config TERRAFORM_OCI_INSTANCE_FLEX_MEMORY_IN_GBS
 	  Memory per instance, in GiBs. The minimum value for this
 	  setting is a multiple of the number of OCPUS in each
 	  instance.
+
+endif # TERRAFORM_OCI_SHAPE_FAMILY_FLEX
Signature · 1 line
2.48.1
#20 lore raw

RFC PATCH 20/31 terraform/OCI: Add a bare metal shape selector

In reply to [email protected]

From: Chuck Lever <[email protected]>

Match the same capability that is available for kdevops on AWS.

---
 .../templates/oci/terraform.tfvars.j2         |  4 +
 terraform/oci/kconfigs/Kconfig.compute        |  9 ++
 terraform/oci/kconfigs/shapes/Kconfig.bm      | 83 +++++++++++++++++++
 3 files changed, 96 insertions(+)
 create mode 100644 terraform/oci/kconfigs/shapes/Kconfig.bm
playbooks/roles/gen_tfvars/templates/oci/terraform.tfvars.j2 +4 -0
index be0c154802ff..a747a4188e7b 100644
@@ -6,8 +6,12 @@ oci_user_fingerprint = "{{ terraform_oci_user_fingerprint }}"
 oci_ad_number = {{ terraform_oci_ad_number }}
 oci_compartment_name = "{{ terraform_oci_compartment_name }}"
 oci_shape = "{{ terraform_oci_shape }}"
+{% if terraform_oci_instance_flex_ocpus is defined %}
 oci_instance_flex_ocpus = {{ terraform_oci_instance_flex_ocpus }}
+{% endif %}
+{% if terraform_oci_instance_flex_memory_in_gbs is defined %}
 oci_instance_flex_memory_in_gbs = {{ terraform_oci_instance_flex_memory_in_gbs }}
+{% endif %}
 oci_os_image_ocid = "{{ terraform_oci_os_image_ocid }}"
 oci_assign_public_ip = "{{ terraform_oci_assign_public_ip | lower }}"
 oci_subnet_ocid = "{{ terraform_oci_subnet_ocid }}"
terraform/oci/kconfigs/Kconfig.compute +9 -0
index 281ef6d29c95..0e3aac104175 100644
@@ -19,9 +19,18 @@ config TERRAFORM_OCI_SHAPE_FAMILY_FLEX
 	  per instance. The network bandwidth and number of VNICs
 	  scale proportionately with the number of OCPUs.
 
+config TERRAFORM_OCI_SHAPE_FAMILY_BARE_METAL
+	bool "Bare metal"
+	help
+	  A bare metal shape is a whole physical machine without
+	  virtualization. This gives deterministic performance
+	  characteristics but is less configurable than a flex
+	  shape.
+
 endchoice
 
 source "terraform/oci/kconfigs/shapes/Kconfig.flex"
+source "terraform/oci/kconfigs/shapes/Kconfig.bm"
 
 config TERRAFORM_OCI_OS_IMAGE_OCID
 	string "OCI OS image OCID"
terraform/oci/kconfigs/shapes/Kconfig.bm new file +83 -0

83 lines not on this page · raw message

Signature · 1 line
2.48.1
#21 lore raw

RFC PATCH 21/31 terraform/OCI: Use "output yaml" for the source image setting

In reply to [email protected]

From: Chuck Lever <[email protected]>

Refactor: Remove the line in terraform.Makefile that sets "terraform_oci_os_image_ocid" and just pass it directly from Kconfig via an "output yaml" directive.

---
 scripts/terraform.Makefile             | 1 -
 terraform/oci/kconfigs/Kconfig.compute | 3 ++-
 2 files changed, 2 insertions(+), 2 deletions(-)
scripts/terraform.Makefile +0 -1
index 2750b63b01c0..e77f4dd0b474 100644
@@ -95,7 +95,6 @@ TERRAFORM_EXTRA_VARS += terraform_gce_credentials=$(subst ",,$(CONFIG_TERRAFORM_
 endif
 
 ifeq (y,$(CONFIG_TERRAFORM_OCI))
-TERRAFORM_EXTRA_VARS += terraform_oci_os_image_ocid=$(subst ",,$(CONFIG_TERRAFORM_OCI_OS_IMAGE_OCID))
 ifeq (y, $(CONFIG_TERRAFORM_OCI_ASSIGN_PUBLIC_IP))
 TERRAFORM_EXTRA_VARS += terraform_oci_assign_public_ip=true
 else
terraform/oci/kconfigs/Kconfig.compute +2 -1
index 0e3aac104175..e210e9d44dc0 100644
@@ -33,7 +33,8 @@ source "terraform/oci/kconfigs/shapes/Kconfig.flex"
 source "terraform/oci/kconfigs/shapes/Kconfig.bm"
 
 config TERRAFORM_OCI_OS_IMAGE_OCID
-	string "OCI OS image OCID"
+	string "OS image OCID"
+	output yaml
 	help
 	  The OCI ID of the OS image to use.
 	  Read this:
Signature · 1 line
2.48.1
#22 lore raw

RFC PATCH 22/31 terraform/OCI: Simplify image selection

In reply to [email protected]

From: Chuck Lever <[email protected]>

Currently OCI requires users to hunt down the OCID of the particular OS image they wish to deploy by walking through a list of images and regions on Oracle's web site, then copying and pasting the OCID from a region list. This is not terribly user friendly. I'd like to provide a simple menu to make it easier to select an image without spending an hour doing research.

The terraform oracle/oci provider has an "oci_core_images" data source that invokes the ListImages API to search for the OCID of an OS image based on it's family and name. Neat!

Unfortunately, according to:

https://github.com/oracle/terraform-provider-oci/issues/352

the ListImages API returns a list that is dynamically generated on every call. As images are added and removed from OCI, that list will change over time -- in fact it can change between two "terraform apply" calls, which might cause a "terraform destroy" to fail. We want kdevops to have reliable bringup and shutdown to enable automation.

As described in:

https://docs.public.oneportal.content.oci.oraclecloud.com/en-us/iaas/Content/dev/terraform/ref-images.htm#top

the best practice is to stuff fixed image OCIDs into a terraform map variable. It's ugly and requires upkeep, but it guarantees the OCIDs are stable from one "apply" to the next.

kdevops now deals with more than a handful of regions and operating systems, so instead of a terraform map variable, I'm going with a solution where Kconfig selects an image and sets its OCID in the gen_tfvars template. That is functionally equivalent to a map variable but IMO it will be easier for us to maintain (either by hand or automatically via a script).

---
 terraform/oci/kconfigs/Kconfig.compute        |  43 +++-
 .../oci/kconfigs/images/Kconfig.OracleLinux   | 237 ++++++++++++++++++
 terraform/oci/kconfigs/images/Kconfig.Ubuntu  | 162 ++++++++++++
 terraform/oci/kconfigs/images/Kconfig.custom  |  20 ++
 4 files changed, 456 insertions(+), 6 deletions(-)
 create mode 100644 terraform/oci/kconfigs/images/Kconfig.OracleLinux
 create mode 100644 terraform/oci/kconfigs/images/Kconfig.Ubuntu
 create mode 100644 terraform/oci/kconfigs/images/Kconfig.custom
terraform/oci/kconfigs/Kconfig.compute +37 -6
index e210e9d44dc0..ceab066cc5e0 100644
@@ -32,10 +32,41 @@ endchoice
 source "terraform/oci/kconfigs/shapes/Kconfig.flex"
 source "terraform/oci/kconfigs/shapes/Kconfig.bm"
 
-config TERRAFORM_OCI_OS_IMAGE_OCID
-	string "OS image OCID"
-	output yaml
+choice
+	prompt "Distribution"
+	default TERRAFORM_OCI_OPERATING_SYSTEM_ORACLE_LINUX
 	help
-	  The OCI ID of the OS image to use.
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
+	  Select the Linux distribution to install on each instance.
+
+config TERRAFORM_OCI_OPERATING_SYSTEM_ORACLE_LINUX
+	bool "Oracle Linux"
+	help
+	  Select this if you want to use a release of Oracle Linux
+	  as the operating system in your instances.
+
+config TERRAFORM_OCI_OPERATING_SYSTEM_UBUNTU
+	bool "Ubuntu"
+	help
+	  Select this if you want to use a release of Ubuntu Linux
+	  as the operating system in your instances.
+
+config TERRAFORM_OCI_OPERATING_SYSTEM_CUSTOM
+	bool "Custom image OCID"
+	help
+	  Select this if you want to enter a specific OCID for
+	  an OS image. Use this if you wish to use a custom or
+	  marketplace image not included in the fixed choices in
+	  this menu.
+
+	  The image you specify must reside in the same region as
+	  your instances.
+
+	  More image choices are available:
+
+	  https://docs.oracle.com/en-us/iaas/images/
+
+endchoice
+
+source "terraform/oci/kconfigs/images/Kconfig.OracleLinux"
+source "terraform/oci/kconfigs/images/Kconfig.Ubuntu"
+source "terraform/oci/kconfigs/images/Kconfig.custom"
terraform/oci/kconfigs/images/Kconfig.OracleLinux new file +237 -0

237 lines not on this page · raw message

terraform/oci/kconfigs/images/Kconfig.Ubuntu new file +162 -0

162 lines not on this page · raw message

terraform/oci/kconfigs/images/Kconfig.custom new file +20 -0
new file mode 100644
index 000000000000..144b974fbe08
@@ -0,0 +1,20 @@
+if TERRAFORM_OCI_OPERATING_SYSTEM_CUSTOM
+
+config TERRAFORM_OCI_OS_IMAGE_OCID
+	string "OS image OCID"
+	output yaml
+	help
+	  An image is a template of a virtual hard drive. It
+	  contains the operating system and other software for each
+	  instance. Select an image by specifying the OCID of the
+	  image to use. You can select:
+
+	  - An older release than the latest image release
+	  - An older operating system release
+	  - A custom-made image
+
+	  More detail is available:
+
+	  https://docs.oracle.com/en-us/iaas/Content/Compute/References/bringyourownimage.htm
+
+endif # TERRAFORM_OCI_OPERATING_SYSTEM_CUSTOM
Signature · 1 line
2.48.1
#23 lore raw

RFC PATCH 23/31 terraform/OCI: Remove TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA

In reply to [email protected]

From: Chuck Lever <[email protected]>

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.

---
 .../templates/oci/terraform.tfvars.j2         |  6 --
 scripts/terraform.Makefile                    | 11 ---
 terraform/oci/kconfigs/Kconfig.storage        | 75 ++++---------------
 terraform/oci/main.tf                         | 40 +---------
 terraform/oci/vars.tf                         | 19 +----
 5 files changed, 17 insertions(+), 134 deletions(-)
playbooks/roles/gen_tfvars/templates/oci/terraform.tfvars.j2 +0 -6
index a747a4188e7b..fd3d9b853c05 100644
@@ -15,16 +15,10 @@ oci_instance_flex_memory_in_gbs = {{ terraform_oci_instance_flex_memory_in_gbs }
 oci_os_image_ocid = "{{ terraform_oci_os_image_ocid }}"
 oci_assign_public_ip = "{{ terraform_oci_assign_public_ip | lower }}"
 oci_subnet_ocid = "{{ terraform_oci_subnet_ocid }}"
-oci_volumes_enable_extra = "{{ terraform_oci_volumes_enable_extra | lower }}"
-{% if terraform_oci_volumes_enable_extra %}
 oci_volumes_per_instance = {{ terraform_oci_volumes_per_instance }}
 oci_volumes_size = {{ terraform_oci_volumes_size }}
-{% else %}
-oci_data_volume_display_name = "{{ terraform_oci_data_volume_display_name }}"
 oci_data_volume_device_file_name = "{{ terraform_oci_data_volume_device_file_name }}"
-oci_sparse_volume_display_name = "{{ terraform_oci_sparse_volume_display_name }}"
 oci_sparse_volume_device_file_name = "{{ terraform_oci_sparse_volume_device_file_name }}"
-{% endif %}
 
 ssh_config_pubkey_file = "{{ kdevops_terraform_ssh_config_pubkey_file }}"
 ssh_config_user = "{{ kdevops_terraform_ssh_config_user }}"
scripts/terraform.Makefile +0 -11
index e77f4dd0b474..d9e28050a508 100644
@@ -101,17 +101,6 @@ else
 TERRAFORM_EXTRA_VARS += terraform_oci_assign_public_ip=false
 endif
 TERRAFORM_EXTRA_VARS += terraform_oci_subnet_ocid=$(subst ",,$(CONFIG_TERRAFORM_OCI_SUBNET_OCID))
-
-ifeq (y, $(CONFIG_TERRAFORM_OCI_VOLUMES_ENABLE_EXTRA))
-TERRAFORM_EXTRA_VARS += terraform_oci_volumes_enable_extra=true
-else
-TERRAFORM_EXTRA_VARS += terraform_oci_volumes_enable_extra=false
-TERRAFORM_EXTRA_VARS += terraform_oci_data_volume_display_name=$(subst ",,$(CONFIG_TERRAFORM_OCI_DATA_VOLUME_DISPLAY_NAME))
-TERRAFORM_EXTRA_VARS += terraform_oci_sparse_volume_display_name=$(subst ",,$(CONFIG_TERRAFORM_OCI_SPARSE_VOLUME_DISPLAY_NAME))
-endif
-TERRAFORM_EXTRA_VARS += terraform_oci_data_volume_device_file_name=$(subst ",,$(CONFIG_TERRAFORM_OCI_DATA_VOLUME_DEVICE_FILE_NAME))
-TERRAFORM_EXTRA_VARS += terraform_oci_sparse_volume_device_file_name=$(subst ",,$(CONFIG_TERRAFORM_OCI_SPARSE_VOLUME_DEVICE_FILE_NAME))
-
 endif
 
 ifeq (y,$(CONFIG_TERRAFORM_OPENSTACK))
terraform/oci/kconfigs/Kconfig.storage +14 -61

134 lines not on this page · raw message

terraform/oci/main.tf +1 -39
index 6991644d83b8..f6596a104c51 100644
@@ -40,46 +40,8 @@ resource "oci_core_instance" "kdevops_instance" {
   preserve_boot_volume = false
 }
 
-resource "oci_core_volume" "kdevops_data_disk" {
-  count = var.oci_volumes_enable_extra == "true" ? 0 : local.kdevops_num_boxes
-
-  availability_domain = data.oci_identity_availability_domain.kdevops_av_domain.name
-  compartment_id = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
-  display_name = var.oci_data_volume_display_name
-  size_in_gbs = 50
-}
-
-resource "oci_core_volume" "kdevops_sparse_disk" {
-  count = var.oci_volumes_enable_extra == "true" ? 0 : local.kdevops_num_boxes
-
-  availability_domain = data.oci_identity_availability_domain.kdevops_av_domain.name
-  compartment_id = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
-  display_name = var.oci_sparse_volume_display_name
-  size_in_gbs = 120
-}
-
-resource "oci_core_volume_attachment" "kdevops_data_volume_attachment" {
-  count = var.oci_volumes_enable_extra == "true" ? 0 : local.kdevops_num_boxes
-
-  attachment_type = "paravirtualized"
-  instance_id = element(oci_core_instance.kdevops_instance.*.id, count.index)
-  volume_id = element(oci_core_volume.kdevops_data_disk.*.id, count.index)
-
-  device = var.oci_data_volume_device_file_name
-}
-
-resource "oci_core_volume_attachment" "kdevops_sparse_disk_attachment" {
-  count = var.oci_volumes_enable_extra == "true" ? 0 : local.kdevops_num_boxes
-
-  attachment_type = "paravirtualized"
-  instance_id = element(oci_core_instance.kdevops_instance.*.id, count.index)
-  volume_id = element(oci_core_volume.kdevops_sparse_disk.*.id, count.index)
-
-  device = var.oci_sparse_volume_device_file_name
-}
-
 module "volumes" {
-  count  = var.oci_volumes_enable_extra == "true" ? local.kdevops_num_boxes : 0
+  count  = local.kdevops_num_boxes
   source = "./volumes"
 
   vol_availability_domain = data.oci_identity_availability_domain.kdevops_av_domain.name
terraform/oci/vars.tf +2 -17
index f760fbb776fa..7c19720bebc2 100644
@@ -65,11 +65,6 @@ variable "oci_subnet_ocid" {
   type        = string
 }
 
-variable "oci_volumes_enable_extra" {
-  description = "Create additional block volumes per instance"
-  type        = bool
-}
-
 variable "oci_volumes_per_instance" {
   description = "The count of additional block volumes per instance"
   type        = number
@@ -80,22 +75,12 @@ variable "oci_volumes_size" {
   type        = number
 }
 
-variable "oci_data_volume_display_name" {
-  description = "Display name to use for the data volume"
-  type        = string
-}
-
-variable oci_data_volume_device_file_name {
+variable "oci_data_volume_device_file_name" {
   description = "Data volume's device file name"
   type        = string
 }
 
-variable "oci_sparse_volume_display_name" {
-  description = "Display name to use for the sparse volume"
-  type        = string
-}
-
-variable oci_sparse_volume_device_file_name {
+variable "oci_sparse_volume_device_file_name" {
   description = "Sparse volume's device file name"
   type        = string
 }
Signature · 1 line
2.48.1
#24 lore raw

RFC PATCH 24/31 terraform/OCI: Use "output yaml" for the assign_public_ip" setting

In reply to [email protected]

From: Chuck Lever <[email protected]>

Refactor: Remove the line in terraform.Makefile that sets "terraform_oci_assign_public_ip" and just pass it directly from Kconfig via an "output yaml" directive.

As an additional clean up, update the help text.

---
 playbooks/roles/gen_tfvars/defaults/main.yml             | 2 +-
 .../roles/gen_tfvars/templates/oci/terraform.tfvars.j2   | 2 +-
 scripts/terraform.Makefile                               | 5 -----
 terraform/oci/kconfigs/Kconfig.network                   | 9 +++++----
 4 files changed, 7 insertions(+), 11 deletions(-)
playbooks/roles/gen_tfvars/defaults/main.yml +1 -1
index f64102b2fbf5..b6caadcb7e0c 100644
@@ -48,7 +48,7 @@ terraform_gce_scatch_disk_type: "invalid"
 terraform_gce_image_name: "invalid"
 terraform_gce_credentials: "invalid"
 
-terraform_oci_assign_public_ip: "false"
+terraform_oci_assign_public_ip: false
 
 terraform_openstack_cloud_name: "invalid"
 terraform_openstack_instance_prefix: "invalid"
playbooks/roles/gen_tfvars/templates/oci/terraform.tfvars.j2 +1 -1
index fd3d9b853c05..192d72ff32a9 100644
@@ -13,7 +13,7 @@ oci_instance_flex_ocpus = {{ terraform_oci_instance_flex_ocpus }}
 oci_instance_flex_memory_in_gbs = {{ terraform_oci_instance_flex_memory_in_gbs }}
 {% endif %}
 oci_os_image_ocid = "{{ terraform_oci_os_image_ocid }}"
-oci_assign_public_ip = "{{ terraform_oci_assign_public_ip | lower }}"
+oci_assign_public_ip = {{ terraform_oci_assign_public_ip | lower }}
 oci_subnet_ocid = "{{ terraform_oci_subnet_ocid }}"
 oci_volumes_per_instance = {{ terraform_oci_volumes_per_instance }}
 oci_volumes_size = {{ terraform_oci_volumes_size }}
scripts/terraform.Makefile +0 -5
index d9e28050a508..99aadfc51fff 100644
@@ -95,11 +95,6 @@ TERRAFORM_EXTRA_VARS += terraform_gce_credentials=$(subst ",,$(CONFIG_TERRAFORM_
 endif
 
 ifeq (y,$(CONFIG_TERRAFORM_OCI))
-ifeq (y, $(CONFIG_TERRAFORM_OCI_ASSIGN_PUBLIC_IP))
-TERRAFORM_EXTRA_VARS += terraform_oci_assign_public_ip=true
-else
-TERRAFORM_EXTRA_VARS += terraform_oci_assign_public_ip=false
-endif
 TERRAFORM_EXTRA_VARS += terraform_oci_subnet_ocid=$(subst ",,$(CONFIG_TERRAFORM_OCI_SUBNET_OCID))
 endif
 
terraform/oci/kconfigs/Kconfig.network +5 -4
index ab1914c6f6a6..9dc77a266eb4 100644
@@ -1,10 +1,11 @@
 config TERRAFORM_OCI_ASSIGN_PUBLIC_IP
-	bool "Assign public IP address to the cloud instance"
+	bool "Assign public IP address to each instance"
+	output yaml
 	default y
 	help
-	  Select this field if public IP address has to be assigned to
-	  the cloud instance. Otherwise a public IP address is
-	  assigned.
+	  Enable this setting if a public IP address should be
+	  assigned to each instance. Leave it unset to prevent your
+	  instances from being accessible on the public internet.
 
 config TERRAFORM_OCI_SUBNET_OCID
 	string "OCI Subnet OCID"
Signature · 1 line
2.48.1
#25 lore raw

RFC PATCH 25/31 terraform/OCI: Use "output yaml" for the subnet_ocid setting

In reply to [email protected]

From: Chuck Lever <[email protected]>

Refactor: Remove the line in terraform.Makefile that sets "terraform_oci_subnet_ocid" and just pass it directly from Kconfig via an "output yaml" directive.

As an additional clean up, update the help text.

---
 scripts/terraform.Makefile             |  4 ----
 terraform/oci/kconfigs/Kconfig.network | 11 ++++++++---
 2 files changed, 8 insertions(+), 7 deletions(-)
scripts/terraform.Makefile +0 -4
index 99aadfc51fff..8b9bf984fc42 100644
@@ -94,10 +94,6 @@ TERRAFORM_EXTRA_VARS += terraform_gce_image_name=$(subst ",,$(CONFIG_TERRAFORM_G
 TERRAFORM_EXTRA_VARS += terraform_gce_credentials=$(subst ",,$(CONFIG_TERRAFORM_GCE_JSON_CREDENTIALS_PATH))
 endif
 
-ifeq (y,$(CONFIG_TERRAFORM_OCI))
-TERRAFORM_EXTRA_VARS += terraform_oci_subnet_ocid=$(subst ",,$(CONFIG_TERRAFORM_OCI_SUBNET_OCID))
-endif
-
 ifeq (y,$(CONFIG_TERRAFORM_OPENSTACK))
 TERRAFORM_EXTRA_VARS += terraform_openstack_cloud_name=$(subst ",,$(CONFIG_TERRAFORM_TERRAFORM_OPENSTACK_CLOUD_NAME))
 TERRAFORM_EXTRA_VARS += terraform_openstack_instance_prefix=$(subst ",,$(CONFIG_TERRAFORM_TERRAFORM_OPENSTACK_INSTANCE_PREFIX))
terraform/oci/kconfigs/Kconfig.network +8 -3
index 9dc77a266eb4..22d1e5ad3062 100644
@@ -9,7 +9,12 @@ config TERRAFORM_OCI_ASSIGN_PUBLIC_IP
 
 config TERRAFORM_OCI_SUBNET_OCID
 	string "OCI Subnet OCID"
+	output yaml
 	help
-	  The OCI ID of the subnet.
-	  Read this:
-	  https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm
+	  If there is a long-lived VNC and subnet already available
+	  to which to attach kdevops compute instances, specify the
+	  OCID of this subnet via this option.
+
+	  kdevops does not manage this resource. Before running
+	  "make bringup", the subnet must already exist and your OCI
+	  user must have permission to attach to it.
Signature · 1 line
2.48.1
#26 lore raw

RFC PATCH 26/31 terraform/OCI: Add a default VCN

In reply to [email protected]

From: Chuck Lever <[email protected]>

The kdevops set-up for other cloud providers assumes that kdevops will provision a VCN/subnet for use during test runs. OCI does not have that option; it assumes that a long-lived subnet already exists to which kdevops instances should be attached.

In a moment I will introduced a Kconfig option to use network resources that kdevops manages instead of a pre-existing subnet. This patch adds those resources, but does not yet use them, so that the new network resource configuration can be reviewed easily.

---
 terraform/oci/main.tf | 112 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 112 insertions(+)
terraform/oci/main.tf +112 -0
index f6596a104c51..250c3b722537 100644
@@ -51,3 +51,115 @@ module "volumes" {
   vol_volume_count        = var.oci_volumes_per_instance
   vol_volume_size         = var.oci_volumes_size
 }
+
+resource "oci_core_vcn" "kdevops_vcn" {
+  cidr_blocks = [
+    "10.0.0.0/16",
+  ]
+  compartment_id = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
+  display_name   = "kdevops VCN"
+  dns_label      = "kdevops"
+  is_ipv6enabled = false
+}
+
+resource "oci_core_internet_gateway" "kdevops_internet_gateway" {
+  compartment_id = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
+  display_name   = "kdevops internet gateway"
+  vcn_id         = oci_core_vcn.kdevops_vcn.id
+}
+
+resource "oci_core_dhcp_options" "kdevops_dhcp_options" {
+  compartment_id = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
+  display_name   = "kdevops dhcp options"
+  vcn_id         = oci_core_vcn.kdevops_vcn.id
+
+  options {
+    type        = "DomainNameServer"
+    server_type = "VcnLocalPlusInternet"
+  }
+  options {
+    type                = "SearchDomain"
+    search_domain_names = ["kdevops.oraclevcn.com"]
+  }
+}
+
+resource "oci_core_route_table" "kdevops_route_table" {
+  compartment_id = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
+  display_name   = "kdevops route table"
+  vcn_id         = oci_core_vcn.kdevops_vcn.id
+  route_rules {
+    destination       = "0.0.0.0/0"
+    destination_type  = "CIDR_BLOCK"
+    network_entity_id = oci_core_internet_gateway.kdevops_internet_gateway.id
+  }
+}
+
+resource "oci_core_security_list" "kdevops_security_list" {
+  compartment_id = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
+  display_name   = "kdevops security list"
+  vcn_id         = oci_core_vcn.kdevops_vcn.id
+
+  egress_security_rules {
+    description      = "Allow all outbound traffic"
+    destination      = "0.0.0.0/0"
+    destination_type = "CIDR_BLOCK"
+    protocol         = "all"
+    stateless        = false
+  }
+
+  ingress_security_rules {
+    description = "Enable Path MTU Discovery to work"
+    icmp_options {
+      code = 4
+      type = 3
+    }
+    protocol    = 1
+    source      = "0.0.0.0/0"
+    source_type = "CIDR_BLOCK"
+    stateless   = false
+  }
+  ingress_security_rules {
+    description = "Allow applications within VCN to fail fast"
+    icmp_options {
+      type = 3
+    }
+    protocol    = 1
+    source      = "10.0.0.0/16"
+    source_type = "CIDR_BLOCK"
+    stateless   = false
+  }
+  ingress_security_rules {
+    description = "Enable instance management via Ansible"
+    protocol    = 6
+    source      = "0.0.0.0/0"
+    source_type = "CIDR_BLOCK"
+    stateless   = false
+    tcp_options {
+      min = 22
+      max = 22
+    }
+  }
+  ingress_security_rules {
+    description = "Allow VCN-local TCP traffic for ports: all"
+    protocol    = 6
+    source      = "10.0.0.0/16"
+    source_type = "CIDR_BLOCK"
+    stateless   = false
+    tcp_options {
+      min = 1
+      max = 65535
+    }
+  }
+}
+
+resource "oci_core_subnet" "kdevops_subnet" {
+  availability_domain = data.oci_identity_availability_domain.kdevops_av_domain.name
+  cidr_block          = "10.0.0.0/24"
+  compartment_id      = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
+  dhcp_options_id     = oci_core_dhcp_options.kdevops_dhcp_options.id
+  dns_label           = "runners"
+  display_name        = "kdevops subnet"
+  route_table_id      = oci_core_route_table.kdevops_route_table.id
+  security_list_ids   = ["${oci_core_security_list.kdevops_security_list.id}"]
+  vcn_id              = oci_core_vcn.kdevops_vcn.id
+}
Signature · 1 line
2.48.1
#27 lore raw

RFC PATCH 27/31 terraform/OCI: Add a Kconfig switch to create a VCN on the fly

In reply to [email protected]

From: Chuck Lever <[email protected]>

Make it simpler to use OCI: create a kdevops VCN if there isn't already a persistent VCN to use.

---
 playbooks/roles/gen_tfvars/defaults/main.yml  |  1 +
 .../templates/oci/terraform.tfvars.j2         |  3 ++
 terraform/oci/kconfigs/Kconfig.network        | 19 +++++++++++
 terraform/oci/main.tf                         | 32 +++++++++++++------
 terraform/oci/vars.tf                         |  6 ++++
 5 files changed, 51 insertions(+), 10 deletions(-)
playbooks/roles/gen_tfvars/defaults/main.yml +1 -0
index b6caadcb7e0c..24b932974f36 100644
@@ -49,6 +49,7 @@ terraform_gce_image_name: "invalid"
 terraform_gce_credentials: "invalid"
 
 terraform_oci_assign_public_ip: false
+terraform_oci_use_existing_vcn: false
 
 terraform_openstack_cloud_name: "invalid"
 terraform_openstack_instance_prefix: "invalid"
playbooks/roles/gen_tfvars/templates/oci/terraform.tfvars.j2 +3 -0
index 192d72ff32a9..56402d13630b 100644
@@ -14,7 +14,10 @@ oci_instance_flex_memory_in_gbs = {{ terraform_oci_instance_flex_memory_in_gbs }
 {% endif %}
 oci_os_image_ocid = "{{ terraform_oci_os_image_ocid }}"
 oci_assign_public_ip = {{ terraform_oci_assign_public_ip | lower }}
+oci_use_existing_vcn = {{ terraform_oci_use_existing_vcn | lower }}
+{% if terraform_oci_use_existing_vcn %}
 oci_subnet_ocid = "{{ terraform_oci_subnet_ocid }}"
+{% endif %}
 oci_volumes_per_instance = {{ terraform_oci_volumes_per_instance }}
 oci_volumes_size = {{ terraform_oci_volumes_size }}
 oci_data_volume_device_file_name = "{{ terraform_oci_data_volume_device_file_name }}"
terraform/oci/kconfigs/Kconfig.network +19 -0
index 22d1e5ad3062..8130ca04de6d 100644
@@ -7,6 +7,23 @@ config TERRAFORM_OCI_ASSIGN_PUBLIC_IP
 	  assigned to each instance. Leave it unset to prevent your
 	  instances from being accessible on the public internet.
 
+config TERRAFORM_OCI_USE_EXISTING_VCN
+	bool "Attach instances to an existing VCN"
+	output yaml
+	default y
+	help
+	  If your tenancy administrator prefers to create and secure
+	  the network resources used within a compartment, or your
+	  tenancy has special networking requirements, enable this
+	  option. Then enter the OCID of the existing subnet in the
+	  TERRAFORM_OCI_SUBNET_OCID option below. kdevops will join
+	  its compute instances to that subnet.
+
+	  Disable this option if you'd like kdevops to create a
+	  secure VPN and subnet automatically.
+
+if TERRAFORM_OCI_USE_EXISTING_VCN
+
 config TERRAFORM_OCI_SUBNET_OCID
 	string "OCI Subnet OCID"
 	output yaml
@@ -18,3 +35,5 @@ config TERRAFORM_OCI_SUBNET_OCID
 	  kdevops does not manage this resource. Before running
 	  "make bringup", the subnet must already exist and your OCI
 	  user must have permission to attach to it.
+
+endif # TERRAFORM_OCI_USE_EXISTING_VCN
terraform/oci/main.tf +22 -10
index 250c3b722537..20aa7c5a612b 100644
@@ -30,7 +30,7 @@ resource "oci_core_instance" "kdevops_instance" {
 
   create_vnic_details {
     assign_public_ip = var.oci_assign_public_ip
-    subnet_id = var.oci_subnet_ocid
+    subnet_id        = var.oci_use_existing_vcn ? var.oci_subnet_ocid : one(oci_core_subnet.kdevops_subnet[*].id)
   }
 
   metadata = {
@@ -53,6 +53,8 @@ module "volumes" {
 }
 
 resource "oci_core_vcn" "kdevops_vcn" {
+  count = var.oci_use_existing_vcn ? 0 : 1
+
   cidr_blocks = [
     "10.0.0.0/16",
   ]
@@ -63,15 +65,19 @@ resource "oci_core_vcn" "kdevops_vcn" {
 }
 
 resource "oci_core_internet_gateway" "kdevops_internet_gateway" {
+  count = var.oci_use_existing_vcn ? 0 : 1
+
   compartment_id = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
   display_name   = "kdevops internet gateway"
-  vcn_id         = oci_core_vcn.kdevops_vcn.id
+  vcn_id         = one(oci_core_vcn.kdevops_vcn[*].id)
 }
 
 resource "oci_core_dhcp_options" "kdevops_dhcp_options" {
+  count = var.oci_use_existing_vcn ? 0 : 1
+
   compartment_id = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
   display_name   = "kdevops dhcp options"
-  vcn_id         = oci_core_vcn.kdevops_vcn.id
+  vcn_id         = one(oci_core_vcn.kdevops_vcn[*].id)
 
   options {
     type        = "DomainNameServer"
@@ -84,20 +90,24 @@ resource "oci_core_dhcp_options" "kdevops_dhcp_options" {
 }
 
 resource "oci_core_route_table" "kdevops_route_table" {
+  count = var.oci_use_existing_vcn ? 0 : 1
+
   compartment_id = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
   display_name   = "kdevops route table"
-  vcn_id         = oci_core_vcn.kdevops_vcn.id
+  vcn_id         = one(oci_core_vcn.kdevops_vcn[*].id)
   route_rules {
     destination       = "0.0.0.0/0"
     destination_type  = "CIDR_BLOCK"
-    network_entity_id = oci_core_internet_gateway.kdevops_internet_gateway.id
+    network_entity_id = one(oci_core_internet_gateway.kdevops_internet_gateway[*].id)
   }
 }
 
 resource "oci_core_security_list" "kdevops_security_list" {
+  count = var.oci_use_existing_vcn ? 0 : 1
+
   compartment_id = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
   display_name   = "kdevops security list"
-  vcn_id         = oci_core_vcn.kdevops_vcn.id
+  vcn_id         = one(oci_core_vcn.kdevops_vcn[*].id)
 
   egress_security_rules {
     description      = "Allow all outbound traffic"
@@ -153,13 +163,15 @@ resource "oci_core_security_list" "kdevops_security_list" {
 }
 
 resource "oci_core_subnet" "kdevops_subnet" {
+  count = var.oci_use_existing_vcn ? 0 : 1
+
   availability_domain = data.oci_identity_availability_domain.kdevops_av_domain.name
   cidr_block          = "10.0.0.0/24"
   compartment_id      = data.oci_identity_compartments.kdevops_compartment.compartments[0].id
-  dhcp_options_id     = oci_core_dhcp_options.kdevops_dhcp_options.id
+  dhcp_options_id     = one(oci_core_dhcp_options.kdevops_dhcp_options[*].id)
   dns_label           = "runners"
   display_name        = "kdevops subnet"
-  route_table_id      = oci_core_route_table.kdevops_route_table.id
-  security_list_ids   = ["${oci_core_security_list.kdevops_security_list.id}"]
-  vcn_id              = oci_core_vcn.kdevops_vcn.id
+  route_table_id      = one(oci_core_route_table.kdevops_route_table[*].id)
+  security_list_ids   = ["${one(oci_core_security_list.kdevops_security_list[*].id)}"]
+  vcn_id              = one(oci_core_vcn.kdevops_vcn[*].id)
 }
terraform/oci/vars.tf +6 -0
index 7c19720bebc2..225ebdf51648 100644
@@ -61,10 +61,16 @@ variable "oci_assign_public_ip" {
 }
 
 variable "oci_subnet_ocid" {
+  default     = null
   description = "Subnet OCID"
   type        = string
 }
 
+variable "oci_use_existing_vcn" {
+  description = "Use a pre-existing VCN"
+  type        = bool
+}
+
 variable "oci_volumes_per_instance" {
   description = "The count of additional block volumes per instance"
   type        = number
Signature · 1 line
2.48.1
#28 lore raw

RFC PATCH 28/31 terraform/OCI: Run "terraform fmt" on provider.tf

In reply to [email protected]

From: Chuck Lever <[email protected]>

And alphabetize.

---
 terraform/oci/provider.tf | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
terraform/oci/provider.tf +5 -5
index 80361d3ac562..5bea98de7f4f 100644
@@ -2,9 +2,9 @@ terraform {
 }
 
 provider "oci" {
-  tenancy_ocid			= var.oci_tenancy_ocid
-  user_ocid			= var.oci_user_ocid
-  private_key_path		= var.oci_user_private_key_path
-  fingerprint			= var.oci_user_fingerprint
-  region			= var.oci_region
+  fingerprint      = var.oci_user_fingerprint
+  private_key_path = var.oci_user_private_key_path
+  region           = var.oci_region
+  tenancy_ocid     = var.oci_tenancy_ocid
+  user_ocid        = var.oci_user_ocid
 }
Signature · 1 line
2.48.1
#29 lore raw

RFC PATCH 29/31 terraform/OCI: Run "terraform fmt" on main.tf

In reply to [email protected]

From: Chuck Lever <[email protected]>

---
 terraform/oci/main.tf | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
terraform/oci/main.tf +2 -2
index 20aa7c5a612b..d231f2225e5d 100644
@@ -19,10 +19,10 @@ resource "oci_core_instance" "kdevops_instance" {
   shape               = var.oci_shape
   shape_config {
     memory_in_gbs = var.oci_instance_flex_memory_in_gbs
-    ocpus = var.oci_instance_flex_ocpus
+    ocpus         = var.oci_instance_flex_ocpus
   }
   source_details {
-    source_id = var.oci_os_image_ocid
+    source_id   = var.oci_os_image_ocid
     source_type = "image"
   }
 
Signature · 1 line
2.48.1
#30 lore raw

RFC PATCH 30/31 terraform/OCI: Nit: alphabetize vars.tf

In reply to [email protected]

From: Chuck Lever <[email protected]>

It's getting to be a large file. I find alphabetic order makes it quicker to eyeball.

---
 terraform/oci/vars.tf | 96 +++++++++++++++++++++----------------------
 1 file changed, 48 insertions(+), 48 deletions(-)
terraform/oci/vars.tf +48 -48
index 225ebdf51648..f2b7a6e69000 100644
@@ -3,21 +3,69 @@ variable "oci_ad_number" {
   type        = number
 }
 
+variable "oci_assign_public_ip" {
+  description = "Assign public IP to the instance"
+  type        = bool
+}
+
 variable "oci_compartment_name" {
   description = "Name of compartment in which to create resources"
   type        = string
 }
 
+variable "oci_data_volume_device_file_name" {
+  description = "Data volume's device file name"
+  type        = string
+}
+
+variable "oci_instance_flex_memory_in_gbs" {
+  default     = null
+  description = "The total amount of memory available to the instance, in gigabytes."
+  type        = number
+}
+
+variable "oci_instance_flex_ocpus" {
+  default     = null
+  description = "The total number of OCPUs available to the instance."
+  type        = number
+}
+
+variable "oci_os_image_ocid" {
+  description = "OCID of OS image"
+  type        = string
+}
+
 variable "oci_region" {
   description = "An OCI region"
   type        = string
 }
 
+variable "oci_shape" {
+  description = "Shape name"
+  type        = string
+}
+
+variable "oci_sparse_volume_device_file_name" {
+  description = "Sparse volume's device file name"
+  type        = string
+}
+
+variable "oci_subnet_ocid" {
+  default     = null
+  description = "Subnet OCID"
+  type        = string
+}
+
 variable "oci_tenancy_ocid" {
   description = "OCID of your tenancy"
   type        = string
 }
 
+variable "oci_user_fingerprint" {
+  description = "Fingerprint for the key pair being used"
+  type        = string
+}
+
 variable "oci_user_ocid" {
   description = "OCID of the user calling the API"
   type        = string
@@ -28,44 +76,6 @@ variable "oci_user_private_key_path" {
   type        = string
 }
 
-variable "oci_user_fingerprint" {
-  description = "Fingerprint for the key pair being used"
-  type        = string
-}
-
-variable "oci_shape" {
-  description = "Shape name"
-  type        = string
-}
-
-variable "oci_instance_flex_ocpus" {
-  default     = null
-  description = "The total number of OCPUs available to the instance."
-  type        = number
-}
-
-variable "oci_instance_flex_memory_in_gbs" {
-  default     = null
-  description = "The total amount of memory available to the instance, in gigabytes."
-  type        = number
-}
-
-variable "oci_os_image_ocid" {
-  description = "OCID of OS image"
-  type        = string
-}
-
-variable "oci_assign_public_ip" {
-  description = "Assign public IP to the instance"
-  type        = bool
-}
-
-variable "oci_subnet_ocid" {
-  default     = null
-  description = "Subnet OCID"
-  type        = string
-}
-
 variable "oci_use_existing_vcn" {
   description = "Use a pre-existing VCN"
   type        = bool
@@ -80,13 +90,3 @@ variable "oci_volumes_size" {
   description = "The size of additional block volumes, in gibibytes"
   type        = number
 }
-
-variable "oci_data_volume_device_file_name" {
-  description = "Data volume's device file name"
-  type        = string
-}
-
-variable "oci_sparse_volume_device_file_name" {
-  description = "Sparse volume's device file name"
-  type        = string
-}
Signature · 1 line
2.48.1
#31 lore raw

RFC PATCH 31/31 terraform/OCI: Update the OCI section of docs/kdevops-terraform.md

In reply to [email protected]

From: Chuck Lever <[email protected]>

Update documentation URLs, focus on the basics.

---
 docs/kdevops-terraform.md | 117 ++++++++++++--------------------------
 1 file changed, 35 insertions(+), 82 deletions(-)
docs/kdevops-terraform.md +35 -82
index 5e5107fef73e..34ac1a19eff1 100644
@@ -298,86 +298,39 @@ https://www.terraform.io/docs/providers/google/index.html
 https://cloud.google.com/iam/docs/granting-roles-to-service-accounts#granting_access_to_a_service_account_for_a_resource
 
 ### OCI - Oracle Cloud Infrastructure
-OCI documentation is located at
-1. https://docs.oracle.com/en-us/iaas/Content/home.htm
-2. https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraform.htm
 
-The following is a list of OCI specific configuration variables that the user
-needs to provide values (through `make menuconfig` interface).
-  1. `CONFIG_TERRAFORM_SSH_CONFIG_USER`
-	 - User name used for the logging into the cloud instance.
-     - Please use,
-	   - `opc` for Oracle Linux.
-	   - `ubuntu` for Ubuntu Linux
-  2. `CONFIG_TERRAFORM_SSH_CONFIG_PUBKEY_FILE`
-     - Path to user's ssh public key (e.g. `~/.ssh/id_rsa.pub`).
-     - This key will be copied over to the cloud instance during its
-       creation.
-  3. `CONFIG_TERRAFORM_OCI_REGION`
-	 - String representing the name of the region (e.g. `us-ashburn-1`).
-     - https://docs.oracle.com/en-us/iaas/Content/anomaly/using/regions.htm
-     - List of the regions can be found at
-       https://docs.oracle.com/en-us/iaas/Content/General/Concepts/regions.htm 
-  4. `CONFIG_TERRAFORM_OCI_TENANCY_OCID`
-	 - OCID of the tenancy being used.
-     - In order to obtain the OCID, Please refer to
-	   https://docs.oracle.com/en-us/iaas/Content/GSG/Tasks/contactingsupport_topic-Finding_Your_Tenancy_OCID_Oracle_Cloud_Identifier.htm 
-  5. `CONFIG_TERRAFORM_OCI_USER_OCID`
-	 - OCID of the user.
-     - In order to obtain the OCID, Please refer to
-       https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm#five
-  6. `CONFIG_TERRAFORM_OCI_USER_PRIVATE_KEY_PATH`
-	 - Path to API private key.
-	 - Documentation
-	   - Generating API keys.
-	     Refer to section `Generating an API Signing Key (Linux and Mac OS X)`
-	     at
-	     https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm
-	   - Uploading Public API key.
-	     Refer to section `How to Upload the Public Key` at
-	     https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm 
-       - Video: https://www.youtube.com/watch?v=LMvYOSkXF1k
-  7. `CONFIG_TERRAFORM_OCI_USER_FINGERPRINT`
-     - Finger print of the API key.
-  8. `CONFIG_TERRAFORM_OCI_AVAILABLITY_DOMAIN` ="VkEH:US-ASHBURN-AD-3"
-     - String specifying the availability domain to use in the region
-	 - Availability domain names can be obtained from the web page used to
-       launch an cloud instance.
-  9. `CONFIG_TERRAFORM_OCI_COMPARTMENT_OCID`
-	 - OCID of the compartment can be obtained by following the instructions
-	   at
-	   https://docs.oracle.com/en-us/iaas/Content/GSG/Tasks/contactingsupport_topic-Finding_the_OCID_of_a_Compartment.htm
-  10. `CONFIG_TERRAFORM_OCI_SHAPE`="VM.Standard.E2.8"
-      - String representing the name of the compute shape to create.
-      - https://docs.oracle.com/en-us/iaas/Content/Compute/References/computeshapes.htm
-  11. `CONFIG_TERRAFORM_OCI_OS_IMAGE_OCID`
-	  - OCID of the OS image to be installed.
-      - Image's OCID can be obtained by following instructions at
-	    https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformbestpractices_topic-Referencing_Images.htm
-  12. `CONFIG_TERRAFORM_OCI_SUBNET_OCID`
-	  - OCID of the subnet to be assigned to the cloud instance.
-      - Overview:
-        https://docs.oracle.com/en-us/iaas/Content/Network/Tasks/Overview_of_VCNs_and_Subnets.htm
-      - Instructions on how to get a list of available subnets can be found at
-        https://docs.oracle.com/en-us/iaas/Content/Network/Tasks/get-subnet.htm 
-      - Click on the hamburger menu provided the right side of a subnet entry
-        and select `Copy OCID`.
-  13. `CONFIG_TERRAFORM_OCI_DATA_VOLUME_DISPLAY_NAME`
-	  - String representing the name for the `data` disk.
-      - This is used for storing sources and binaries corresponding to Linux
-        kernel, Fstests & Kdevops.
-  14. `CONFIG_TERRAFORM_OCI_DATA_VOLUME_DEVICE_FILE_NAME`
-      - Device node to be used for `data` disk.
-      - Please specify `/dev/oracleoci/oraclevdb` as the device file.
-  15. `CONFIG_TERRAFORM_OCI_SPARSE_VOLUME_DISPLAY_NAME`
-	  - String representing the name for the `sparse` disk.
-      - This is used for creating regular files to back loop devices.
-  16. `CONFIG_TERRAFORM_OCI_SPARSE_VOLUME_DEVICE_FILE_NAME`
-      - Device node to be used for `sparse` disk.
-      - Please specify `/dev/oracleoci/oraclevdc` as the device file.
-  17. `CONFIG_TERRAFORM_OCI_INSTANCE_FLEX_OCPUS`
-      - Number of OCPUs for a flexiable compute shape.
-      - https://docs.oracle.com/en-us/iaas/Content/Compute/References/computeshapes.htm#flexible
-  18. `CONFIG_TERRAFORM_OCI_INSTANCE_FLEX_MEMORY_IN_GBS`
-      - Amount of RAM in GB for a flexiable compute shape.
-      - https://docs.oracle.com/en-us/iaas/Content/Compute/References/computeshapes.htm#flexible
+kdevops supports using the OCI Public Cloud (OCI).
+
+#### New To OCI?
+
+You can find a generic tutorial guide at the following link. You'll
+need many (but not all) of these steps to bring up kdevops with OCI.
+
+https://docs.oracle.com/en-us/iaas/Content/dev/terraform/tutorials/tf-provider.htm
+
+This explains what an "OCID" is:
+
+https://docs.oracle.com/en-us/iaas/Content/General/Concepts/identifiers.htm
+
+#### Quick Start
+
+To authenticate to the Oracle cloud, kdevops uses the API Key
+authentication method, described here:
+
+ https://docs.oracle.com/en-us/iaas/Content/API/Concepts/apisigningkey.htm
+
+Copy these items into the Kconfig settings under the "Identity &
+Access" submenu. Additional guidance is available in the Kconfig
+help text in this menu.
+
+OCI pre-configures an admin ssh user on each instance. Under the
+CONFIG_TERRAFORM_SSH_CONFIG_USER option, you need to explicitly set
+kconfig's ssh login name depending on which OS image you have
+selected:
+
+   - `opc` for Oracle Linux.
+   - `ubuntu` for Ubuntu Linux
+
+If your Ansible controller (where you run "make bringup") and your
+test instances operate inside the same subnet, you can disable the
+TERRAFORM_OCI_ASSIGN_PUBLIC_IP option for better network security.
Signature · 1 line
2.48.1
Reviewed-by on the v1 series
#32 lore raw
In reply to [email protected]
Quoted 3 lines · On Mon, Mar 31, 2025 at 08:59:29PM -0400, [email protected] wrote:

From: Chuck Lever <[email protected]>
I've come up with some simplifications that can apply to all of the providers, but I'd like to start with OCI because

Quoted 1 line
 26 files changed, 1472 insertions(+), 556 deletions(-)

That's huge, for all this! I know AWS supports a simple .aws/credentials and I think OCI might too support something similar. If so that might beg the question if eventually we should transition to just that to help simplify things on bring up even further. That should enable users to quickly "fly" on enablement.

Other than that, any chance you might be up to add yourself as the cloud / terraform maintainer under MAINTAINERS ?

Luis

#33 lore raw
Quoted 10 lines · Luis Chamberlain
Quoted 3 lines · On Mon, Mar 31, 2025 at 08:59:29PM -0400, [email protected] wrote:

From: Chuck Lever <[email protected]>
I've come up with some simplifications that can apply to all of the providers, but I'd like to start with OCI because

Quoted 1 line
 26 files changed, 1472 insertions(+), 556 deletions(-)

That's huge, for all this!

I meant: thanks for all this!

Luis

#34 lore raw
In reply to Luis Chamberlain
Quoted 6 lines · Luis Chamberlain
Quoted 3 lines · On Mon, Mar 31, 2025 at 08:59:29PM -0400, [email protected] wrote:

From: Chuck Lever <[email protected]>
I've come up with some simplifications that can apply to all of the providers, but I'd like to start with OCI because

Thanks for taking a look!

I guess my basic concern here is that I'm changing the name of some Kconfig variables, which would break backwards compatibility.

If you and Chandan feel that is not a roadblock, then I will start committing these and the similar patches I have for the other three major providers.

Quoted 7 lines
Quoted 1 line
 26 files changed, 1472 insertions(+), 556 deletions(-)

That's huge, for all this! I know AWS supports a simple .aws/credentials and I think OCI might too support something similar. If so that might beg the question if eventually we should transition to just that to help simplify things on bring up even further. That should enable users to quickly "fly" on enablement.

The varying way that the providers handle authentication is one of the triggers that started me down this road. I would like something that is easy to bring up and matches the authentication that each provider's CLI tool does.

I'm still on the fence about whether keeping the secrets in the kdevops .config or in environment variables or in a ~/.{aws,oci,azure} profile is the better approach. I was thinking of enabling all these possibilities and let users choose which one suits their security requirements...

The values of environment variables, I will note, are leaked into the Buildbot log. The best answer might therefore be ~/.oci/profile etc.

Quoted 2 lines

Other than that, any chance you might be up to add yourself as the cloud / terraform maintainer under MAINTAINERS ?

I can do that.

I promise I will hang out for a beer next time we meet f2f!

Signature · 1 line
Chuck Lever
#35 lore raw
Quoted 6 lines · Chuck Lever
Quoted 5 lines · Luis Chamberlain
Quoted 3 lines · On Mon, Mar 31, 2025 at 08:59:29PM -0400, [email protected] wrote:

From: Chuck Lever <[email protected]>
I've come up with some simplifications that can apply to all of the providers, but I'd like to start with OCI because

Quoted 6 lines
Quoted 1 line

Thanks for taking a look!

I guess my basic concern here is that I'm changing the name of some Kconfig variables, which would break backwards compatibility.

I've addressed concerns like that befored by adding a respective kconfig value and mapping the old one to the new shiny one with an XXX to annotate we should remove the older one later. But if for cloud I suspect most users might stick to that version of kdevops and have no need to upgrade too, and so I am not sure if its needed as much as the guest / virtualization use case.

Quoted 3 lines

If you and Chandan feel that is not a roadblock, then I will start committing these and the similar patches I have for the other three major providers.

My use cases of cloud are all completely ephemeral and stuck to one version of kdevops in particular because of the cost, and so I am careful to always 'make destroy' as soon as I'm done otheriwse you can economically bleed. And so I think economics drives kdevops cloud instances to be super ephemeral.

So for *me*, I say go for it.

But I am not sure if other folks are using kdevops for the cloud in other ways, but certainly Chandan would have good sensing on that.

Quoted 4 lines

The varying way that the providers handle authentication is one of the triggers that started me down this road. I would like something that is easy to bring up and matches the authentication that each provider's CLI tool does.

Definitely.

Quoted 2 lines

I'm still on the fence about whether keeping the secrets in the kdevops .config

Secrets don't have to be part of an output .config, they should not. The reasin being that we want to support using cloud for CI too and in doing so we don't want any secrets leaked out on .config as we automatically upload to kdevops-results-archive the .config used so to enable reproducible CI builds / testing. If you look at kdevops-results-archive the .configs are never sensitive to the environment or host. Its just generic info.

We support some secrets for enterprise releases like SUSE, but I forget what was done for RHEL. At least for SUSE the expectations is that you fill in a yaml optional secret file readin for extra vars. Even if we had a new "output private_yaml" that kconfig symbol would still be part of .config, and so if we wantd to add a "output private_yaml" we'd have to negate the entry being put on .config but not sure if that may mess with Kconfig's dep mechanisms.

Quoted 1 line

or in environment variables or in a ~/.{aws,oci,azure}

The nice thing about ~/.{aws,oci,azure} is its out of the way and we just infer you have it, we never have any of that added to .config.

Quoted 3 lines

profile is the better approach. I was thinking of enabling all these possibilities and let users choose which one suits their security requirements...

Makes sense. We know AWS supports it, OCI I have heard does too, but not sure about azure.

Quoted 2 lines

The values of environment variables, I will note, are leaked into the Buildbot log.

Oh no.

Quoted 1 line

The best answer might therefore be ~/.oci/profile etc.

I think that's a clean simple solution to the problem, if we can support it.

Quoted 6 lines
Quoted 2 lines

Other than that, any chance you might be up to add yourself as the cloud / terraform maintainer under MAINTAINERS ?

I can do that.

I promise I will hang out for a beer next time we meet f2f!

Great!

Luis

Reviewed-by
#36 lore raw
Quoted 31 lines · Luis Chamberlain
Quoted 6 lines · Chuck Lever
Quoted 5 lines · Luis Chamberlain
Quoted 3 lines · On Mon, Mar 31, 2025 at 08:59:29PM -0400, [email protected] wrote:

From: Chuck Lever <[email protected]>
I've come up with some simplifications that can apply to all of the providers, but I'd like to start with OCI because

Quoted 6 lines
Quoted 1 line

Thanks for taking a look!

I guess my basic concern here is that I'm changing the name of some Kconfig variables, which would break backwards compatibility.

I've addressed concerns like that befored by adding a respective kconfig value and mapping the old one to the new shiny one with an XXX to annotate we should remove the older one later. But if for cloud I suspect most users might stick to that version of kdevops and have no need to upgrade too, and so I am not sure if its needed as much as the guest / virtualization use case.

Quoted 3 lines

If you and Chandan feel that is not a roadblock, then I will start committing these and the similar patches I have for the other three major providers.

My use cases of cloud are all completely ephemeral and stuck to one version of kdevops in particular because of the cost, and so I am careful to always 'make destroy' as soon as I'm done otheriwse you can economically bleed. And so I think economics drives kdevops cloud instances to be super ephemeral.

Quoted 5 lines

So for *me*, I say go for it.

But I am not sure if other folks are using kdevops for the cloud in other ways, but certainly Chandan would have good sensing on that.

The changes made by the patchset definitely improve the usability of OCI via kdevops. Thanks for working on this.

Also, Can you please include the VM.Standard.x86.Generic shape in the list of shapes introduced by "[RFC PATCH 16/31] terraform/OCI: Add a shape selector for Flex shapes" patch. This shape is recommended for developers from my department who do not require a specific model of CPU for their work.

Signature · 1 line
Chandan
#37 lore raw
Quoted 34 lines · Chandan Babu R
Quoted 33 lines · Luis Chamberlain
Quoted 6 lines · Chuck Lever
Quoted 5 lines · Luis Chamberlain
Quoted 3 lines · On Mon, Mar 31, 2025 at 08:59:29PM -0400, [email protected] wrote:

From: Chuck Lever <[email protected]>
I've come up with some simplifications that can apply to all of the providers, but I'd like to start with OCI because

Quoted 6 lines
Quoted 1 line

Thanks for taking a look!

I guess my basic concern here is that I'm changing the name of some Kconfig variables, which would break backwards compatibility.

I've addressed concerns like that befored by adding a respective kconfig value and mapping the old one to the new shiny one with an XXX to annotate we should remove the older one later. But if for cloud I suspect most users might stick to that version of kdevops and have no need to upgrade too, and so I am not sure if its needed as much as the guest / virtualization use case.

Quoted 3 lines

If you and Chandan feel that is not a roadblock, then I will start committing these and the similar patches I have for the other three major providers.

My use cases of cloud are all completely ephemeral and stuck to one version of kdevops in particular because of the cost, and so I am careful to always 'make destroy' as soon as I'm done otheriwse you can economically bleed. And so I think economics drives kdevops cloud instances to be super ephemeral.

So for *me*, I say go for it.

Quoted 8 lines
Quoted 3 lines

But I am not sure if other folks are using kdevops for the cloud in other ways, but certainly Chandan would have good sensing on that.

The changes made by the patchset definitely improve the usability of OCI via kdevops. Thanks for working on this.

Thanks for your review!

Quoted 4 lines

Also, Can you please include the VM.Standard.x86.Generic shape in the list of shapes introduced by "[RFC PATCH 16/31] terraform/OCI: Add a shape selector for Flex shapes" patch. This shape is recommended for developers from my department who do not require a specific model of CPU for their work.

Yes, I can do that. An alternative would be to retain the ability to enter an arbitrary string here (and maybe for image selection).

Signature · 1 line
Chuck Lever
#38 lore raw
Quoted 47 lines · Chuck Lever
Quoted 34 lines · Chandan Babu R
Quoted 33 lines · Luis Chamberlain
Quoted 6 lines · Chuck Lever
Quoted 5 lines · Luis Chamberlain
Quoted 3 lines · On Mon, Mar 31, 2025 at 08:59:29PM -0400, [email protected] wrote:

From: Chuck Lever <[email protected]>
I've come up with some simplifications that can apply to all of the providers, but I'd like to start with OCI because

Quoted 6 lines
Quoted 1 line

Thanks for taking a look!

I guess my basic concern here is that I'm changing the name of some Kconfig variables, which would break backwards compatibility.

I've addressed concerns like that befored by adding a respective kconfig value and mapping the old one to the new shiny one with an XXX to annotate we should remove the older one later. But if for cloud I suspect most users might stick to that version of kdevops and have no need to upgrade too, and so I am not sure if its needed as much as the guest / virtualization use case.

Quoted 3 lines

If you and Chandan feel that is not a roadblock, then I will start committing these and the similar patches I have for the other three major providers.

My use cases of cloud are all completely ephemeral and stuck to one version of kdevops in particular because of the cost, and so I am careful to always 'make destroy' as soon as I'm done otheriwse you can economically bleed. And so I think economics drives kdevops cloud instances to be super ephemeral.

So for *me*, I say go for it.

Quoted 8 lines
Quoted 3 lines

But I am not sure if other folks are using kdevops for the cloud in other ways, but certainly Chandan would have good sensing on that.

The changes made by the patchset definitely improve the usability of OCI via kdevops. Thanks for working on this.

Thanks for your review!

Quoted 7 lines
Quoted 4 lines

Also, Can you please include the VM.Standard.x86.Generic shape in the list of shapes introduced by "[RFC PATCH 16/31] terraform/OCI: Add a shape selector for Flex shapes" patch. This shape is recommended for developers from my department who do not require a specific model of CPU for their work.

Yes, I can do that. An alternative would be to retain the ability to enter an arbitrary string here (and maybe for image selection).

Yes, That would be very helpful. Thanks!

Signature · 1 line
Chandan