Open hcharley opened 4 years ago
This doesn't yet work for:
name = "${kubernetes_config_map.caddy.metadata.0.name}"
or:
name = "${function(kubernetes_config_map.caddy.metadata.name)}"
This may also cause problems for people:
"${local.key_name}" = "${base64decode(module.foobar.key)}"
Gets replaced with:
local.key_name = "${base64decode(module.foobar.key)}"
A little better:
=(.*)"\$\{(([a-z0-8]|\(|\)|\.|_)+)\}"
=$1$2
Still, this won't work:
on_call_contacts = "${file("${path.module}/CONTACTS.md")}"
This is also tricky if using the equal sign in the beginning of the pattern:
"kubernetes.io/ingress.global-static-ip-name" : "${google_compute_global_address.static_ip.name}"
For this type of rewriting we'd prefer to defer to terraform fmt
, I'm inquiring with the core team to see if there are plans (or an issue to track) for Terraform to fix unnecessary interpolation. Optionally we could probably add the ability to plugin external formatters, but I don't think this is a behavior we'd want to implement ourselves.
Thanks @paultyng. I leave it up to the maintainers to close this if they don't want to implement. Just thought some of my regex might help a future fellow-traveller.
Right now I am doing a find and replace with this in VSCode's search:
To replace strings like this:
With: