Created
March 13, 2018 08:30
-
-
Save mizzy/faa2e226b6ee1fe356ab5ec246137d3b to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env ruby | |
require 'json' | |
tfstate_file = ARGV[0] | |
tfstate = '' | |
File.open(tfstate_file, 'r') do |f| | |
tfstate = JSON.load(f) | |
end | |
tfstate['modules'][0]['resources'].each do |name, resouce| | |
if resouce['type'] == 'aws_alb' | |
resouce['primary']['attributes']['load_balancer_type'] = 'application' | |
end | |
if resouce['type'] == 'aws_alb_target_group' | |
resouce['primary']['attributes']['target_type'] = 'instance' | |
end | |
end | |
puts JSON.pretty_generate(tfstate) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment