ruby-terraform 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +27 -1
- data/lib/ruby_terraform/commands/init.rb +36 -0
- data/lib/ruby_terraform/commands.rb +1 -0
- data/lib/ruby_terraform/version.rb +1 -1
- data/lib/ruby_terraform.rb +4 -0
- metadata +2 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: cb50dba7e5a67cd89a8c0bdc54ad793542765436
         | 
| 4 | 
            +
              data.tar.gz: 3b6ee8318dd2a15dd54b1a9074c41c92581729eb
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 11a52400c4ccdea66ac3b7e6bb09ad76e96a49ee8156f5c8942597247d299cef76efda8c3f7107fc18fdf37fdcac129de67c59548839e0a047dea4b457616a61
         | 
| 7 | 
            +
              data.tar.gz: 0b8d0aebf2842209079e8495f5d998553880be8b2db53df89ed50e131234cb62dabd571747cd3340206fc9fc52dcd2fb45b8861ff5933b8427e429818a35375f
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        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 | 
            -
             | 
| 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
         | 
    
        data/lib/ruby_terraform.rb
    CHANGED
    
    
    
        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. | 
| 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
         |