prospectus_terraform 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c8f43f4d7dbc603b5b871a6b60bbd42d00dc7f418a66345cd317b08f2a5c44e9
4
+ data.tar.gz: 59a50d7af377742b718765c01b74aaf8287083d223dfb1fa1f6336b1051fe0f5
5
+ SHA512:
6
+ metadata.gz: 0644a4f47fd1b300a6fd5cdc570dea45664b6942e9c19751253e29347e8231fb23d2c253e2309619723f5fc95705d9c6fb5a8d9eac1ef269b6cf1af85a4f583d
7
+ data.tar.gz: 793a6fa9213fc9d6c61b2663a561b65910abf7a421d5844cbb466bbd920a8ed6fa03b270375b6db6949cec68e1407729278110f1c1d284aa87c49ac508e1ff27
data/.circle-ruby ADDED
@@ -0,0 +1,3 @@
1
+ 2.5.1
2
+ 2.4.4
3
+ 2.3.7
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ pkg/*.gem
2
+ coverage/
3
+ .coveralls.yml
4
+ .bundle
5
+ Gemfile.lock
data/.prospectus ADDED
@@ -0,0 +1,11 @@
1
+ my_slug = 'akerl/prospectus_terraform'
2
+
3
+ Prospectus.extra_dep('file', 'prospectus_travis')
4
+ Prospectus.extra_dep('file', 'prospectus_gems')
5
+
6
+ item do
7
+ noop
8
+
9
+ extend ProspectusGems::Gemspec.new
10
+ extend ProspectusTravis::Build.new(my_slug)
11
+ end
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format Fuubar
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ inherit_gem:
2
+ goodcop: .rubocop.yml
data/.travis.yml ADDED
@@ -0,0 +1,10 @@
1
+ dist: trusty
2
+ install:
3
+ - for i in $(cat .circle-ruby) ; do rvm install $i || exit 1 ; done
4
+ - for i in $(cat .circle-ruby) ; do rvm-exec $i bundle install || exit 1 ; done
5
+ script:
6
+ - for i in $(cat .circle-ruby) ; do rvm-exec $i bundle exec rake || exit 1 ; done
7
+ notifications:
8
+ email: false
9
+ slack:
10
+ secure: ZUyvff4gdZ+0oebOPBVSBJutNRqnq1Br2NrkO/Aba087VkuUp/vic8AH8b9ss4IzkkFTvGHl8AdF5gDY/o2nqtNnxhHW6V768Om3BC54b8Mv+etTO+owdsxzJlEvnLOLpnqhC+VFjN4KYKiFpw8NCajDVsi5Hn7Cm8MmFAY1dOsozmrbkHGnK6ECe4g+t5pNWeFJ+7uSRDNKT2yRgxVAtxdqNo4EN9SqfR4xxOq8FdpfAQWYbKNankXSC3joTyCa+8hOH0CJTNgrFVc4kUlMVwxUeY1pxoq4YKWJBSMgoOlc3QhGvrSHrwfe7Mkyb3svYMFUqqppLEzLKxOY7/0AtdoPCw7gw/4tbRqJ01P53niAnDtxIJrqdKzH4N29mbLuDwCCqgK7wHMJip1zksUniW2Ihmq4JImR3V83HGNugflVvYpdpKuxpmSHoThsZKlx/PD2MyrV4o4LXMinDFKzAeOkx2Nu/3oSm01j8b2MjgsdggDC5wNb9vINCYkQuK7bDDJOixQDbfwE3WHP7RNiNuZdXQzeawML4B/6D2Z+nm0iQJeIi4XtPrkSjpxMrO/HtKbdEpHl/wKhyrxd9ee2ZVHCNAPruw3+vYsPTRex8pp1hP2DzPZl+zKmr5ttVKTOeAPvj9XIkPp3fzuO5g2vHF116SY0BZEBcXPpvgzH8zU=
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Les Aker
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ prospectus_terraform
2
+ =========
3
+
4
+ [![Gem Version](https://img.shields.io/gem/v/prospectus_terraform.svg)](https://rubygems.org/gems/prospectus_terraform)
5
+ [![Build Status](https://img.shields.io/travis/com/akerl/prospectus_terraform.svg)](https://travis-ci.com/akerl/prospectus_terraform)
6
+ [![Coverage Status](https://img.shields.io/codecov/c/github/akerl/prospectus_terraform.svg)](https://codecov.io/github/akerl/prospectus_terraform)
7
+ [![Code Quality](https://img.shields.io/codacy/c5623564a4034ece993510d28edb19de.svg)](https://www.codacy.com/app/akerl/prospectus_terraform)
8
+ [![MIT Licensed](https://img.shields.io/badge/license-MIT-green.svg)](https://tldrlegal.com/license/mit-license)
9
+
10
+ [Prospectus](https://github.com/akerl/prospectus) helpers for Terraform repos
11
+
12
+ ## Usage
13
+
14
+ Add the following 2 lines to the .prospectus:
15
+
16
+ ```
17
+ ## Add this at the top
18
+ Prospectus.extra_dep('file', 'prospectus_terraform')
19
+
20
+ ## Add this inside your terraform repo to check for provider updates
21
+ extend ProspectusTerraform.new
22
+ ```
23
+
24
+ If some of your providers have a custom Github Repo, you can set it by adding a comment in the main.tf in their section as shown:
25
+
26
+ ```
27
+ provider "awscreds" {
28
+ // provider.awscreds akerl/terraform-provider-awscreds
29
+ version = "0.0.5"
30
+ region = "us-east-1"
31
+ }
32
+ ```
33
+
34
+ ## Installation
35
+
36
+ gem install prospectus_terraform
37
+
38
+ ## License
39
+
40
+ prospectus_terraform is released under the MIT License. See the bundled LICENSE file for details.
41
+
data/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'rubocop/rake_task'
4
+
5
+ desc 'Run tests'
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ desc 'Run Rubocop on the gem'
9
+ RuboCop::RakeTask.new(:rubocop) do |task|
10
+ task.fail_on_error = true
11
+ end
12
+
13
+ task default: %i[spec rubocop build install]
@@ -0,0 +1 @@
1
+ require 'prospectus_terraform/providers'
@@ -0,0 +1,65 @@
1
+ module ProspectusTerraform
2
+ ##
3
+ # Lookup object to find providers
4
+ class Lookup
5
+ PROVIDER_REGEX = /provider\.(?<key>[\w-]+) (?<value>[\d.]+)$/
6
+ REPO_REGEX = %r{^ // provider\.(?<key>[\w-]+) (?<value>[\w-]+\/[\w-]+)}
7
+
8
+ def results
9
+ @results ||= providers.map do |name, version|
10
+ [name, version, repos[name] || default_repo(name)]
11
+ end
12
+ end
13
+
14
+ def providers
15
+ @providers ||= match_to_hash(provider_lines, PROVIDER_REGEX)
16
+ end
17
+
18
+ def provider_lines
19
+ @provider_lines ||= `terraform providers`.lines
20
+ end
21
+
22
+ def repos
23
+ @repos ||= match_to_hash(repo_lines, REPO_REGEX)
24
+ end
25
+
26
+ def repo_lines
27
+ @repo_lines ||= File.read('main.tf').lines
28
+ end
29
+
30
+ def match_to_hash(lines, regex)
31
+ lines.map { |x| x.match(regex) }.compact.map { |x| [x[1], x[2]] }.to_h
32
+ end
33
+
34
+ def default_repo(name)
35
+ "terraform-providers/terraform-provider-#{name}"
36
+ end
37
+ end
38
+
39
+ ##
40
+ # Helper for automatically adding provider status check
41
+ class Providers < Module
42
+ def extended(other) # rubocop:disable Metrics/MethodLength
43
+ lookup = Lookup.new
44
+
45
+ other.deps do
46
+ lookup.results.each do |provider_name, provider_version, provider_repo|
47
+ item do
48
+ name "provider-#{provider_name}"
49
+
50
+ expected do
51
+ github_tag
52
+ repo provider_repo
53
+ regex(/^v?([\d.]+)$/)
54
+ end
55
+
56
+ actual do
57
+ static
58
+ set provider_version
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,24 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'prospectus_terraform'
3
+ s.version = '0.0.1'
4
+ s.date = Time.now.strftime('%Y-%m-%d')
5
+
6
+ s.summary = 'Prospectus helpers for Terraform'
7
+ s.description = 'Prospectus helpers for Terraform'
8
+ s.authors = ['Les Aker']
9
+ s.email = 'me@lesaker.org'
10
+ s.homepage = 'https://github.com/akerl/prospectus_terraform'
11
+ s.license = 'MIT'
12
+
13
+ s.files = `git ls-files`.split
14
+ s.test_files = `git ls-files spec/*`.split
15
+
16
+ s.add_dependency 'prospectus', '~> 0.8.0'
17
+
18
+ s.add_development_dependency 'codecov', '~> 0.1.1'
19
+ s.add_development_dependency 'fuubar', '~> 2.3.0'
20
+ s.add_development_dependency 'goodcop', '~> 0.6.0'
21
+ s.add_development_dependency 'rake', '~> 12.3.0'
22
+ s.add_development_dependency 'rspec', '~> 3.8.0'
23
+ s.add_development_dependency 'rubocop', '~> 0.59.0'
24
+ end
@@ -0,0 +1 @@
1
+ require 'spec_helper'
@@ -0,0 +1,11 @@
1
+ if ENV['CI'] == 'true'
2
+ require 'simplecov'
3
+ require 'codecov'
4
+ SimpleCov.formatter = SimpleCov::Formatter::Codecov
5
+ SimpleCov.start do
6
+ add_filter '/spec/'
7
+ end
8
+ end
9
+
10
+ require 'rspec'
11
+ require 'prospectus_terraform'
metadata ADDED
@@ -0,0 +1,158 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: prospectus_terraform
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Les Aker
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-10-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: prospectus
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.8.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.8.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: codecov
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.1.1
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.1.1
41
+ - !ruby/object:Gem::Dependency
42
+ name: fuubar
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 2.3.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 2.3.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: goodcop
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.6.0
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.6.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: 12.3.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 12.3.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 3.8.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 3.8.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.59.0
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.59.0
111
+ description: Prospectus helpers for Terraform
112
+ email: me@lesaker.org
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - ".circle-ruby"
118
+ - ".gitignore"
119
+ - ".prospectus"
120
+ - ".rspec"
121
+ - ".rubocop.yml"
122
+ - ".travis.yml"
123
+ - Gemfile
124
+ - LICENSE
125
+ - README.md
126
+ - Rakefile
127
+ - lib/prospectus_terraform.rb
128
+ - lib/prospectus_terraform/providers.rb
129
+ - prospectus_terraform.gemspec
130
+ - spec/prospectus_terraform_spec.rb
131
+ - spec/spec_helper.rb
132
+ homepage: https://github.com/akerl/prospectus_terraform
133
+ licenses:
134
+ - MIT
135
+ metadata: {}
136
+ post_install_message:
137
+ rdoc_options: []
138
+ require_paths:
139
+ - lib
140
+ required_ruby_version: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ required_rubygems_version: !ruby/object:Gem::Requirement
146
+ requirements:
147
+ - - ">="
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ requirements: []
151
+ rubyforge_project:
152
+ rubygems_version: 2.7.6
153
+ signing_key:
154
+ specification_version: 4
155
+ summary: Prospectus helpers for Terraform
156
+ test_files:
157
+ - spec/prospectus_terraform_spec.rb
158
+ - spec/spec_helper.rb