aboutsummaryrefslogtreecommitdiffstats
path: root/openlab/modules/openstack/keypair
diff options
context:
space:
mode:
Diffstat (limited to 'openlab/modules/openstack/keypair')
-rw-r--r--openlab/modules/openstack/keypair/main.tf6
-rw-r--r--openlab/modules/openstack/keypair/output.tf3
-rw-r--r--openlab/modules/openstack/keypair/variables.tf6
3 files changed, 15 insertions, 0 deletions
diff --git a/openlab/modules/openstack/keypair/main.tf b/openlab/modules/openstack/keypair/main.tf
new file mode 100644
index 0000000..5b1384a
--- /dev/null
+++ b/openlab/modules/openstack/keypair/main.tf
@@ -0,0 +1,6 @@
+resource "openstack_compute_keypair_v2" "key" {
+ # You cna find a public/private key pair from your remote state storage.
+ name = "${var.cluster_name}-key"
+ # In order to generate a new keypair via existing public key
+ public_key = var.ssh_public_key
+}
diff --git a/openlab/modules/openstack/keypair/output.tf b/openlab/modules/openstack/keypair/output.tf
new file mode 100644
index 0000000..9c042e6
--- /dev/null
+++ b/openlab/modules/openstack/keypair/output.tf
@@ -0,0 +1,3 @@
+output "name" {
+ value = openstack_compute_keypair_v2.key.name
+} \ No newline at end of file
diff --git a/openlab/modules/openstack/keypair/variables.tf b/openlab/modules/openstack/keypair/variables.tf
new file mode 100644
index 0000000..b3c6a92
--- /dev/null
+++ b/openlab/modules/openstack/keypair/variables.tf
@@ -0,0 +1,6 @@
+variable "cluster_name" {
+ description = "A name for the cluster"
+ type = string
+}
+
+variable "ssh_public_key" { }