diff mbox series

[RFC,24/31] terraform/OCI: Use "output yaml" for the assign_public_ip" setting

Message ID 20250401010000.764234-25-cel@kernel.org (mailing list archive)
State New
Headers show
Series Simplify OCI configuration menu | expand

Commit Message

Chuck Lever April 1, 2025, 12:59 a.m. UTC
From: Chuck Lever <chuck.lever@oracle.com>

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.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 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(-)
diff mbox series

Patch

diff --git a/playbooks/roles/gen_tfvars/defaults/main.yml b/playbooks/roles/gen_tfvars/defaults/main.yml
index f64102b2fbf5..b6caadcb7e0c 100644
--- a/playbooks/roles/gen_tfvars/defaults/main.yml
+++ b/playbooks/roles/gen_tfvars/defaults/main.yml
@@ -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"
diff --git a/playbooks/roles/gen_tfvars/templates/oci/terraform.tfvars.j2 b/playbooks/roles/gen_tfvars/templates/oci/terraform.tfvars.j2
index fd3d9b853c05..192d72ff32a9 100644
--- a/playbooks/roles/gen_tfvars/templates/oci/terraform.tfvars.j2
+++ b/playbooks/roles/gen_tfvars/templates/oci/terraform.tfvars.j2
@@ -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 }}
diff --git a/scripts/terraform.Makefile b/scripts/terraform.Makefile
index d9e28050a508..99aadfc51fff 100644
--- a/scripts/terraform.Makefile
+++ b/scripts/terraform.Makefile
@@ -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
 
diff --git a/terraform/oci/kconfigs/Kconfig.network b/terraform/oci/kconfigs/Kconfig.network
index ab1914c6f6a6..9dc77a266eb4 100644
--- a/terraform/oci/kconfigs/Kconfig.network
+++ b/terraform/oci/kconfigs/Kconfig.network
@@ -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"