terraspace 0.5.0 → 0.5.5

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: bbf29f1226e7dc336c0eaf99892e158aff3b804bd56bbd1dc744fd17a65c6ff0
4
- data.tar.gz: 6c32f1fe94e9dc53f6ddbfca3cef7c1178a11d788b32ad6ad3fdc88d64e268fa
3
+ metadata.gz: 2c1f2eeedf81924675273ea090cf485919fe3fa74f178dad36cb49a92a91cbc7
4
+ data.tar.gz: cb925de348699c79e71a86a8a17c518ead35ed3c1efd8d1639938019ea93f2b9
5
5
  SHA512:
6
- metadata.gz: b5e45213f23aaed8b4348d4a68179b2706577d6cdf7cf2588f979feb6433e742851392331a8d2909be4a745b6ef9089c419d22d4dd6140ec981c536e809c29df
7
- data.tar.gz: f9e436d5ee96f410c66d673819a789ffdca814f8d53c8f7c97b2b005c9d2bd5cd48fc9a6619407ec7da42e0d3ca503666a5e3d2f2124f30b211a22ba87ec7075
6
+ metadata.gz: 5013095abeeb89a2229bd85d197dd424f5675e69b23f5c24752c6d70ac4d461c00762c9d2025c01d64066622a1d342dfdf1fe4a06d8125ad10329a569f79de31
7
+ data.tar.gz: a5d2374d71923a9df87cd7ecd045b196017c101562265aca253a998ced96646896aab5af5e1a77f26e5cb8bb960628fc0c716a8519a4e21387d4a5afbe1c991b
@@ -10,6 +10,6 @@ export PATH=~/bin:$PATH # ~/bin/terraspace wrapper
10
10
  set -x
11
11
  terraspace new project infra --examples
12
12
  cd infra
13
- terraspace new bootstrap_test
14
- terraspace new project_test demo --examples
13
+ terraspace new test demo --type stack
14
+ cd app/stacks/demo
15
15
  terraspace test
@@ -17,6 +17,6 @@ export ARM_TENANT_ID=$(cat ~/.azure/app-client.json | jq -r '.tenant_id')
17
17
  set -x
18
18
  terraspace new project infra --examples --plugin azurerm
19
19
  cd infra
20
- terraspace new bootstrap_test
21
- terraspace new project_test demo --examples --plugin azurerm
20
+ terraspace new test demo --type stack
21
+ cd app/stacks/demo
22
22
  terraspace test
@@ -14,6 +14,6 @@ export GOOGLE_PROJECT=$(cat $GOOGLE_APPLICATION_CREDENTIALS | jq -r '.project_id
14
14
  set -x
15
15
  terraspace new project infra --examples --plugin google
16
16
  cd infra
17
- terraspace new bootstrap_test
18
- terraspace new project_test demo --examples --plugin google
17
+ terraspace new test demo --type stack
18
+ cd app/stacks/demo
19
19
  terraspace test
@@ -2,6 +2,6 @@ Please fill out one of the templates on https://github.com/boltops-tools/terrasp
2
2
 
3
3
  If you want to ask a question please do so on sites like StackOverflow.
4
4
 
5
- To be sensitive to everyone's time, we may close issues asking questions without comment. Here are some additional options also https://terraspace.cloud/docs/support/ 👌
5
+ To be sensitive to everyone's time, we may close issues asking questions without comment. Here are some additional options also https://terraspace.cloud/support/ 👌
6
6
 
7
7
  Thank you!
@@ -3,6 +3,25 @@
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
+ ## [0.5.5] - 2020-11-27
7
+ - fix link
8
+
9
+ ## [0.5.4] - 2020-11-27
10
+ - fix check setup when terraform not found
11
+
12
+ ## [0.5.3] - 2020-11-27
13
+ - [#60](https://github.com/boltops-tools/terraspace/pull/60) fix terraspace check_setup, use type and allow to run outside project
14
+ - improve terraform is not installed message
15
+
16
+ ## [0.5.2] - 2020-11-27
17
+ - [#59](https://github.com/boltops-tools/terraspace/pull/59) only run bundler/setup within terraspace project and check standalone install
18
+ - fix terraspace help
19
+ - fix terraspace setup check when terraform is not installed
20
+
21
+ ## [0.5.1] - 2020-11-17
22
+ - [#56](https://github.com/boltops-tools/terraspace/pull/56) fix arg and hook generators
23
+ - fix ci build
24
+
6
25
  ## [0.5.0] - 2020-11-15
7
26
  - [#55](https://github.com/boltops-tools/terraspace/pull/55) custom helpers support
8
27
  - plugin helpers support: aws_secret, aws_ssm, google_secret, etc
data/README.md CHANGED
@@ -105,8 +105,9 @@ To install modules:
105
105
 
106
106
  * [Config Structure](https://terraspace.cloud/docs/config/): A common config structure that gets materializes with the deployed module. Configs can be dynamically controlled to keep your code DRY. You can override the settings if needed, like for using existing backends. See: [Existing Backends](https://terraspace.cloud/docs/state/existing/).
107
107
  * [Generators](https://terraspace.cloud/docs/generators/): Built-in generators to quickly create the starter module. Focus on code instead of boilerplate structure.
108
- * [Tfvars](https://terraspace.cloud/docs/tfvars/) & [Layering](https://terraspace.cloud/docs/tfvars/layering/): Use the same code with different tfvars to create multiple environments. Terraspace conventionally loads tfvars from the `tfvars` folder. Rich layering support allows you to build different environments like dev and prod with the same code. Examples are in [Full Layering](https://terraspace.cloud/docs/tfvars/full-layering/).
108
+ * [Multiple Environments](https://terraspace.cloud/docs/patterns/multiple-envs/): [Tfvars](https://terraspace.cloud/docs/tfvars/) & [Layering](https://terraspace.cloud/docs/tfvars/layering/) allow you to the same code with different tfvars to create multiple environments. Terraspace conventionally loads tfvars from the `tfvars` folder. Rich layering support allows you to build different environments like dev and prod with the same code. Examples are in [Full Layering](https://terraspace.cloud/docs/tfvars/full-layering/).
109
109
  * [Deploy Multiple Stacks](https://terraspace.cloud/docs/intro/deploy-all/): The ability to deploy multiple stacks with a single command. Terraspace calculates the [dependency graph](https://terraspace.cloud/docs/dependencies/) and deploys stacks in the right order. You can also target specific stacks and deploy [subgraphs](https://terraspace.cloud/docs/dependencies/subgraphs/).
110
+ * [Secrets Support](https://terraspace.cloud/docs/helpers/aws/secrets/): Terraspace has built-in secrets support for [AWS Secrets Manager](https://terraspace.cloud/docs/helpers/aws/secrets/), [AWS SSM Parameter Store](https://terraspace.cloud/docs/helpers/aws/ssm/), [Azure Key Vault](https://terraspace.cloud/docs/helpers/azure/secrets/), [Google Secrets Manager](https://terraspace.cloud/docs/helpers/google/secrets/). Easily set variables from Cloud secrets providers.
110
111
  * [Terrafile](https://terraspace.cloud/docs/terrafile/): Terraspace makes it easy to use Terraform modules sourced from your own git repositories, other git repositories, or the Terraform Registry. The git repos can be private or public. This is an incredibly powerful feature of Terraspace because it opens up a world of modules for you to use. Use any module you want.
111
112
  * [Configurable CLI](https://terraspace.cloud/docs/config/args/): Configurable [CLI Hooks](https://terraspace.cloud/docs/config/hooks/) and [CLI Args](https://terraspace.cloud/docs/config/args/) allow you to adjust the underlying terraform command.
112
113
  * [Testing](https://terraspace.cloud/docs/testing/): A testing framework that allows you to create test harnesses, deploy real-resources, and have higher confidence that your code works.
@@ -1,3 +1,3 @@
1
- command("<%= arg_name %>",
1
+ command("<%= name %>",
2
2
  args: ["-lock-timeout=22m"],
3
3
  )
@@ -1,7 +1,7 @@
1
- before("<%= hook_name %>",
2
- execute: "echo '<%= hook_path %>: test <%= type %> before hook for <%= kind %> <%= hook_name %>'",
1
+ before("<%= name %>",
2
+ execute: "echo '<%= hook_path %>: test <%= type %> before hook for <%= kind %> <%= name %>'",
3
3
  )
4
4
 
5
- after("<%= hook_name %>",
6
- execute: "echo '<%= hook_path %>: test <%= type %> after hook for <%= kind %> <%= hook_name %>'"
5
+ after("<%= name %>",
6
+ execute: "echo '<%= hook_path %>: test <%= type %> after hook for <%= kind %> <%= name %>'"
7
7
  )
@@ -1,7 +1,5 @@
1
- if File.exist?("config/app.rb")
2
- require "terraspace/bundle"
3
- Terraspace::Bundle.setup
4
- end
1
+ require "terraspace/bundle"
2
+ Terraspace::Bundle.setup
5
3
  require "zeitwerk"
6
4
 
7
5
  module Terraspace
@@ -8,6 +8,7 @@ module Terraspace
8
8
  #
9
9
  def setup
10
10
  return unless gemfile?
11
+ return unless terraspace_project?
11
12
  Kernel.require "bundler/setup"
12
13
  Bundler.setup # Same as Bundler.setup(:default)
13
14
  rescue LoadError => e
@@ -16,12 +17,17 @@ module Terraspace
16
17
 
17
18
  def require
18
19
  return unless gemfile?
20
+ return unless terraspace_project?
19
21
  Kernel.require "bundler/setup"
20
22
  Bundler.require(*bundler_groups)
21
23
  rescue LoadError => e
22
24
  handle_error(e)
23
25
  end
24
26
 
27
+ def terraspace_project?
28
+ File.exist?("config/app.rb")
29
+ end
30
+
25
31
  def handle_error(e)
26
32
  puts e.message
27
33
  return if e.message.include?("already activated")
@@ -17,7 +17,7 @@ class Terraspace::CLI
17
17
  puts "Detected #{terraform_version_message}"
18
18
  check_required_version!
19
19
  else
20
- puts "Terraform not installed. Unable to detect a terraform command. Please double check that terraform is installed."
20
+ puts terraform_is_not_installed
21
21
  exit 1
22
22
  end
23
23
  end
@@ -38,7 +38,19 @@ class Terraspace::CLI
38
38
  ARGV[0] == "check_setup"
39
39
  end
40
40
 
41
+ def terraform_is_not_installed
42
+ <<~EOL
43
+ Terraform not installed. Unable to detect a terraform command. Please double check that terraform is installed.
44
+ See: https://terraspace.cloud/docs/install/terraform/
45
+ EOL
46
+ end
47
+
41
48
  def ok?
49
+ unless terraform_bin
50
+ puts terraform_is_not_installed
51
+ exit 1
52
+ end
53
+
42
54
  version = terraform_version_message.sub(/.*v/,'') # => 0.12.24
43
55
  unless version.match(/\d+\.\d+\.\d+/) # just parse did not find the version number
44
56
  puts "WARN: Unable to get the terraform version".color(:yellow)
@@ -52,8 +64,10 @@ class Terraspace::CLI
52
64
  end
53
65
 
54
66
  def terraform_bin
55
- bin_path = `which terraform 2>&1`.strip
56
- bin_path if $?.success?
67
+ out = `type terraform 2>&1`.strip
68
+ return unless $?.success?
69
+ md = out.match(/is (.*)/)
70
+ md[1] if md
57
71
  end
58
72
  memoize :terraform_bin
59
73
 
@@ -30,6 +30,7 @@ module Terraspace
30
30
  include Terraspace::Util::Logging
31
31
 
32
32
  def dispatch(m, args, options, config)
33
+ check_standalone_install!
33
34
  check_project!(args.first)
34
35
 
35
36
  # Allow calling for help via:
@@ -58,9 +59,42 @@ module Terraspace
58
59
  super
59
60
  end
60
61
 
62
+ def check_standalone_install!
63
+ return unless opt?
64
+ version_manager = "rvm" if rvm?
65
+ version_manager = "rbenv" if rbenv?
66
+ if rbenv? || rvm?
67
+ puts <<~EOL.color(:yellow)
68
+ WARN: It looks like a standalone Terraspace install and #{version_manager} is also in use.
69
+ Different gems from the standalone Terraspace install and #{version_manager} can cause all kinds of trouble.
70
+ Please install Terraspace as a gem instead and remove the standalone Terraspace /opt/terraspace installation.
71
+ See: https://terraspace.cloud/docs/install/gem/
72
+ EOL
73
+ end
74
+ end
75
+
76
+ def opt?
77
+ paths = ENV['PATH'].split(':')
78
+ opt = paths.detect { |p| p.include?('/opt/terraspace') }
79
+ opt && File.exist?('/opt/terraspace')
80
+ end
81
+
82
+ def rvm?
83
+ paths = ENV['PATH'].split(':')
84
+ rvm = paths.detect { |p| p.include?('/rvm/') || p.include?('/.rvm/') }
85
+ rvm && system("type rvm > /dev/null 2>&1")
86
+ end
87
+
88
+ def rbenv?
89
+ paths = ENV['PATH'].split(':')
90
+ rbenv = paths.detect { |p| p.include?('/rbenv/') || p.include?('/.rbenv/') }
91
+ rbenv && system("type rbenv > /dev/null 2>&1")
92
+ end
93
+
61
94
  def check_project!(command_name)
62
95
  return if subcommand?
63
- return if %w[-h -v completion completion_script help new test version].include?(command_name)
96
+ return if command_name.nil?
97
+ return if %w[-h -v check_setup completion completion_script help new test version].include?(command_name)
64
98
  return if File.exist?("#{Terraspace.root}/config/app.rb")
65
99
  logger.error "ERROR: It doesnt look like this is a terraspace project. Are you sure you are in a terraspace project?".color(:red)
66
100
  ENV['TS_TEST'] ? raise : exit(1)
@@ -1,3 +1,3 @@
1
1
  module Terraspace
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.5"
3
3
  end
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: 0.5.0
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-11-15 00:00:00.000000000 Z
11
+ date: 2020-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport