simplygenius-atmos 0.11.8 → 0.11.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/simplygenius/atmos/commands/apply.rb +3 -0
- data/lib/simplygenius/atmos/commands/init.rb +1 -12
- data/lib/simplygenius/atmos/commands/plan.rb +3 -0
- data/lib/simplygenius/atmos/commands/terraform.rb +32 -1
- data/lib/simplygenius/atmos/version.rb +1 -1
- data/templates/new/config/atmos/runtime.yml +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 685baebb62604a3094114ff1616e1e044c0560ed9285c27686a4b8c3e635f964
|
4
|
+
data.tar.gz: 2eadc8adc7ca8574de3d9f44d1af4d7668c17de8d9b6bee7f38c5f3234f47f63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96249401ac017e427d0a5131f8ee441d51da30b91ae5da13a42bbddc258b1f7402c30411d5d304f2680c79e88d6e62eed8bfa26f0f70bd1b85eaf5ced69fd985
|
7
|
+
data.tar.gz: 2025652bff07e78886a228f75e87183eb8b70ec0ec294223008f6abc4203ad9bf3cd617a39c06a521320812454c61e28d2a8c541eb9d5beb7c35b86bad4a3e3f
|
data/CHANGELOG.md
CHANGED
@@ -7,7 +7,6 @@ module SimplyGenius
|
|
7
7
|
module Commands
|
8
8
|
|
9
9
|
class Init < Terraform
|
10
|
-
include FileUtils
|
11
10
|
|
12
11
|
def self.description
|
13
12
|
"Runs terraform init"
|
@@ -17,17 +16,7 @@ module SimplyGenius
|
|
17
16
|
@terraform_arguments.insert(0, "init")
|
18
17
|
super
|
19
18
|
|
20
|
-
|
21
|
-
home_dir = OS.windows? ? File.join("~", "Application Data") : "~"
|
22
|
-
shared_plugins_dir = File.expand_path(File.join(home_dir,".terraform.d", "plugins"))
|
23
|
-
logger.debug("Updating shared terraform plugins dir: #{shared_plugins_dir}")
|
24
|
-
mkdir_p(shared_plugins_dir)
|
25
|
-
terraform_plugins_dir = File.join(Atmos.config.tf_working_dir,'recipes', '.terraform', 'plugins')
|
26
|
-
if File.exist?(terraform_plugins_dir)
|
27
|
-
cp_r("#{terraform_plugins_dir}/.", shared_plugins_dir)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
19
|
+
init_shared_plugins
|
31
20
|
end
|
32
21
|
|
33
22
|
end
|
@@ -6,6 +6,9 @@ module SimplyGenius
|
|
6
6
|
module Commands
|
7
7
|
|
8
8
|
class Terraform < BaseCommand
|
9
|
+
include FileUtils
|
10
|
+
|
11
|
+
attr_accessor :auto_init
|
9
12
|
|
10
13
|
def self.description
|
11
14
|
"Runs terraform"
|
@@ -17,6 +20,31 @@ module SimplyGenius
|
|
17
20
|
@terraform_arguments = arguments
|
18
21
|
end
|
19
22
|
|
23
|
+
def init_automatically(auth_env, get_modules)
|
24
|
+
tf_init_dir = File.join(Atmos.config.tf_working_dir, '.terraform')
|
25
|
+
backend_initialized = File.exist?(File.join(tf_init_dir, 'terraform.tfstate'))
|
26
|
+
auto_init_enabled = Atmos.config["atmos.terraform.auto_init"].to_s == "true"
|
27
|
+
|
28
|
+
if auto_init && auto_init_enabled && ! backend_initialized
|
29
|
+
exe = TerraformExecutor.new(process_env: auth_env)
|
30
|
+
exe.run("init", get_modules: get_modules.present?)
|
31
|
+
init_shared_plugins
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
def init_shared_plugins
|
36
|
+
if ! Atmos.config["atmos.terraform.disable_shared_plugins"]
|
37
|
+
home_dir = OS.windows? ? File.join("~", "Application Data") : "~"
|
38
|
+
shared_plugins_dir = File.expand_path(File.join(home_dir,".terraform.d", "plugins"))
|
39
|
+
logger.debug("Updating shared terraform plugins dir: #{shared_plugins_dir}")
|
40
|
+
mkdir_p(shared_plugins_dir)
|
41
|
+
terraform_plugins_dir = File.join(Atmos.config.tf_working_dir,'recipes', '.terraform', 'plugins')
|
42
|
+
if File.exist?(terraform_plugins_dir)
|
43
|
+
cp_r("#{terraform_plugins_dir}/.", shared_plugins_dir)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
20
48
|
def execute
|
21
49
|
|
22
50
|
unless Atmos.config.is_atmos_repo?
|
@@ -28,8 +56,11 @@ module SimplyGenius
|
|
28
56
|
|
29
57
|
Atmos.config.provider.auth_manager.authenticate(ENV) do |auth_env|
|
30
58
|
begin
|
31
|
-
exe = TerraformExecutor.new(process_env: auth_env)
|
32
59
|
get_modules = @terraform_arguments.delete("--get-modules")
|
60
|
+
|
61
|
+
init_automatically(auth_env, get_modules)
|
62
|
+
|
63
|
+
exe = TerraformExecutor.new(process_env: auth_env)
|
33
64
|
exe.run(*@terraform_arguments, get_modules: get_modules.present?)
|
34
65
|
rescue TerraformExecutor::ProcessFailed => e
|
35
66
|
logger.error(e.message)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplygenius-atmos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Conway
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-02-
|
11
|
+
date: 2020-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|