From 976f6ca20f4724f2acc5e33ede3c454d1e84d3ff Mon Sep 17 00:00:00 2001 From: Chris Piraino Date: Mon, 9 Jan 2023 15:58:56 -0500 Subject: [PATCH 1/2] Fix unresolved local references by using the variables instead --- examples/hcp-ec2-demo/output.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/hcp-ec2-demo/output.tf b/examples/hcp-ec2-demo/output.tf index d92ee0f..d8ebb93 100644 --- a/examples/hcp-ec2-demo/output.tf +++ b/examples/hcp-ec2-demo/output.tf @@ -20,7 +20,7 @@ output "hashicups_url" { } output "next_steps" { - value = local.install_demo_app ? "HashiCups Application will be ready in ~2 minutes. Use 'terraform output consul_root_token' to retrieve the root token." : null + value = var.install_demo_app ? "HashiCups Application will be ready in ~2 minutes. Use 'terraform output consul_root_token' to retrieve the root token." : null } output "howto_connect" { @@ -36,6 +36,6 @@ output "howto_connect" { To connect to the ec2 instance deployed: ${var.ssh ? " - To access via SSH run: ssh -i ${abspath(local_file.ssh_key[0].filename)} ubuntu@${module.aws_ec2_consul_client.public_ip}" : ""} -${var.ssm ? " - To access via SSM run: aws ssm start-session --target ${module.aws_ec2_consul_client.host_id} --region ${local.vpc_region}" : ""} +${var.ssm ? " - To access via SSM run: aws ssm start-session --target ${module.aws_ec2_consul_client.host_id} --region ${var.vpc_region}" : ""} EOF } From 6270a7bf457a42f77065e736f39002fe640e2232 Mon Sep 17 00:00:00 2001 From: Chris Piraino Date: Mon, 9 Jan 2023 15:59:29 -0500 Subject: [PATCH 2/2] Set WorkingDirectory on consul systemd service This allows the Consul client config generated by HCP to use relative path references for files in the config. --- modules/hcp-ec2-client/templates/service | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/hcp-ec2-client/templates/service b/modules/hcp-ec2-client/templates/service index c49affb..5c14487 100644 --- a/modules/hcp-ec2-client/templates/service +++ b/modules/hcp-ec2-client/templates/service @@ -12,6 +12,7 @@ KillMode=process KillSignal=SIGTERM Restart=on-failure LimitNOFILE=65536 +WorkingDirectory=/etc/consul.d/ [Install] WantedBy=multi-user.target