Skip to content

Commit

Permalink
Merge pull request #29 from hashicorp/issue28-encpasswd
Browse files Browse the repository at this point in the history
Issue28 - encpasswd
  • Loading branch information
amy-hashi authored Nov 4, 2019
2 parents a088929 + 586436f commit 30fc115
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions examples/rhel-production-example/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@ output "tfe-cluster" {
installer_dashboard_password = "${module.tfe-cluster.installer_dashboard_password}"
installer_dashboard__url = "${module.tfe-cluster.installer_dashboard_url}"
primary_public_ip = "${module.tfe-cluster.primary_public_ip}"
encryption_password = "${module.tfe-beta.encryption_password}"
}
}
1 change: 1 addition & 0 deletions examples/root-example/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@ output "tfe-cluster" {
installer_dashboard_password = "${module.tfe-cluster.installer_dashboard_password}"
installer_dashboard__url = "${module.tfe-cluster.installer_dashboard_url}"
primary_public_ip = "${module.tfe-cluster.primary_public_ip}"
encryption_password = "${module.tfe-beta.encryption_password}"
}
}
2 changes: 1 addition & 1 deletion module-instance-template.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module "instance-template" {
http_proxy_url = "${var.http_proxy_url}"
airgap_package_url = "${var.airgap_package_url}"
airgap_installer_url = "${var.airgap_installer_url}"
encryption_password = "${var.encryption_password}"
encryption_password = "${local.encryption_password}"
postgresql_user = "${var.postgresql_user}"
postgresql_password = "${var.postgresql_password}"
postgresql_address = "${var.postgresql_address}"
Expand Down
5 changes: 5 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ output "primary_public_ip" {
value = "${var.public_ip}"
description = "The Public IP for the load balancer to use."
}

output "encryption_password" {
value = "${local.encryption_password}"
description = "If you did not specify an encryption password, this was used."
}
2 changes: 1 addition & 1 deletion primary.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ resource "google_compute_instance" "primary" {
airgap-installer-url = "${var.airgap_package_url == "none" ? "none" : count.index == 0 ? var.airgap_installer_url : local.internal_airgap_url}"
repl-data = "${base64encode("${random_pet.console_password.id}")}"
ptfe-hostname = "${var.prefix}-primary-${count.index}-${random_string.postfix.result}.${data.google_dns_managed_zone.dnszone.dns_name}"
encpasswd = "${var.encryption_password}"
encpasswd = "${local.encryption_password}"
release-sequence = "${var.release_sequence}"
pg_user = "${var.postgresql_user}"
pg_password = "${var.postgresql_password}"
Expand Down
7 changes: 7 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ locals {
assistant_port = 23010
rendered_secondary_machine_type = "${var.secondary_machine_type != "" ? var.secondary_machine_type : var.primary_machine_type }"
internal_airgap_url = "http://${var.prefix}-primary-0-${random_string.postfix.result}:${local.assistant_port}/setup-files/replicated.tar.gz?token=${random_string.setup_token.result}"
encryption_password = "${var.encryption_password != "" ? var.encryption_password : random_string.default_enc_password.result}"
}

###################################################
Expand Down Expand Up @@ -268,3 +269,9 @@ resource "random_string" "setup_token" {
upper = false
special = false
}

resource "random_string" "default_enc_password" {
length = 32
upper = true
special = false
}

0 comments on commit 30fc115

Please sign in to comment.