A terraform provider for generating sequential values based on generic triggers.
This provider is available from the Terraform Registry.
terraform {
required_providers = {
counters = {
source = "RutledgePaulV/counters"
}
}
}
provider counters {}
Examples of supported resources are provided below.
Use this to produce a number which increments by step each time there's a change to any triggers.
resource counters_monotonic this {
step = 1
initial_value = 0
triggers = {
hash = md5(jsonencode(something_else.this))
}
}
resource downstream this {
value = counters_monotonic.this.value
}
Use this to produce a semantic version which increments each time there's a change to any triggers of the relevant version component. When the major version changes, the minor and patch versions start over at zero. When the minor changes, the patch version starts over at zero.
resource counters_semantic_version this {
minor_triggers = {
hash = md5(jsonencode(something_else.this))
}
patch_triggers = {
hash = md5(jsonencode(something_else.that))
}
}
resource downstream this {
value = counters_semantic_version.this.value
}
This project is licensed under MIT license.