Created
April 18, 2019 14:09
-
-
Save simonswine/82d76d160bf6f2f01f4d0e5e52afd32c to your computer and use it in GitHub Desktop.
Modify every instance of specific object in a terrafrom state
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local x = import 'input.tfstate'; | |
local modifyDNSManagedZone(o) = o { | |
primary+: { | |
attributes+: { | |
visibility: 'public', | |
}, | |
}, | |
}; | |
local iter(o) = | |
if std.isObject(o) then | |
{ | |
[v]: if std.startsWith(v, 'google_dns_managed_zone.') then | |
modifyDNSManagedZone(o[v]) | |
else | |
iter(o[v]) | |
for v in std.objectFields(o) | |
} | |
else if std.isArray(o) then | |
[iter(x) for x in o] | |
else | |
o | |
; | |
iter(x) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment