openstax_aws 1.1.0 → 1.2.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/.github/workflows/tests.yml +33 -0
- data/CHANGELOG.md +12 -7
- data/README.md +1 -1
- data/lib/openstax/aws/msk_cluster.rb +4 -0
- data/lib/openstax/aws/packer_1_2_5.rb +1 -1
- data/lib/openstax/aws/packer_1_4_1.rb +30 -11
- data/lib/openstax/aws/secrets.rb +1 -2
- data/lib/openstax/aws/stack_factory.rb +6 -2
- data/lib/openstax/aws/template.rb +13 -1
- data/lib/openstax/aws/version.rb +1 -1
- metadata +4 -4
- data/.travis.yml +0 -12
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: eb329933135fb800a09d8883d181b3a44fa0ff97f58d79757c0710d35f30594c
         | 
| 4 | 
            +
              data.tar.gz: ecf61c1aba906cfb3b7a848c42bffac57193864c138eaa84c8592c697be589c4
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 903288c5e8e78ab5c94e660bbd8657ed9357002fb82a2cdc22f398284d3800daad6c478d669d4072e3c8f74d665aa0ed2fe27687c02e154e582b80fec4ffd97c
         | 
| 7 | 
            +
              data.tar.gz: 75dae33c89bb17c0ebf211450551003158a85ee1228c877f17cad075f596fe5e82bb5562029ed2d746a4f9ea9cba9613d9e9f9cfbcd7e1ba466bc92178a6825a
         | 
| @@ -0,0 +1,33 @@ | |
| 1 | 
            +
            name: Tests
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            on:
         | 
| 4 | 
            +
              pull_request:
         | 
| 5 | 
            +
              push:
         | 
| 6 | 
            +
                branches:
         | 
| 7 | 
            +
                  - main
         | 
| 8 | 
            +
              schedule:
         | 
| 9 | 
            +
                - cron: '0 0 * * 0' # weekly
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            jobs:
         | 
| 12 | 
            +
              tests:
         | 
| 13 | 
            +
                timeout-minutes: 10
         | 
| 14 | 
            +
                runs-on: ubuntu-18.04
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                steps:
         | 
| 17 | 
            +
                  - uses: actions/checkout@v2
         | 
| 18 | 
            +
                  - uses: actions/setup-ruby@v1
         | 
| 19 | 
            +
                    with:
         | 
| 20 | 
            +
                      ruby-version: 2.7
         | 
| 21 | 
            +
                  - uses: actions/cache@v2
         | 
| 22 | 
            +
                    with:
         | 
| 23 | 
            +
                      path: vendor/bundle
         | 
| 24 | 
            +
                      key: ${{ runner.os }}-gems-pr-${{ hashFiles('**/Gemfile.lock') }}
         | 
| 25 | 
            +
                      restore-keys: |
         | 
| 26 | 
            +
                        ${{ runner.os }}-gems-pr-
         | 
| 27 | 
            +
                  - name: Test
         | 
| 28 | 
            +
                    run: |
         | 
| 29 | 
            +
                      gem install bundler --force --no-document --version 2.1.4
         | 
| 30 | 
            +
                      bundle config path vendor/bundle
         | 
| 31 | 
            +
                      bundle config jobs 2
         | 
| 32 | 
            +
                      bundle install
         | 
| 33 | 
            +
                      bundle exec rake
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -6,16 +6,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |
| 6 6 |  | 
| 7 7 | 
             
            ## [Unreleased]
         | 
| 8 8 |  | 
| 9 | 
            -
            ## [1. | 
| 10 | 
            -
             | 
| 11 | 
            -
            Fixed Packer debug mode by reading and printing each character from Packer instead of each line.
         | 
| 9 | 
            +
            ## [1.2.0] - 2021-01-12
         | 
| 12 10 |  | 
| 13 | 
            -
             | 
| 11 | 
            +
            - Added additional method to MskCluster resource, to return sorted list of bootstrap brokers
         | 
| 12 | 
            +
            - Replaced Travis with GH Actions
         | 
| 13 | 
            +
            - All secret types now default to SecureString, not just the RSA keys
         | 
| 14 | 
            +
            - Added CloudFormation ERB templates (cfn files that end in .yml.erb)
         | 
| 15 | 
            +
            - Gracefully handle interrupts while running Packer and return Packer's exit status from the call
         | 
| 14 16 |  | 
| 15 | 
            -
             | 
| 17 | 
            +
            ## [1.1.0] - 2020-10-20
         | 
| 16 18 |  | 
| 17 | 
            -
             | 
| 19 | 
            +
            - Fixed Packer debug mode by reading and printing each character from Packer instead of each line.
         | 
| 20 | 
            +
            - Restricted AMI search to images owned by the same account to prevent a potential security flaw.
         | 
| 21 | 
            +
            - Gitignored Gemfile.lock.
         | 
| 22 | 
            +
            - Removed development dependency on bundler 1.
         | 
| 18 23 |  | 
| 19 24 | 
             
            ## [1.0.0] - 2020-10-03
         | 
| 20 25 |  | 
| 21 | 
            -
            First official version.
         | 
| 26 | 
            +
            - First official version.
         | 
    
        data/README.md
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            # aws-ruby
         | 
| 2 2 |  | 
| 3 | 
            -
            [](https://github.com/openstax/aws-ruby/actions?query=workflow:Tests)
         | 
| 4 4 |  | 
| 5 5 | 
             
            The `openstax_aws` gem helps you deploy your applications to AWS using CloudFormation.  It provides a layer on top of
         | 
| 6 6 | 
             
            the AWS SDKs to help coordinate common deployment steps and configurations.
         | 
| @@ -53,24 +53,43 @@ module OpenStax::Aws | |
| 53 53 | 
             
                    ami = ""
         | 
| 54 54 |  | 
| 55 55 | 
             
                    Open3.popen2e(command) do |stdin, stdout_err, wait_thr|
         | 
| 56 | 
            -
                       | 
| 56 | 
            +
                      begin
         | 
| 57 | 
            +
                        previous_interrupt_handler = Signal.trap 'INT' do
         | 
| 58 | 
            +
                          # Interrupt Packer
         | 
| 59 | 
            +
                          Process.kill 'INT', wait_thr.pid
         | 
| 57 60 |  | 
| 58 | 
            -
             | 
| 61 | 
            +
                          # Restore previous interrupt handler so we don't interrupt Packer again
         | 
| 62 | 
            +
                          Signal.trap 'INT', previous_interrupt_handler
         | 
| 59 63 |  | 
| 60 | 
            -
             | 
| 61 | 
            -
             | 
| 62 | 
            -
                         | 
| 64 | 
            +
                          # Disable other code that restores previous interrupt
         | 
| 65 | 
            +
                          previous_interrupt_handler = nil
         | 
| 66 | 
            +
                        end
         | 
| 63 67 |  | 
| 64 | 
            -
                         | 
| 65 | 
            -
             | 
| 66 | 
            -
                        matchami = line.match(/AMI: (ami-[0-9\-a-z]*)/i)
         | 
| 67 | 
            -
                        ami = matchami.captures[0] if matchami
         | 
| 68 | 
            +
                        stdout_err.sync = true
         | 
| 68 69 |  | 
| 69 70 | 
             
                        line = ''
         | 
| 71 | 
            +
             | 
| 72 | 
            +
                        while char = stdout_err.getc do
         | 
| 73 | 
            +
                          line << char
         | 
| 74 | 
            +
                          STDERR.print char
         | 
| 75 | 
            +
             | 
| 76 | 
            +
                          next unless char == "\n"
         | 
| 77 | 
            +
             | 
| 78 | 
            +
                          matchami = line.match(/AMI: (ami-[0-9\-a-z]*)/i)
         | 
| 79 | 
            +
                          ami = matchami.captures[0] if matchami
         | 
| 80 | 
            +
             | 
| 81 | 
            +
                          line = ''
         | 
| 82 | 
            +
                        end
         | 
| 83 | 
            +
                      ensure
         | 
| 84 | 
            +
                        # Restore previous interrupt unless we did so already
         | 
| 85 | 
            +
                        Signal.trap 'INT', previous_interrupt_handler unless previous_interrupt_handler.nil?
         | 
| 70 86 | 
             
                      end
         | 
| 71 | 
            -
                    end
         | 
| 72 87 |  | 
| 73 | 
            -
             | 
| 88 | 
            +
                      puts ami
         | 
| 89 | 
            +
             | 
| 90 | 
            +
                      # Return Packer's exit status wrapped in a Process::Status object
         | 
| 91 | 
            +
                      wait_thr.value
         | 
| 92 | 
            +
                    end
         | 
| 74 93 | 
             
                  end
         | 
| 75 94 | 
             
                end
         | 
| 76 95 |  | 
    
        data/lib/openstax/aws/secrets.rb
    CHANGED
    
    | @@ -146,7 +146,7 @@ module OpenStax::Aws | |
| 146 146 |  | 
| 147 147 | 
             
                def process_individual_spec_value(spec_value, substitutions)
         | 
| 148 148 | 
             
                  generated = false
         | 
| 149 | 
            -
                  type = " | 
| 149 | 
            +
                  type = "SecureString"
         | 
| 150 150 |  | 
| 151 151 | 
             
                  value = case spec_value
         | 
| 152 152 | 
             
                  when /^random\(hex,(\d+)\)$/
         | 
| @@ -158,7 +158,6 @@ module OpenStax::Aws | |
| 158 158 | 
             
                    num_characters = $1.to_i
         | 
| 159 159 | 
             
                    SecureRandom.urlsafe_base64(num_characters)[0..num_characters-1]
         | 
| 160 160 | 
             
                  when /^rsa\((\d+)\)$/
         | 
| 161 | 
            -
                    type = "SecureString"
         | 
| 162 161 | 
             
                    generated = true
         | 
| 163 162 | 
             
                    key_length = $1.to_i
         | 
| 164 163 | 
             
                    OpenSSL::PKey::RSA.new(key_length).to_s
         | 
| @@ -52,9 +52,13 @@ module OpenStax::Aws | |
| 52 52 | 
             
                    path = File.join(base_directory, "#{@id}.yml")
         | 
| 53 53 |  | 
| 54 54 | 
             
                    if !File.file?(path)
         | 
| 55 | 
            -
                      path = File.join(base_directory, "#{@id}. | 
| 55 | 
            +
                      path = File.join(base_directory, "#{@id}.yml.erb")
         | 
| 56 | 
            +
             | 
| 56 57 | 
             
                      if !File.file?(path)
         | 
| 57 | 
            -
                         | 
| 58 | 
            +
                        path = File.join(base_directory, "#{@id}.json")
         | 
| 59 | 
            +
                        if !File.file?(path)
         | 
| 60 | 
            +
                          raise "Couldn't infer an existing template file for stack #{@id}"
         | 
| 61 | 
            +
                        end
         | 
| 58 62 | 
             
                      end
         | 
| 59 63 | 
             
                    end
         | 
| 60 64 | 
             
                  end
         | 
| @@ -26,8 +26,20 @@ module OpenStax::Aws | |
| 26 26 | 
             
                  File.basename(absolute_file_path)
         | 
| 27 27 | 
             
                end
         | 
| 28 28 |  | 
| 29 | 
            +
                def extname
         | 
| 30 | 
            +
                  File.extname(absolute_file_path)
         | 
| 31 | 
            +
                end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                def erb?
         | 
| 34 | 
            +
                  extname == '.erb'
         | 
| 35 | 
            +
                end
         | 
| 36 | 
            +
             | 
| 29 37 | 
             
                def body
         | 
| 30 | 
            -
                  @body  | 
| 38 | 
            +
                  return @body unless @body.nil?
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                  @body = File.read(absolute_file_path)
         | 
| 41 | 
            +
                  @body = ERB.new(@body).tap { |erb| erb.filename = absolute_file_path }.result if erb?
         | 
| 42 | 
            +
                  @body
         | 
| 31 43 | 
             
                end
         | 
| 32 44 |  | 
| 33 45 | 
             
                def hash
         | 
    
        data/lib/openstax/aws/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: openstax_aws
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 1.2.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - JP Slavinsky
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2021-01-12 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: aws-sdk-autoscaling
         | 
| @@ -273,8 +273,8 @@ executables: | |
| 273 273 | 
             
            extensions: []
         | 
| 274 274 | 
             
            extra_rdoc_files: []
         | 
| 275 275 | 
             
            files:
         | 
| 276 | 
            +
            - ".github/workflows/tests.yml"
         | 
| 276 277 | 
             
            - ".gitignore"
         | 
| 277 | 
            -
            - ".travis.yml"
         | 
| 278 278 | 
             
            - CHANGELOG.md
         | 
| 279 279 | 
             
            - Gemfile
         | 
| 280 280 | 
             
            - LICENSE.txt
         | 
| @@ -342,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 342 342 | 
             
                - !ruby/object:Gem::Version
         | 
| 343 343 | 
             
                  version: '0'
         | 
| 344 344 | 
             
            requirements: []
         | 
| 345 | 
            -
            rubygems_version: 3. | 
| 345 | 
            +
            rubygems_version: 3.0.3
         | 
| 346 346 | 
             
            signing_key: 
         | 
| 347 347 | 
             
            specification_version: 4
         | 
| 348 348 | 
             
            summary: openstax IaC
         |