Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 5ff6866

Browse files
committed
feat: configure Terraform auto update interval
Terraform auto update interval can be configured by setting "stackhead__tf_update_interval" in inventory file or "terraform.update_interval" in CLI config file. Per default updates will be performed every 5 minutes.
1 parent c3e039f commit 5ff6866

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

Documentation/ansible-playbooks/inventory.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ all:
2424
stackhead__container: getstackhead.stackhead_container_docker # use Docker for containers
2525
stackhead__plugins: [] # list of plugins
2626
stackhead__tf_update_realtime: yes # if "no" Terraform updates will be performed via cron (every 5 minutes)
27+
stackhead__tf_update_interval: *:0/5 # Terraform auto-update interval, default: 5 minutes
2728
ansible_host: 123.456.789.10
2829
stackhead:
2930
applications:

Documentation/stackhead-cli/cli-configuration.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ modules:
1818
container: docker
1919
plugins:
2020
- watchtower # load getstackhead.stackhead_plugin_watchtower plugin
21+
terraform:
22+
update_interval: "*-*-* 4:00:00" # perform Terraform update everyday at 4am, see Unix timer "OnCalendar" setting
2123
config:
2224
setup:
2325
getstackhead.stackhead_webserver_nginx: # config settings for Nginx module

ansible/roles/stackhead_setup/tasks/setup-terraform.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,5 @@
4242
state: "started"
4343
options:
4444
Unit: "stackhead-apply-terraform.service"
45-
OnActiveSec: 1sec
46-
OnUnitActiveSec: 5min
45+
OnCalendar: "{{ stackhead_config.terraform.update_interval }}"
4746
Persistent: true

ansible/vars/internal.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ stackhead_config:
2121
installed: "{% if 'versions' in ansible_local %}{{ ansible_local.versions.stackhead.version }}{% endif %}"
2222
terraform:
2323
manual_update: "{{ stackhead__tf_update_realtime|d(true)|bool }}"
24+
update_interval: "{{ stackhead__tf_update_interval|d('*:0/5') }}"
2425
deployment: "{{ stackhead__config_deployment|d({}) }}"
2526
setup: "{{ stackhead__config_setup|d({}) }}"
2627
destroy: "{{ stackhead__config_destroy|d({}) }}"

0 commit comments

Comments
 (0)