terrafying-components 1.7.2 → 1.7.3

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: 83a5aa96d0e23191e7a6f9815a1293535b8ceb71af791129ba2b4999b08f61b8
4
- data.tar.gz: 114fc47ebc900ac85a5384b9d03fe9a5bc098171ffb06c1af13066b4a45e64ea
3
+ metadata.gz: 4a9bc69b9f076bd59fa7922ff83f0c59e472e570ba28b40dd29631e7d8378a90
4
+ data.tar.gz: 0c8c6f2131804dfb187d63d3db89d9b21d2f4c14f213ee9e42e88683eede6016
5
5
  SHA512:
6
- metadata.gz: 3a9d6dce3183b75251eb8430cb4ea53aaf4734b50bee76ef42626b25995be72114a4393ee5a87b44c5b118ef9d14d6a1e7542ff3d169b740b1851692b8540600
7
- data.tar.gz: 31756d5d7359054c017e17d772f5e9fd0cafbd720c4735a43b28842c3f64bb4025d47004338e2e15809db99931c4db20cb125e811f3f762338d98f1c065986d6
6
+ metadata.gz: 06fac52650040faef41a28e93a497ff9c8faf7aef38e83fa0eea0e79b943b8cb1597fccdcc6d1c71d9959aba5e623a5ecfda48c9d3cf88ebe1c13a9d6265c3db
7
+ data.tar.gz: 5bd0f0c64239f5173cb69410ca84fafd1d9b3b11069a4e097434ab433543d3bd98156c5f79a615bf8254a127ca9bae484c9c5486483235405151d949a5bba3ee
@@ -15,6 +15,10 @@ module Terrafying
15
15
  ref = {
16
16
  name: name,
17
17
  ca: self,
18
+ path: {
19
+ cert: File.join("/etc/ssl", @name, name, "cert"),
20
+ key: File.join("/etc/ssl", @name, name, "key"),
21
+ },
18
22
  source: {
19
23
  cert: File.join("s3://", @bucket, @prefix, @name, name, "cert"),
20
24
  key: File.join("s3://", @bucket, @prefix, @name, name, "key"),
@@ -5,7 +5,7 @@ module Terrafying
5
5
 
6
6
  class InstanceProfile < Terrafying::Context
7
7
 
8
- attr_reader :id
8
+ attr_reader :id, :role_arn, :role_resource
9
9
 
10
10
  def self.create(name, options={})
11
11
  InstanceProfile.new.create name, options
@@ -74,6 +74,9 @@ module Terrafying
74
74
  role: output_of(:aws_iam_role, name, :name),
75
75
  }
76
76
 
77
+ @role_arn = output_of(:aws_iam_role, name, :arn)
78
+ @role_resource = "aws_iam_role.#{name}"
79
+
77
80
  self
78
81
  end
79
82
  end
@@ -98,7 +98,6 @@ module Terrafying
98
98
  name: ident,
99
99
  load_balancer_type: type,
100
100
  internal: !options[:public],
101
- subnets: options[:subnets].map(&:id),
102
101
  subnet_mapping: options[:subnets].map{ |subnet|
103
102
  {subnet_id: subnet.id}
104
103
  },
@@ -86,6 +86,10 @@ module Terrafying
86
86
 
87
87
  {
88
88
  ca: self,
89
+ path: {
90
+ cert: File.join("/etc/ssl", @name, "ca.cert"),
91
+ key: File.join("/etc/ssl", @name, "ca.key"),
92
+ },
89
93
  source: {
90
94
  cert: File.join("s3://", @bucket, @prefix, @name, "ca.cert"),
91
95
  key: File.join("s3://", @bucket, @prefix, @name, "ca.key"),
@@ -20,7 +20,7 @@ module Terrafying
20
20
 
21
21
  class Service < Terrafying::Context
22
22
 
23
- attr_reader :name, :domain_names, :ports, :load_balancer, :instance_set
23
+ attr_reader :name, :domain_names, :ports, :instance_profile, :load_balancer, :instance_set
24
24
 
25
25
  include Usable
26
26
 
@@ -87,16 +87,21 @@ module Terrafying
87
87
  depends_on = options[:depends_on] + options[:keypairs].map{ |kp| kp[:resources] }.flatten
88
88
 
89
89
  iam_statements = options[:iam_policy_statements] + options[:keypairs].map { |kp| kp[:iam_statement] }
90
- instance_profile = add! InstanceProfile.create(ident, { statements: iam_statements })
90
+ @instance_profile = add! InstanceProfile.create(ident, { statements: iam_statements })
91
91
 
92
92
  tags = options[:tags].merge({ service_name: name })
93
93
 
94
94
  set = options[:instances].is_a?(Hash) ? DynamicSet : StaticSet
95
95
 
96
- wants_load_balancer = (set == DynamicSet && @ports.count > 0) || options[:loadbalancer]
96
+ if options.has_key?(:loadbalancer) # explicitly requested or rejected a loadbalancer
97
+ wants_load_balancer = options[:loadbalancer]
98
+ else
99
+ # by default we want one if we are an ASG with exposed ports
100
+ wants_load_balancer = set == DynamicSet && @ports.count > 0
101
+ end
97
102
 
98
103
  instance_set_options = {
99
- instance_profile: instance_profile,
104
+ instance_profile: @instance_profile,
100
105
  depends_on: depends_on,
101
106
  tags: tags,
102
107
  }
@@ -83,14 +83,14 @@ storage:
83
83
  <% keypairs.each { |keypair| %>
84
84
  <% if keypair.has_key?(:name) %>
85
85
  - filesystem: "root"
86
- path: "/etc/ssl/<%= keypair[:ca].name %>/<%= keypair[:name] %>/cert"
86
+ path: "<%= keypair[:path][:cert] %>"
87
87
  mode: 0444
88
88
  user: { id: 0 }
89
89
  group: { id: 0 }
90
90
  contents:
91
91
  source: "<%= keypair[:source][:cert] %>"
92
92
  - filesystem: "root"
93
- path: "/etc/ssl/<%= keypair[:ca].name %>/<%= keypair[:name] %>/key"
93
+ path: "<%= keypair[:path][:key] %>"
94
94
  mode: 0444
95
95
  user: { id: 0 }
96
96
  group: { id: 0 }
@@ -98,7 +98,7 @@ storage:
98
98
  source: "<%= keypair[:source][:key] %>"
99
99
  <% else %>
100
100
  - filesystem: "root"
101
- path: "/etc/ssl/<%= keypair[:ca].name %>/ca.key"
101
+ path: "<%= keypair[:path][:key] %>"
102
102
  mode: 0444
103
103
  user: { id: 0 }
104
104
  group: { id: 0 }
@@ -1,5 +1,5 @@
1
1
  module Terrafying
2
2
  module Components
3
- VERSION = "1.7.2"
3
+ VERSION = "1.7.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terrafying-components
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.2
4
+ version: 1.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - uSwitch Limited
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-30 00:00:00.000000000 Z
11
+ date: 2018-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler