terraspace 2.1.4 → 2.1.7

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
  SHA256:
3
- metadata.gz: 2409bdde16554e4640220d326b2905ebef223d15b06a9ee92e679b8e4da5d228
4
- data.tar.gz: 2aac87334644fdb9c7d0d1de547796a8d4719b0c090d9be506fc99494de2ab87
3
+ metadata.gz: 550175db9da67e3d7682fd5716c9d57aea3c3457a6b9fc57491d8d7befc4f2b0
4
+ data.tar.gz: 5d79ea28576b48715b6d48fa6e4d259a5c00471a631b4c6fc8c524a8f1c7d363
5
5
  SHA512:
6
- metadata.gz: a3579aef360d7557f69eb4f5db1c3e548b9f8fe788f8bb4a2b13b3e473f3ab0ae6e1d9c0737b7f1e46732b0b81f1b20f7a487baf3d08d936644fc6abb4307448
7
- data.tar.gz: cedfeb838b20c0c5e4dbf5cc8d9140013c1f8309c43c1e665a85fd375e65310d20e25f837cfa77748c2ccb1a7edc8483427b3ffd3b850cfa1e596d5a4c7d157e
6
+ metadata.gz: 6597079c61a475fc990edcdbd1b0ccf6cf459d29e4558ae02911c658ed2bc091bf9c85f1a09bb7202a33bd5f22bfa0df9a080850d4057a6bb478c8317e3cc680
7
+ data.tar.gz: 21f3bad245a3c7ff13dea9aef33714dd77c439fee0fa9073df801970be6ee40937ac30a74b331a79806222c08dac6fb05c0e344e1873d4e9bbf9a98ec16d998d
data/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [2.1.7] - 2022-08-22
7
+ - [#259](https://github.com/boltops-tools/terraspace/pull/259) fix TS_PROJECT for ts cloud
8
+ - builder: skip examples
9
+ - improve generated config app.rb
10
+
11
+ ## [2.1.6] - 2022-08-19
12
+ - [#258](https://github.com/boltops-tools/terraspace/pull/258) Fix terraform apply/destroy missing some passthrough options
13
+
14
+ ## [2.1.5] - 2022-07-21
15
+ - [#255](https://github.com/boltops-tools/terraspace/pull/255) dont compute git info when not cloud not enabled and warn message improvement
16
+ - pin terraspace to major version in initially generated Gemfile
17
+
6
18
  ## [2.1.4] - 2022-07-16
7
19
  - [#252](https://github.com/boltops-tools/terraspace/pull/252) puts friendlier user message with terraspace force_unlock suggestion
8
20
  - [#253](https://github.com/boltops-tools/terraspace/pull/253) azure repo local git support
@@ -1,6 +1,6 @@
1
1
  # Docs: https://terraspace.cloud/docs/config/reference/
2
2
  Terraspace.configure do |config|
3
- config.logger.level = :info
3
+ # config.logger.level = :info
4
4
 
5
5
  # To enable Terraspace Cloud set config.cloud.org
6
6
  # config.cloud.org = "ORG" # required: replace with your org. only letters, numbers, underscore and dashes allowed
@@ -47,7 +47,7 @@ module Terraspace
47
47
  config.bundle.logger = ts_logger
48
48
 
49
49
  config.cloud = ActiveSupport::OrderedOptions.new
50
- config.cloud.project = "main"
50
+ config.cloud.project = Terraspace.project
51
51
  config.cloud.org = ENV['TS_ORG'] # required for Terraspace cloud
52
52
  config.cloud.record = "changes" # IE: changes or all
53
53
  config.cloud.stack = ":APP-:ROLE-:MOD_NAME-:ENV-:EXTRA-:REGION"
@@ -13,7 +13,8 @@ class Terraspace::CLI::New
13
13
 
14
14
  def gem_line(name)
15
15
  if name == "terraspace"
16
- %Q|gem "#{name}", '~> #{Terraspace::VERSION}'|
16
+ major_version = Terraspace::VERSION.split('.').first
17
+ %Q|gem "#{name}", '~> #{major_version}'|
17
18
  else
18
19
  %Q|gem "#{name}"|
19
20
  end
@@ -46,6 +46,7 @@ class Terraspace::Cloud::Vcs
46
46
  # pr_url
47
47
  #
48
48
  def vcs_vars
49
+ return {} unless Terraspace.cloud?
49
50
  ci_env = CiEnv.new
50
51
  local_git = LocalGit.new
51
52
  local_env = LocalEnv.new
@@ -1,7 +1,7 @@
1
1
  class Terraspace::Cloud::Vcs
2
2
  class LocalGit < Base
3
3
  def vars
4
- if git_repo? && git_installed?
4
+ if git_repo? && git_installed? && host
5
5
  provider_vars = vcs_class ? vcs_class.new(base_vars, git_url).vars : {}
6
6
  base_vars.merge(provider_vars).compact # remove items with nil values
7
7
  else
@@ -36,6 +36,15 @@ class Terraspace::Cloud::Vcs
36
36
  return nil if git_url.blank?
37
37
  uri = URI(git_url)
38
38
  "#{uri.scheme}://#{uri.host}"
39
+ rescue URI::InvalidURIError => e
40
+ logger.info "WARN: #{e.class} #{e.message}".color(:yellow)
41
+ logger.info <<~EOL
42
+ Unable to get the host info from your local .git/config
43
+ Will not be able to determine local git info.
44
+ If possible, it would be a useful to provide the remote.url in your .git/config
45
+ as an issue report or email to improve help improve this logic.
46
+ EOL
47
+ nil
39
48
  end
40
49
 
41
50
  def full_repo
@@ -21,6 +21,9 @@ module Terraspace::Compiler
21
21
 
22
22
  def compile_module
23
23
  with_mod_file do |src_path|
24
+ # Skip examples. Dont want to process tfvars <%= output(...) %> which triggers dependency graph
25
+ # Also a speed improvement.
26
+ next if src_path.include?("#{@mod.root}/examples/")
24
27
  compile_mod_file(src_path)
25
28
  end
26
29
  end
@@ -20,7 +20,7 @@ module Terraspace
20
20
 
21
21
  def project
22
22
  if ENV['TS_PROJECT'].blank?
23
- config.cloud.project
23
+ "main"
24
24
  else
25
25
  ENV['TS_PROJECT']
26
26
  end
@@ -60,6 +60,17 @@ module Terraspace::Terraform::Args
60
60
  result
61
61
  end
62
62
 
63
+ def terraform_arg_types
64
+ arg_types = terraform_arg_types_for_command(@name)
65
+ # "terraspace apply/destroy" support the same options as "plan", but they don't document
66
+ # them directly in their "-help" option, so we need to add them.
67
+ if ["apply", "destroy"].include? @name
68
+ arg_types.merge! terraform_arg_types_for_command("plan")
69
+ end
70
+
71
+ arg_types
72
+ end
73
+
63
74
  # Parses terraform COMMAND -help output for arg types.
64
75
  # Return Example:
65
76
  #
@@ -69,8 +80,8 @@ module Terraspace::Terraform::Args
69
80
  # var: :hash,
70
81
  # }
71
82
  #
72
- def terraform_arg_types
73
- out = terraform_help(@name)
83
+ def terraform_arg_types_for_command(name)
84
+ out = terraform_help(name)
74
85
  lines = out.split("\n")
75
86
  lines.select! do |line|
76
87
  line =~ /^ -/
@@ -1,3 +1,3 @@
1
1
  module Terraspace
2
- VERSION = "2.1.4"
2
+ VERSION = "2.1.7"
3
3
  end
@@ -51,6 +51,19 @@ describe Terraspace::Terraform::Args::Pass do
51
51
  end
52
52
  end
53
53
 
54
+ context "indirectly documented args" do
55
+ # "terraform apply -help" doesn't document "-target" directly, but refers to
56
+ # "terraform plan -help" documentation.
57
+ context "-target=resource" do
58
+ let(:args) { ["-target=foo.bar"] }
59
+ let(:name) { "apply" }
60
+ it "pass through args" do
61
+ args = pass.args
62
+ expect(args).to eq ["-target=foo.bar"]
63
+ end
64
+ end
65
+ end
66
+
54
67
  context "hash arg" do
55
68
  context "-var 'foo=bar'" do
56
69
  let(:args) { ["-var 'foo=bar'"] }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terraspace
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-07-16 00:00:00.000000000 Z
11
+ date: 2022-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport