Change a single attribute inside a Terraform resource's nested block

Proprietary

Change the value of an attribute inside a specific instance of a nested block on a Terraform resource (e.g. set value = "0" on the parameter { name = "local_infile" } block of an aws_db_parameter_group). Use keyMatchers to identify a single instance among repeatable blocks.

org.openrewrite.terraform.ChangeResourceNestedBlockAttribute

Required

A Terraform resource type, without the quotes.

The type of nested block to update (e.g. parameter, tag, setting).

The attribute inside the nested block whose value should change.

The new value to set. For quoted string attributes, provide the value without quotes.

Optional

A regular expression matched against the resource's local name (the second label). If omitted, all resources of resourceType are considered.

A list of attr=valueRegex entries. The resource is considered a match only if every entry matches an attribute on the resource (AND semantics). Separate values with commas.

A list of attr=valueRegex entries identifying the specific nested block instance to update. If omitted, every block of the given blockType is updated. Separate values with commas.

mod run . --recipe=org.openrewrite.terraform.ChangeResourceNestedBlockAttribute \ -P resourceType=aws_db_parameter_group \ -P blockType=parameter \ -P attributeName=value \ -P newValue=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.