-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Refactor post-provisioning operations (#12)
- Move post-provisioning operations from terraform-oci-always-free-oke module to examples/private-cluster/modules #patch
- Loading branch information
Showing
20 changed files
with
80 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 5 additions & 22 deletions
27
modules/kubernetes/bastion-tennel.tf → ...ster/modules/kubernetes/bastion-tennel.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,38 @@ | ||
variable "always_run_bastion_tunnel" { | ||
description = "A boolean variable to decide whether to always trigger the bastion_tunnel null_resource on each 'terraform apply'. Set to 'true' to always trigger, and 'false' to maintain the trigger state." | ||
default = true | ||
} | ||
|
||
locals { | ||
trigger_value_bastion_tunnel = var.always_run_bastion_tunnel ? uuid() : "" | ||
} | ||
|
||
resource "null_resource" "bastion_tunnel" { | ||
depends_on = [null_resource.kubeconfig, local_file.bastion_tunnel] | ||
|
||
triggers = { | ||
always_run = local.trigger_value_bastion_tunnel | ||
always_run = uuid() | ||
} | ||
|
||
provisioner "local-exec" { | ||
command = "${path.root}/cluster_access.sh" | ||
command = local_file.bastion_tunnel.filename | ||
} | ||
|
||
count = local.post_provisioning_ops_enabled ? 1 : 0 | ||
} | ||
|
||
resource "local_file" "bastion_tunnel" { | ||
depends_on = [local_file.id_rsa, local_file.id_rsa_pub] | ||
content = templatefile("${path.module}/scripts/create_bastion_tunnel_template.sh", | ||
{ | ||
bastion_id = var.control_plane_bastion_service_id | ||
public_key_file = local_file.id_rsa_pub[0].filename | ||
private_key_file = local_file.id_rsa[0].filename | ||
public_key_file = local_file.id_rsa_pub.filename | ||
private_key_file = local_file.id_rsa.filename | ||
cluster_ip = local.private_endpoint_ip | ||
cluster_port = local.private_endpoint_port | ||
region = var.region | ||
} | ||
) | ||
filename = "${path.root}/cluster_access.sh" | ||
|
||
count = local.post_provisioning_ops_enabled ? 1 : 0 | ||
filename = "${path.root}/connect_to_cluster.sh" | ||
} | ||
|
||
resource "local_file" "id_rsa" { | ||
content = local.ssh_private_key | ||
filename = "${path.root}/id_rsa" | ||
file_permission = "0600" | ||
|
||
count = local.post_provisioning_ops_enabled ? 1 : 0 | ||
} | ||
|
||
resource "local_file" "id_rsa_pub" { | ||
content = local.ssh_authorized_keys | ||
filename = "${path.root}/id_rsa.pub" | ||
file_permission = "0600" | ||
|
||
count = local.post_provisioning_ops_enabled ? 1 : 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
modules/kubernetes/locals.tf → ...vate-cluster/modules/kubernetes/locals.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters