Change value
Apache 2.0Change the value of an HCL attribute while leaving its key intact. The new value replaces the whole existing expression, unless regex is enabled.
org. openrewrite. hcl. ChangeValueRequired
A JSONPath expression locating the attribute whose value to change.
The new value as an HCL expression. String values have to be quoted, e.g. "8.0", while true, 8, ["a", "b"] or var.engine_version are used as is. If regex is enabled, the replacement for the parts of the current value matching oldValue instead, keeping its quotes. Capturing groups can be used, e.g. db.t3.$1.
Optional
Only change the value if it matches the configured oldValue. It is compared to numbers, booleans and strings without interpolation, the latter without their quotes. Any other value, like a reference, is left unchanged when oldValue is set.
Default false. If enabled, oldValue will be interpreted as a Regular Expression, to replace only all parts that match the regex. Capturing group can be used in value.
mod run . --recipe= org. openrewrite. hcl. ChangeValue \
-P keyPath= '$. resource. aws_db_instance. engine_version' \
-P value= '"8.0"'Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.