hashicorptools 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 578a309d23e6c74f87b157d24e368d36229b383e
4
- data.tar.gz: a6001bd980ee8f5dcb254f6c6710ac9ff14a79e6
3
+ metadata.gz: b38a77f25914cf1c9fdeffb3bd0098add1a79140
4
+ data.tar.gz: 117c9145ef6181e8a2c158b4e24cc55b4b99e2a6
5
5
  SHA512:
6
- metadata.gz: ef0ceffa687a95e96eb9c3b6c7633d56136cd5ca0d882f1292f3429fdfb832f00b657f7839f93fb61e97d4dc6fca005cbb8605a7550305af1ecba40a762a7e6b
7
- data.tar.gz: ffd7cb65907eb99d3f2d740e0fb377eeb4272d01289e5d916cf8bd1fdd1d4df0e727e506d5e8ec71bae4a3788f3d52ecb1da6bb1ac013f680fab549238dce95e
6
+ metadata.gz: abec236d7c680241d658d43504cac803040f7994f07a90455f95f8fd2bb347375f29f1dc87e6a0ddce0ea209a870d11ad32dafaee6c4c20b6b629367550c0979
7
+ data.tar.gz: cdab94f46e5790f19caf0675c67801d32079eeac5d03036f3bc0586508385faae283b9ecd24f3ab7f4b746bcb7ef828784228ce86b7ce47d5a8c380e8a9ad27f
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: hashicorptools 0.0.4 ruby lib
5
+ # stub: hashicorptools 0.0.5 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "hashicorptools"
9
- s.version = "0.0.4"
9
+ s.version = "0.0.5"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Nathan Woodhull"]
14
- s.date = "2015-12-21"
14
+ s.date = "2016-02-01"
15
15
  s.description = "Wrappers for terraform and packer"
16
16
  s.email = "systems@controlshiftlabs.com"
17
17
  s.executables = ["ec2_host"]
@@ -1,6 +1,6 @@
1
1
  module Hashicorptools
2
2
  class Terraform < Thor
3
- TERRAFORM_VERSION = '0.6.8'
3
+ TERRAFORM_VERSION = '0.6.11'
4
4
 
5
5
  include Ec2Utilities
6
6
  include Variables
@@ -100,8 +100,13 @@ module Hashicorptools
100
100
  desc 'taint', 'terraform taint'
101
101
  option :environment, :required => true
102
102
  option :name, :required => true
103
+ option :module, :required => false
103
104
  def taint
104
- system "terraform taint -state #{state_path} #{options[:name]}"
105
+ if options[:module].present?
106
+ system "terraform taint -module #{options[:module]} -state #{state_path} #{options[:name]}"
107
+ else
108
+ system "terraform taint -state #{state_path} #{options[:name]}"
109
+ end
105
110
  end
106
111
 
107
112
  desc 'show', 'terraform show'
@@ -208,13 +213,14 @@ module Hashicorptools
208
213
 
209
214
  def output_variables(state_file_path)
210
215
  raw_plan_output = `#{output_cmd(state_file_path)}`
211
- output_vars = {}
212
- raw_plan_output.split("\n").each do |output_var|
213
- key, value = output_var.split("=")
214
- output_vars[key.strip] = value.strip
215
- end
216
+ parse_key_value_variables(raw_plan_output)
217
+ end
218
+
219
+ def var_file_variables
220
+ raise "Vars file #{var_file_path} does not exist" unless File.exist?(var_file_path)
216
221
 
217
- output_vars
222
+ raw_var_file_variables = File.read(var_file_path)
223
+ parse_key_value_variables(raw_var_file_variables)
218
224
  end
219
225
 
220
226
  def terraform_version
@@ -279,5 +285,18 @@ module Hashicorptools
279
285
  def dns_record_exists?(parent_node_fqdn, record)
280
286
  dynect.node_list(nil, parent_node_fqdn).include?(record.fqdn)
281
287
  end
288
+
289
+ private
290
+
291
+ def parse_key_value_variables(vars_string)
292
+ vars = {}
293
+ vars_string.split("\n").each do |string_var|
294
+ next if string_var.blank?
295
+ key, value = string_var.split("=")
296
+ vars[key.strip] = value.strip.gsub('"', '')
297
+ end
298
+
299
+ vars
300
+ end
282
301
  end
283
302
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hashicorptools
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Woodhull
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-21 00:00:00.000000000 Z
11
+ date: 2016-02-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk