Configuring Terraform Runner
Customizing Fetch Interval
By default, Terraform Runner will run fetch (terraform plan
) every 5 minutes. After the Service Instance converges, the fetch will run every hour to check for drifts. Both intervals can be customized:
runtime:
terraformRunner:
pollInterval: 300s # interval when not converged
steadyStatePollInterval: 3600s # interval when converged
...
Templatizing Terraform Modules and Sharing Between Release Channels
Via the use of Terraform variables, you can reuse a single Terraform module source code across all your Release Channels. To do this, use extraInitArgs
to pass additional -backend-config
that is Release Channel specific, ensuring that each module's state is independent, then pass whatever extra variables are needed as environment variables.
service:
name: my-tf-service
application: my-app
customRuntime:
parameterValues:
- name: image
string: ... # as needed
- name: extraInitArgs
string: '-backend-config="my-config=something/with/{{.Builtins.ReleaseChannel.Name}}"'
- name: path
string: ... # as needed
env:
TF_VAR_release_channel_name:
value: "{{.Builtins.ReleaseChannel.Name}}"
You can further combine this with Release-Channel-level constants for complex templating and Release-Channel-level environment variables to set variables at a Release-Channel level across all Services.
Updated 9 months ago