ruby-terraform 0.5.1 → 0.6.0

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: 02050c996a7a256625d0c264ea5f7cea31b7d476
4
- data.tar.gz: 7dfd66659eca653c4747262fa4bf08f24ccb9825
3
+ metadata.gz: cb50dba7e5a67cd89a8c0bdc54ad793542765436
4
+ data.tar.gz: 3b6ee8318dd2a15dd54b1a9074c41c92581729eb
5
5
  SHA512:
6
- metadata.gz: d08e1205689821842bd11fdd2575f9614964293fa7006186e1a21833ad74ae3932b60b1770d049612c0eca628bda9034ab18b6ee3403a0499323135d023a2a85
7
- data.tar.gz: fdc3713cd3245c04065144a61f49b257d3a1eed2fd4fe5f3a53fad55fbc52c69a282bff9e57e1598c21eb504b590250a95f664e6d6d8de7c368c4fd5108d726d
6
+ metadata.gz: 11a52400c4ccdea66ac3b7e6bb09ad76e96a49ee8156f5c8942597247d299cef76efda8c3f7107fc18fdf37fdcac129de67c59548839e0a047dea4b457616a61
7
+ data.tar.gz: 0b8d0aebf2842209079e8495f5d998553880be8b2db53df89ed50e131234cb62dabd571747cd3340206fc9fc52dcd2fb45b8861ff5933b8427e429818a35375f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-terraform (0.5.1)
4
+ ruby-terraform (0.6.0)
5
5
  lino (~> 1.1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -39,6 +39,7 @@ global configuration value.
39
39
  Currently, there is partial support for the following commands:
40
40
  * `RubyTerraform::Commands::Clean`: clean up all locally held terraform state
41
41
  and modules.
42
+ * `RubyTerraform::Commands::Init`: executes `terraform init`
42
43
  * `RubyTerraform::Commands::Get`: executes `terraform get`
43
44
  * `RubyTerraform::Commands::Apply`: executes `terraform apply`
44
45
  * `RubyTerraform::Commands::Destroy`: executes `terraform destroy`
@@ -62,6 +63,31 @@ removes the specified directory. If the base directory is specified, it
62
63
  removes the .terraform directory from within the base directory.
63
64
 
64
65
 
66
+ ### RubyTerraform::Commands::Init
67
+
68
+ The init command will initialise a terraform environment. It can be called in
69
+ the following ways:
70
+
71
+ ```ruby
72
+ RubyTerraform.init
73
+ RubyTerraform.init(source: 'some/module/path', path: 'infra/module')
74
+ RubyTerraform::Commands::Init.new.execute
75
+ RubyTerraform::Commands::Init.new.execute(
76
+ source: 'some/module/path',
77
+ path: 'infra/module')
78
+ ```
79
+
80
+ The init command supports the following options passed as keyword arguments:
81
+ * `source`: the source module to use to initialise; required if `path` is
82
+ specified
83
+ * `path`: the path to initialise.
84
+ * `backend`: `true`/`false`, whether or not to configure the backend.
85
+ * `get`: `true`/`false`, whether or not to get dependency modules.
86
+ * `backend_config`: a map of backend specific configuration parameters.
87
+ * `no_color`: whether or not the output from the command should be in color;
88
+ defaults to `false`.
89
+
90
+
65
91
  ### RubyTerraform::Commands::Get
66
92
 
67
93
  The get command will fetch any modules referenced in the provided terraform
@@ -69,7 +95,7 @@ configuration directory. It can be called in the following ways:
69
95
 
70
96
  ```ruby
71
97
  RubyTerraform.get(directory: 'infra/networking')
72
- RubyTerraforn::Commands::Get.new.execute(directory: 'infra/networking')
98
+ RubyTerraform::Commands::Get.new.execute(directory: 'infra/networking')
73
99
  ```
74
100
 
75
101
  The get command supports the following options passed as keyword arguments:
@@ -0,0 +1,36 @@
1
+ require 'lino'
2
+ require_relative 'base'
3
+
4
+ module RubyTerraform
5
+ module Commands
6
+ class Init < Base
7
+ def configure_command(builder, opts)
8
+ no_color = opts[:no_color]
9
+ backend = opts[:backend]
10
+ get = opts[:get]
11
+ backend_config = opts[:backend_config] || {}
12
+ source = opts[:source]
13
+ path = opts[:path]
14
+
15
+ builder = builder
16
+ .with_subcommand('init') do |sub|
17
+ sub = sub.with_option('-backend', backend) unless backend.nil?
18
+ sub = sub.with_option('-get', get) unless get.nil?
19
+ sub = sub.with_flag('-no-color') if no_color
20
+ backend_config.each do |key, value|
21
+ sub = sub.with_option(
22
+ '-backend-config',
23
+ "'#{key}=#{value}'",
24
+ separator: ' ')
25
+ end
26
+ sub
27
+ end
28
+
29
+ builder = builder.with_argument(source) if source
30
+ builder = builder.with_argument(path) if path
31
+
32
+ builder
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,4 +1,5 @@
1
1
  require_relative 'commands/clean'
2
+ require_relative 'commands/init'
2
3
  require_relative 'commands/get'
3
4
  require_relative 'commands/plan'
4
5
  require_relative 'commands/apply'
@@ -1,3 +1,3 @@
1
1
  module RubyTerraform
2
- VERSION = "0.5.1"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -23,6 +23,10 @@ module RubyTerraform
23
23
  Commands::Clean.new.execute(opts)
24
24
  end
25
25
 
26
+ def init(opts = {})
27
+ Commands::Init.new.execute(opts)
28
+ end
29
+
26
30
  def get(opts = {})
27
31
  Commands::Get.new.execute(opts)
28
32
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-terraform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toby Clemson
@@ -107,6 +107,7 @@ files:
107
107
  - lib/ruby_terraform/commands/clean.rb
108
108
  - lib/ruby_terraform/commands/destroy.rb
109
109
  - lib/ruby_terraform/commands/get.rb
110
+ - lib/ruby_terraform/commands/init.rb
110
111
  - lib/ruby_terraform/commands/output.rb
111
112
  - lib/ruby_terraform/commands/plan.rb
112
113
  - lib/ruby_terraform/commands/remote_config.rb