Skatteetaten / terraform-nomad-postgres

Apache License 2.0
8 stars 5 forks source link

Move fetching of data in vault to nomad's job-file #18

Closed pdmthorsrud closed 3 years ago

pdmthorsrud commented 3 years ago

Right now we are using terraform-resources to fetch data from vault (specifically username and password): https://github.com/fredrikhgrelland/terraform-nomad-postgres/blob/ae78b48fbd54e039f42194ae75e4364b33de21a9/example/main.tf#L1-L3 and https://github.com/fredrikhgrelland/terraform-nomad-postgres/blob/ae78b48fbd54e039f42194ae75e4364b33de21a9/example/main.tf#L16-L17

This should be done via templates inside the nomad-job instead. Nomad-job's templating uses consul-template which will dynamically update files if any of its references change.

Summary: the creation of data in vault should still be done via terraform resources, but the fetching of it should be done via nomad-templating, so that it'll dynamically update.

zhenik commented 3 years ago

Possible problems:

zhenik commented 3 years ago

Example from presto module https://github.com/fredrikhgrelland/terraform-nomad-presto/blob/master/conf/nomad/presto.hcl#L327

claesgill commented 3 years ago

I think we can close this issue due to PR #47. Or WDYT @zhenik @pdmthorsrud ?

EDIT: Clicked the wrong button ... 🤦

pdmthorsrud commented 3 years ago

Yup, you're right!