File tree Expand file tree Collapse file tree 6 files changed +21
-8
lines changed
deployment/terraform/modules
openstack-kubernetes-infra Expand file tree Collapse file tree 6 files changed +21
-8
lines changed Original file line number Diff line number Diff line change @@ -21,13 +21,13 @@ resource "openstack_compute_keypair_v2" "compute_keypair" {
2121resource "local_file" "private_key" {
2222 count = local. is_using_existing_ssh_keypair ? 0 : 1
2323 content = openstack_compute_keypair_v2. compute_keypair . private_key
24- filename = " ${ path . root } /.build /${ openstack_compute_keypair_v2 . compute_keypair . name } -rsa.pem"
24+ filename = " ${ local . output_file_directory } /${ openstack_compute_keypair_v2 . compute_keypair . name } -rsa.pem"
2525 file_permission = " 0600"
2626}
2727
2828resource "local_file" "public_key" {
2929 count = local. is_using_existing_ssh_keypair ? 0 : 1
3030 content = openstack_compute_keypair_v2. compute_keypair . public_key
31- filename = " ${ path . root } /.build /${ openstack_compute_keypair_v2 . compute_keypair . name } -rsa.pub"
31+ filename = " ${ local . output_file_directory } /${ openstack_compute_keypair_v2 . compute_keypair . name } -rsa.pub"
3232 file_permission = " 0600"
33- }
33+ }
Original file line number Diff line number Diff line change 11
22locals {
33 random_prefix = random_id. server . b64_url
4+ output_file_directory = var. output_file_directory != null ? var. output_file_directory : " ${ path . root } /.build"
45}
56
67
@@ -17,8 +18,6 @@ locals {
1718 ip_address = var.preexisting_controller_host != null ? var.preexisting_controller_host.ip_address : local.created_controller_host.access_ip_v4
1819 unique_name = var.preexisting_controller_host != null && var.preexisting_controller_host.unique_name != null ? var.preexisting_controller_host.unique_name : local.created_controller_host.name
1920 }
20-
21-
2221}
2322
2423resource "random_id" "server" {
Original file line number Diff line number Diff line change @@ -99,4 +99,11 @@ variable "ssh_key_pair" {
9999 condition = var. ssh_key_pair == null || fileexists (var. ssh_key_pair . public_key_file )
100100 error_message = " No file exists in SSH public key path"
101101 }
102+ }
103+
104+
105+ variable "output_file_directory" {
106+ type = string
107+ default = null
108+ description = " Optional path to write output files to. If directory doesnt exist it will be created"
102109}
Original file line number Diff line number Diff line change @@ -21,13 +21,13 @@ resource "openstack_compute_keypair_v2" "compute_keypair" {
2121resource "local_file" "private_key" {
2222 count = local. is_using_existing_ssh_keypair ? 0 : 1
2323 content = openstack_compute_keypair_v2. compute_keypair . private_key
24- filename = " ${ path . root } /.build /${ openstack_compute_keypair_v2 . compute_keypair . name } -rsa.pem"
24+ filename = " ${ local . output_file_directory } /${ openstack_compute_keypair_v2 . compute_keypair . name } -rsa.pem"
2525 file_permission = " 0600"
2626}
2727
2828resource "local_file" "public_key" {
2929 count = local. is_using_existing_ssh_keypair ? 0 : 1
3030 content = openstack_compute_keypair_v2. compute_keypair . public_key
31- filename = " ${ path . root } /.build /${ openstack_compute_keypair_v2 . compute_keypair . name } -rsa.pub"
31+ filename = " ${ local . output_file_directory } /${ openstack_compute_keypair_v2 . compute_keypair . name } -rsa.pub"
3232 file_permission = " 0600"
3333}
Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ locals {
1010}
1111
1212locals {
13- kubeconfig_file = " ${ path . module } /.build/downloaded-kubeconfig.yaml"
13+ output_file_directory = var. output_file_directory != null ? var. output_file_directory : " ${ path . root } /.build"
14+ kubeconfig_file = " ${ local . output_file_directory } /downloaded-kubeconfig.yaml"
1415}
1516
1617resource "random_id" "server" {
Original file line number Diff line number Diff line change @@ -54,4 +54,10 @@ variable "ssh_key_pair" {
5454 condition = var. ssh_key_pair == null || fileexists (var. ssh_key_pair . public_key_file )
5555 error_message = " No file exists in SSH public key path"
5656 }
57+ }
58+
59+ variable "output_file_directory" {
60+ type = string
61+ default = null
62+ description = " Optional path to write output files to. If directory doesnt exist it will be created"
5763}
You can’t perform that action at this time.
0 commit comments