hashicorp / terraform-aws-consul

A Terraform Module for how to run Consul on AWS using Terraform and Packer
Apache License 2.0
401 stars 488 forks source link

Specify Type notify on systemd service #146

Closed gilesvangruisen closed 5 years ago

gilesvangruisen commented 5 years ago

Hey there- thanks for this module!

We've been noticing a race condition wherein our application, which depends on having joined the Consul cluster, starts up after Consul has started but before the cluster has been joined.

We are using systemd service configurations for both Consul and our application, which explicitly defines Requires=consul.service and After=consul.service. Because the consul.service Unit file written by this module has no Type specified, it defaults to simple, so systemd considers the service "active (running)" as soon as the task is started.

I saw this PR on the Consul library itself, and thought that this module probably wants to be updated too, since others (like us) are using this to configure remote machines to join a Consul cluster.

Thanks!

hashicorp-cla commented 5 years ago

CLA assistant check
All committers have signed the CLA.

brikis98 commented 5 years ago

Tests passed. Merging now.

brikis98 commented 5 years ago

https://github.com/hashicorp/terraform-aws-consul/releases/tag/v0.7.1

gilesvangruisen commented 5 years ago

Thanks @brikis98 !

Etiene commented 5 years ago

@gilesvangruisen You might want to consider increasing the systemd TimeoutSec config for your application (#148). I started noticing timeout failures on services that depended on consul after the type change from simple to notify.

gilesvangruisen commented 5 years ago

@Etiene ahh, that's very wise. Would have missed this otherwise. Thank you!!