terrafying-components 1.8.2 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 84fe1be5772c600fc5cf95dc2aae831fc51572aebdc345ee229c72155b36fdf6
4
- data.tar.gz: ba036a6d318acbfb6b6a5cd366ee61e1e327098591e10df014b8f18c15432c7f
3
+ metadata.gz: '08a95565a526f4e5d5a331389ca7ef561a18a152019ea348d8d6a785e88da46e'
4
+ data.tar.gz: b27f3550689d39722e6e1c16704b72e62e65a66077ab42f64a39e955e24a0ed6
5
5
  SHA512:
6
- metadata.gz: 2e4d838f52361dccf5c6e41f742083cf36b4f3b0589feb6820bf764f2a12571b953545d6c43bab387e61c33bd659e2113dc578e23b0700dad19d76701594ca4a
7
- data.tar.gz: 2cdf632aaf54f93d1d60b46518fe092e81a4aaec076df1ee6933790312bec6a28dba1423d6ade1276ce2dd7920464112f1817494dc32cb4f9968965c75a4c75b
6
+ metadata.gz: 8f2261b8735c540fae6963fea825c6d1997ec34cd7173224feb9f13af5e25ccb4b11619ec8f3bd230c45da567c986cd8bbbfcd55eba70e844f08b69565d3b396
7
+ data.tar.gz: 2069b0d8198803f7a4b010d67f391372d6b303031b00cba90664467ba08ca18015a0c44c7a75bf1541faa035284faccb72fc841d8b48af3eaf80bc97f280c5d0
@@ -63,12 +63,14 @@ module Terrafying
63
63
  ports: [],
64
64
  public: false,
65
65
  subnets: vpc.subnets.fetch(:private, []),
66
- tags: {
67
- Name: name
68
- },
69
- hex_ident: false
66
+ hex_ident: false,
67
+ tags: {}
70
68
  }.merge(options)
71
69
 
70
+ @tags = {
71
+ Name: name
72
+ }.merge(options[:tags])
73
+
72
74
  @hex_ident = options[:hex_ident]
73
75
  @ports = enrich_ports(options[:ports])
74
76
 
@@ -87,7 +89,7 @@ module Terrafying
87
89
  @security_group = resource :aws_security_group, ident, {
88
90
  name: "loadbalancer-#{ident}",
89
91
  description: "Describe the ingress and egress of the load balancer #{ident}",
90
- tags: options[:tags].merge(
92
+ tags: @tags.merge(
91
93
  {
92
94
  loadbalancer_name: ident,
93
95
  }
@@ -102,7 +104,7 @@ module Terrafying
102
104
  name: ident,
103
105
  load_balancer_type: type,
104
106
  internal: !options[:public],
105
- tags: options[:tags],
107
+ tags: @tags,
106
108
  }.merge(subnets_for(options[:subnets]))
107
109
  .merge(application? ? { security_groups: [@security_group] } : {})
108
110
 
@@ -118,13 +120,7 @@ module Terrafying
118
120
  vpc_id: vpc.id,
119
121
  }.merge(port.has_key?(:health_check) ? { health_check: port[:health_check] }: {})
120
122
 
121
- ssl_options = {}
122
- if port.has_key?(:ssl_certificate)
123
- ssl_options = {
124
- ssl_policy: "ELBSecurityPolicy-2015-05",
125
- certificate_arn: port[:ssl_certificate],
126
- }
127
- end
123
+ ssl_options = alb_certs(port, port_ident)
128
124
 
129
125
  resource :aws_lb_listener, port_ident, {
130
126
  load_balancer_arn: @id,
@@ -148,6 +144,28 @@ module Terrafying
148
144
  self
149
145
  end
150
146
 
147
+ def alb_certs(port, port_ident)
148
+ return {} unless port.key? :ssl_certificate
149
+
150
+ certs = Array(port[:ssl_certificate])
151
+ default_cert = certs.shift
152
+ certs.map { |cert| alb_cert(cert, port_ident) }
153
+
154
+ {
155
+ ssl_policy: 'ELBSecurityPolicy-2016-08',
156
+ certificate_arn: default_cert
157
+ }
158
+ end
159
+
160
+ def alb_cert(cert_arn, port_ident)
161
+ cert_ident = "#{port_ident}-#{Digest::SHA2.hexdigest(cert_arn)[0..8]}"
162
+
163
+ resource :aws_lb_listener_certificate, cert_ident, {
164
+ listener_arn: "${aws_lb_listener.#{port_ident}.arn}",
165
+ certificate_arn: cert_arn
166
+ }
167
+ end
168
+
151
169
  def application?
152
170
  @type == 'application'
153
171
  end
@@ -1,5 +1,5 @@
1
1
  module Terrafying
2
2
  module Components
3
- VERSION = "1.8.2"
3
+ VERSION = "1.9.0"
4
4
  end
5
5
  end
@@ -148,7 +148,7 @@ module Terrafying
148
148
  end
149
149
 
150
150
  Ignition.container_unit(
151
- "openvpn-authz", "quay.io/uswitch/openvpn-authz:stable",
151
+ "openvpn-authz", "quay.io/uswitch/openvpn-authz:1.1",
152
152
  {
153
153
  host_networking: true,
154
154
  volumes: [
@@ -161,6 +161,7 @@ module Terrafying
161
161
  arguments: optional_arguments + [
162
162
  "--fqdn #{@fqdn}",
163
163
  "--cache /var/openvpn-authz",
164
+ '--user-header "X-Forwarded-Email"',
164
165
  "/etc/ssl/openvpn",
165
166
  ],
166
167
  }
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.8.2
4
+ version: 1.9.0
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-10-19 00:00:00.000000000 Z
11
+ date: 2018-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  version: '0'
145
145
  requirements: []
146
146
  rubyforge_project:
147
- rubygems_version: 2.7.7
147
+ rubygems_version: 2.7.8
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: No.