All of lore.kernel.org
 help / color / mirror / Atom feed
From: cel@kernel.org
To: <kdevops@lists.linux.dev>
Cc: Chuck Lever <chuck.lever@oracle.com>
Subject: [PATCH v3 6/6] terraform: Remove the terrraform update_ssh_config module
Date: Mon, 24 Feb 2025 14:12:15 -0500	[thread overview]
Message-ID: <20250224191215.637818-7-cel@kernel.org> (raw)
In-Reply-To: <20250224191215.637818-1-cel@kernel.org>

From: Chuck Lever <chuck.lever@oracle.com>

Unhook terraform's update_ssh_config module now that kdevops handles
this step.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---
 terraform/aws/output.tf                      | 25 ------------------
 terraform/aws/update_ssh_config.tf           |  1 -
 terraform/aws/update_ssh_config_use.tf       | 12 ---------
 terraform/azure/output.tf                    | 18 -------------
 terraform/azure/update_ssh_config.tf         |  1 -
 terraform/azure/update_ssh_config_use.tf     |  4 ---
 terraform/gce/output.tf                      | 27 +-------------------
 terraform/gce/update_ssh_config.tf           |  1 -
 terraform/gce/update_ssh_config_use.tf       |  4 ---
 terraform/oci/update_ssh_config.tf           |  1 -
 terraform/oci/update_ssh_config_use.tf       |  8 ------
 terraform/openstack/output.tf                |  2 ++
 terraform/openstack/update_ssh_config.tf     |  1 -
 terraform/openstack/update_ssh_config_use.tf |  4 ---
 terraform/update_ssh_config.tf               | 17 ------------
 15 files changed, 3 insertions(+), 123 deletions(-)
 delete mode 120000 terraform/aws/update_ssh_config.tf
 delete mode 100644 terraform/aws/update_ssh_config_use.tf
 delete mode 120000 terraform/azure/update_ssh_config.tf
 delete mode 100644 terraform/azure/update_ssh_config_use.tf
 delete mode 120000 terraform/gce/update_ssh_config.tf
 delete mode 100644 terraform/gce/update_ssh_config_use.tf
 delete mode 120000 terraform/oci/update_ssh_config.tf
 delete mode 100644 terraform/oci/update_ssh_config_use.tf
 delete mode 120000 terraform/openstack/update_ssh_config.tf
 delete mode 100644 terraform/openstack/update_ssh_config_use.tf
 delete mode 100644 terraform/update_ssh_config.tf

diff --git a/terraform/aws/output.tf b/terraform/aws/output.tf
index cb8cab4afcdd..83a85a388055 100644
--- a/terraform/aws/output.tf
+++ b/terraform/aws/output.tf
@@ -1,30 +1,5 @@
 # All generic output goes here
 
-locals {
-  ssh_key_i = format(
-    " %s%s ",
-    var.ssh_config_pubkey_file != "" ? "-i " : "",
-    var.ssh_config_pubkey_file != "" ? replace(var.ssh_config_pubkey_file, ".pub", "") : "",
-  )
-}
-
-data "null_data_source" "group_hostnames_and_ips" {
-  count = local.kdevops_num_boxes
-  inputs = {
-    value = format(
-      "%30s  :  ssh %s@%s %s ",
-      element(var.kdevops_nodes, count.index),
-      var.ssh_config_user,
-      element(aws_eip.kdevops_eip.*.public_ip, count.index),
-      local.ssh_key_i,
-    )
-  }
-}
-
-output "login_using" {
-  value = data.null_data_source.group_hostnames_and_ips.*.outputs
-}
-
 # Each provider's output.tf needs to define a public_ip_map. This
 # map is used to build the Ansible controller's ssh configuration.
 # Each map entry contains the node's hostname and public IP address.
diff --git a/terraform/aws/update_ssh_config.tf b/terraform/aws/update_ssh_config.tf
deleted file mode 120000
index 03cd77a65841..000000000000
--- a/terraform/aws/update_ssh_config.tf
+++ /dev/null
@@ -1 +0,0 @@
-../update_ssh_config.tf
\ No newline at end of file
diff --git a/terraform/aws/update_ssh_config_use.tf b/terraform/aws/update_ssh_config_use.tf
deleted file mode 100644
index c33d9b6a2ec4..000000000000
--- a/terraform/aws/update_ssh_config_use.tf
+++ /dev/null
@@ -1,12 +0,0 @@
-locals {
-  all_tags    = aws_instance.kdevops_instance.*.tags
-  shorthosts = [
-    for tags in local.all_tags :
-    format("%s", lookup(tags, "Name"))
-  ]
-  all_ipv4s = aws_eip.kdevops_eip.*.public_ip
-  ipv4s = [
-    for ip in local.all_ipv4s :
-    ip == "" ? "0.0.0.0" : ip
-  ]
-}
diff --git a/terraform/azure/output.tf b/terraform/azure/output.tf
index 22dfa2f0736d..ef5e3eca6883 100644
--- a/terraform/azure/output.tf
+++ b/terraform/azure/output.tf
@@ -20,24 +20,6 @@ output "kdevops_public_ip_addresses" {
   value = data.azurerm_public_ip.public_ips.*.ip_address
 }
 
-locals {
-  ssh_key_i = format(" %s%s ", var.ssh_config_pubkey_file != "" ? "-i " : "", var.ssh_config_pubkey_file != "" ? replace(var.ssh_config_pubkey_file, ".pub", "") : "")
-}
-
-data "null_data_source" "group_hostnames_and_ips" {
-  count = local.kdevops_num_boxes
-  inputs = {
-    # In theory using "${self.triggers["name"]}" and "${self.triggersp["ip"]}"
-    # would be nice but it is not supported in this context, only in the
-    # provisioner and connection contexts.
-    value = "${format("%30s  :  ssh %s@%s %s ", element(azurerm_linux_virtual_machine.kdevops_vm.*.name, count.index), var.ssh_config_user, element(azurerm_public_ip.kdevops_publicip.*.ip_address, count.index), local.ssh_key_i)}"
-  }
-}
-
-output "login_using" {
-  value = data.null_data_source.group_hostnames_and_ips.*.outputs
-}
-
 # Each provider's output.tf needs to define a public_ip_map. This
 # map is used to build the Ansible controller's ssh configuration.
 # Each map entry contains the node's hostname and public IP address.
diff --git a/terraform/azure/update_ssh_config.tf b/terraform/azure/update_ssh_config.tf
deleted file mode 120000
index 03cd77a65841..000000000000
--- a/terraform/azure/update_ssh_config.tf
+++ /dev/null
@@ -1 +0,0 @@
-../update_ssh_config.tf
\ No newline at end of file
diff --git a/terraform/azure/update_ssh_config_use.tf b/terraform/azure/update_ssh_config_use.tf
deleted file mode 100644
index 9b91206a66b1..000000000000
--- a/terraform/azure/update_ssh_config_use.tf
+++ /dev/null
@@ -1,4 +0,0 @@
-locals {
-  shorthosts  = azurerm_linux_virtual_machine.kdevops_vm.*.name
-  ipv4s       = data.azurerm_public_ip.public_ips.*.ip_address
-}
diff --git a/terraform/gce/output.tf b/terraform/gce/output.tf
index b95667cc7efd..470617f700ee 100644
--- a/terraform/gce/output.tf
+++ b/terraform/gce/output.tf
@@ -1,29 +1,4 @@
-locals {
-  ssh_key_i          = format(" %s%s ", var.ssh_config_pubkey_file != "" ? "-i " : "", var.ssh_config_pubkey_file != "" ? replace(var.ssh_config_pubkey_file, ".pub", "") : "")
-  network_interfaces = google_compute_instance.kdevops_instances.*.network_interface
-  access_configs = [
-    for net_interface in local.network_interfaces :
-    net_interface[0].access_config
-  ]
-  ipv4s = [
-    for access_config in local.access_configs :
-    access_config[0].nat_ip
-  ]
-}
-
-data "null_data_source" "group_hostnames_and_ips" {
-  count = local.kdevops_num_boxes
-  inputs = {
-    # In theory using "${self.triggers["name"]}" and "${self.triggersp["ip"]}"
-    # would be nice but it is not supported in this context, only in the
-    # provisioner and connection contexts.
-    value = "${format("%30s  :  ssh %s@%s %s ", element(google_compute_instance.kdevops_instances.*.name, count.index), var.ssh_config_user, element(local.ipv4s, count.index), local.ssh_key_i)}"
-  }
-}
-
-output "login_using" {
-  value = data.null_data_source.group_hostnames_and_ips.*.outputs
-}
+# All generic output goes here
 
 # Each provider's output.tf needs to define a public_ip_map. This
 # map is used to build the Ansible controller's ssh configuration.
diff --git a/terraform/gce/update_ssh_config.tf b/terraform/gce/update_ssh_config.tf
deleted file mode 120000
index 03cd77a65841..000000000000
--- a/terraform/gce/update_ssh_config.tf
+++ /dev/null
@@ -1 +0,0 @@
-../update_ssh_config.tf
\ No newline at end of file
diff --git a/terraform/gce/update_ssh_config_use.tf b/terraform/gce/update_ssh_config_use.tf
deleted file mode 100644
index 6eb008695576..000000000000
--- a/terraform/gce/update_ssh_config_use.tf
+++ /dev/null
@@ -1,4 +0,0 @@
-locals {
-  shorthosts  = google_compute_instance.kdevops_instances.*.name
-  all_ipv4s   = local.ipv4s
-}
diff --git a/terraform/oci/update_ssh_config.tf b/terraform/oci/update_ssh_config.tf
deleted file mode 120000
index 03cd77a65841..000000000000
--- a/terraform/oci/update_ssh_config.tf
+++ /dev/null
@@ -1 +0,0 @@
-../update_ssh_config.tf
\ No newline at end of file
diff --git a/terraform/oci/update_ssh_config_use.tf b/terraform/oci/update_ssh_config_use.tf
deleted file mode 100644
index f4b2519b515b..000000000000
--- a/terraform/oci/update_ssh_config_use.tf
+++ /dev/null
@@ -1,8 +0,0 @@
-locals {
-  shorthosts	= oci_core_instance.kdevops_instance.*.display_name
-  ipv4s		= (
-    var.oci_assign_public_ip == "false" ?
-    oci_core_instance.kdevops_instance.*.private_ip :
-    oci_core_instance.kdevops_instance.*.public_ip
-  )
-}
diff --git a/terraform/openstack/output.tf b/terraform/openstack/output.tf
index aff44d1b45f9..2d60cc46c030 100644
--- a/terraform/openstack/output.tf
+++ b/terraform/openstack/output.tf
@@ -1,3 +1,5 @@
+# All generic output goes here
+
 data "null_data_source" "group_hostnames_and_ips" {
   count = local.kdevops_num_boxes
   inputs = {
diff --git a/terraform/openstack/update_ssh_config.tf b/terraform/openstack/update_ssh_config.tf
deleted file mode 120000
index 03cd77a65841..000000000000
--- a/terraform/openstack/update_ssh_config.tf
+++ /dev/null
@@ -1 +0,0 @@
-../update_ssh_config.tf
\ No newline at end of file
diff --git a/terraform/openstack/update_ssh_config_use.tf b/terraform/openstack/update_ssh_config_use.tf
deleted file mode 100644
index 9d4ceb31d9fb..000000000000
--- a/terraform/openstack/update_ssh_config_use.tf
+++ /dev/null
@@ -1,4 +0,0 @@
-locals {
-  shorthosts  = openstack_compute_instance_v2.kdevops_instances.*.name
-  ipv4s       = openstack_compute_instance_v2.kdevops_instances.*.access_ip_v4
-}
diff --git a/terraform/update_ssh_config.tf b/terraform/update_ssh_config.tf
deleted file mode 100644
index 03f0cbed424a..000000000000
--- a/terraform/update_ssh_config.tf
+++ /dev/null
@@ -1,17 +0,0 @@
-module "ssh_config_update_host_entries" {
-  source  = "linux-kdevops/add-host-ssh-config/kdevops"
-  version = "3.0.0"
-
-  ssh_config               = var.ssh_config
-  update_ssh_config_enable = var.ssh_config_update
-  cmd                      = "update"
-  shorthosts               = join(",", slice(local.shorthosts, 0, local.kdevops_num_boxes))
-  hostnames                = join(",", slice(local.ipv4s, 0, local.kdevops_num_boxes))
-  ports                    = "22"
-  user                     = var.ssh_config_user == "" ? "" : var.ssh_config_user
-  id                       = replace(var.ssh_config_pubkey_file, ".pub", "")
-  strict                   = var.ssh_config_use_strict_settings ? "true" : ""
-  use_backup               = !var.ssh_config_backup || var.ssh_config == "/dev/null" ? "" : "true"
-  backup_postfix           = "kdevops"
-  kexalgorithms            = var.ssh_config_kexalgorithms == "" ? "" : var.ssh_config_kexalgorithms
-}
-- 
2.48.1


      parent reply	other threads:[~2025-02-24 19:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24 19:12 [PATCH v3 0/6] Replace terraform update_ssh_config module cel
2025-02-24 19:12 ` [PATCH v3 1/6] terraform: Replace scripts/*_terraform.sh with an Ansible playbook cel
2025-02-24 19:12 ` [PATCH v3 2/6] ssh.Makefile: Define a kdevops_ssh_config variable cel
2025-02-24 19:12 ` [PATCH v3 3/6] terraform: Clean up ssh configuration during "make destroy" cel
2025-02-24 19:12 ` [PATCH v3 4/6] terraform: Add ssh hosts to ~/.ssh/config_kdevops_{{ sha1sum }} cel
2025-02-24 19:12 ` [PATCH v3 5/6] terraform: "make mrproper" should remove terraform/*/.terraform cel
2025-02-24 19:12 ` cel [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250224191215.637818-7-cel@kernel.org \
    --to=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=kdevops@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.