Skip to content

Commit

Permalink
move bootstrap template file to compute
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Oehrli committed Feb 18, 2021
1 parent 8543680 commit cbdb1b6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
21 changes: 20 additions & 1 deletion compute.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,26 @@ resource "oci_core_instance" "bastion" {

metadata = {
ssh_authorized_keys = local.ssh_authorized_keys
user_data = local.bootstrap_cloudinit
user_data = base64gzip(templatefile(local.bootstrap_cloudinit_template, {
yum_upgrade = var.yum_upgrade
guacamole_user = var.guacamole_user
guacamole_connections = base64gzip(local.guacamole_connections)
authorized_keys = base64gzip(file(local.ssh_public_key_path))
etc_hosts = base64gzip(local.hosts_file)
fail2ban_config = local.fail2ban_config
guacamole_initialization = base64gzip(templatefile("${path.module}/scripts/guacamole_init.template.sh", {
webhost_name = var.webhost_name
webproxy_name = var.webproxy_name
host_name = var.label_prefix == "none" ? format("${local.resource_shortname}-${var.bastion_name}%02d", count.index) : format("${var.label_prefix}-${local.resource_shortname}-${var.bastion_name}%02d", count.index)
domain_name = var.tvd_domain
admin_email = var.admin_email
staging = var.staging
guacamole_enabled = var.guacamole_enabled
guacamole_user = var.guacamole_user
guacadmin_user = var.guacadmin_user
guacadmin_password = var.guacadmin_password
}))
}))
}

shape_config {
Expand Down
22 changes: 0 additions & 22 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,30 +29,8 @@ locals {
admin_email = var.admin_email
}))

# define and render bootstrap script
guacamole_initialization = base64gzip(templatefile("${path.module}/scripts/guacamole_init.template.sh", {
webhost_name = var.webhost_name
webproxy_name = var.webproxy_name
host_name = var.label_prefix == "none" ? format("${local.resource_shortname}-${var.bastion_name}%02d", count.index) : format("${var.label_prefix}-${local.resource_shortname}-${var.bastion_name}%02d", count.index)
domain_name = var.tvd_domain
admin_email = var.admin_email
staging = var.staging
guacamole_enabled = var.guacamole_enabled
guacamole_user = var.guacamole_user
guacadmin_user = var.guacadmin_user
guacadmin_password = var.guacadmin_password
}))
# define and render cloudinit bootstrap configuration
bootstrap_cloudinit_template = var.bootstrap_cloudinit_template == "" ? "${path.module}/cloudinit/bastion_host.yaml" : var.bootstrap_cloudinit_template
bootstrap_cloudinit = base64gzip(templatefile(local.bootstrap_cloudinit_template, {
yum_upgrade = var.yum_upgrade
guacamole_user = var.guacamole_user
guacamole_connections = base64gzip(local.guacamole_connections)
authorized_keys = base64gzip(file(local.ssh_public_key_path))
etc_hosts = base64gzip(local.hosts_file)
fail2ban_config = local.fail2ban_config
guacamole_initialization = local.guacamole_initialization
}))
#default_private_dns = cidrhost(cidrsubnet(var.vcn_cidr, var.private_newbits, var.private_netnum), var.tvd_dns_hostnum)
#vcn_cidr = data.oci_core_vcn.vcn.cidr_block
}
Expand Down

0 comments on commit cbdb1b6

Please sign in to comment.