dh-proteus 0.3.6 → 0.4.0

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: ee44660b54c99fcc0430739f91d7c983be8ae26dc5f7dd6bd240a8faf1419e94
4
- data.tar.gz: 3321c7016cde53892060b64e05cc26a55e14a6cdfd66584bb38297fbc059fe57
3
+ metadata.gz: 198ea1d92f009a7ed877e1cb46329ba10b5c4855e79c1c856f08dfc9420c2118
4
+ data.tar.gz: 5c73915240e65f69392002661ced9663dce724dd9822347a50b69107869d2a30
5
5
  SHA512:
6
- metadata.gz: efe2adfa660b4e6e05760301eefc5fe382906bf76d3f38e6aca879eb9772ccd6a5f1f955904fd936862fe460ae8b77c8f920ed03ffde71806a2e94aa9d98d9bc
7
- data.tar.gz: a131676d34b70fbaa94a0e02e317ba26f64f32f9d5a309494f7959ccb753d588463cc5b6a5b57299dafa7360d874ed27fd0210c1ccf4759102f13b29d73e69be
6
+ metadata.gz: 56a2d03c731dfa1ba3f810c22feba6e243e665c2b9e7faef70f9e129f6c787af34e1d80e1ec77f43b6dc54e94f45710905320dac4d42344d1bbc41069cc6ccc3
7
+ data.tar.gz: f82e55e042534ea910ea64450b91023f336212e7d2d08966052074bd06c400902dd460ae4ec5bfde63e7ac957f0e752d540d937b408a8c7f93a77851aff4f11c
@@ -79,6 +79,10 @@ module Proteus
79
79
  key = "<%= @config[:backend][@backend_key][:key_prefix] %>#{@context}-#{@environment}.tfstate"
80
80
  region = "<%= @config[:backend][@backend_key][:bucket][:region] %>"
81
81
  profile = "<%= @config[:backend][@backend_key][:profile]%>"
82
+ <%- if (@config[:backend][@backend_key].keys & ["encrypt", "kms_key_id"]).size == 2 -%>
83
+ encrypt = true
84
+ kms_key_id = "<%= @config[:backend][@backend_key][:kms_key_id] %>"
85
+ <%- end -%>
82
86
  }
83
87
  }
84
88
  TEMPLATE
@@ -10,6 +10,7 @@ module Proteus
10
10
  long_desc <<-LONGDESC
11
11
  Renders the module templates without running Terraform
12
12
  LONGDESC
13
+ option :init, type: :boolean, default: false
13
14
  def render
14
15
  render_backend
15
16
  module_manager = Proteus::Modules::Manager.new(context: context, environment: environment)
@@ -26,6 +27,8 @@ module Proteus
26
27
  suppress: true
27
28
  )
28
29
 
30
+ init(verbose: parent_options[:verbose]) if options[:init]
31
+
29
32
  say "Formatted files:", :green
30
33
  say fmt_output, :green
31
34
  end
@@ -0,0 +1,31 @@
1
+ module Proteus
2
+ module Commands
3
+ module Untaint
4
+ def self.included(thor_class)
5
+ thor_class.class_eval do
6
+
7
+ desc "untaint", "Untaints an existing resource"
8
+ long_desc <<-LONGDESC
9
+ Untaints an existing resource
10
+
11
+ --resource The resource to untaint
12
+ LONGDESC
13
+ option :resource, type: :string, aliases: "-r", required: true
14
+ def untaint
15
+ init(verbose: parent_options[:verbose])
16
+ confirm question: "Do you really want to run 'terraform untaint' on environment '#{environment}' in context '#{context}'?", color: :on_red, exit_code: 0 do
17
+
18
+ untaint_command = <<~UNTAINT_COMMAND
19
+ cd #{context_path(context)} && \
20
+ terraform untaint \
21
+ #{options[:resource]}
22
+ UNTAINT_COMMAND
23
+ syscall untaint_command.squeeze(' ')
24
+ end
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -7,6 +7,7 @@ require 'proteus/commands/output'
7
7
  require 'proteus/commands/plan'
8
8
  require 'proteus/commands/render'
9
9
  require 'proteus/commands/taint'
10
+ require 'proteus/commands/untaint'
10
11
 
11
12
  module Proteus
12
13
  class Common < Thor
@@ -45,6 +46,7 @@ module Proteus
45
46
  `rm -rf #{context_path(context)}/.terraform/*.tf*`
46
47
  `rm -rf #{context_path(context)}/.terraform/modules`
47
48
  `rm -rf #{context_path(context)}/terraform.tfstate*`
49
+ `rm -rf #{context_path(context)}/.terraform.lock.hcl`
48
50
 
49
51
  terraform_command = <<~TERRAFORM_COMMAND
50
52
  cd #{context_path(context)} && \
@@ -35,7 +35,9 @@ module Proteus
35
35
  if tfvars_content.empty?
36
36
  terraform_variables = []
37
37
  else
38
- terraform_variables = JSON.parse(parse_tfvars(tfvars: tfvars_content))
38
+ terraform_variables = JSON.parse(parse_tfvars(tfvars: tfvars_content)).merge({
39
+ 'proteus_environment' => @environment
40
+ })
39
41
  end
40
42
 
41
43
  @modules = []
@@ -1,5 +1,5 @@
1
1
  module Proteus
2
- VERSION = "0.3.6"
2
+ VERSION = "0.4.0"
3
3
  end
4
4
 
5
5
  if $0 == __FILE__
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dh-proteus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Albrecht
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-26 00:00:00.000000000 Z
11
+ date: 2021-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -160,6 +160,7 @@ files:
160
160
  - lib/proteus/commands/state/remove.rb
161
161
  - lib/proteus/commands/state/show.rb
162
162
  - lib/proteus/commands/taint.rb
163
+ - lib/proteus/commands/untaint.rb
163
164
  - lib/proteus/common.rb
164
165
  - lib/proteus/config/config.rb
165
166
  - lib/proteus/context_management/context.rb
@@ -214,7 +215,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
215
  - !ruby/object:Gem::Version
215
216
  version: '0'
216
217
  requirements: []
217
- rubygems_version: 3.2.3
218
+ rubygems_version: 3.2.15
218
219
  signing_key:
219
220
  specification_version: 4
220
221
  summary: Proteus is a Terraform wrapper application.