terrafying-components 1.7.3 → 1.7.4
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6bf81aeec939ed88efa3a15c1162746ef3916811afb15e0386b45de7f7e6d0a4
|
4
|
+
data.tar.gz: 696e19c11302bb6960d7ac1a3c530e0819bc82e55cd018e10c3fed0fdbf040c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 908ef1feb036a944fe1746e21448c6174d3fb1419226cf5d363e2d5c348412bbd087ef2742f9c785291e895faacebc0507735f76fff16bdc6faeb71f0d5f9bf6
|
7
|
+
data.tar.gz: 6ebfcbf532446269277583d353dbe58ad15c58c4618d06ecf90dda35a73d913cbf591344236ad8ac7a2d12e3eb1a1112265ea4c68217508b153d7ee8ec7e4162
|
@@ -10,7 +10,7 @@ module Terrafying
|
|
10
10
|
|
11
11
|
class Endpoint < Terrafying::Context
|
12
12
|
|
13
|
-
attr_reader :security_group
|
13
|
+
attr_reader :fqdn, :security_group
|
14
14
|
|
15
15
|
include Usable
|
16
16
|
|
@@ -27,7 +27,6 @@ module Terrafying
|
|
27
27
|
auto_accept: true,
|
28
28
|
subnets: vpc.subnets.fetch(:private, []),
|
29
29
|
private_dns: false,
|
30
|
-
dns_name: name,
|
31
30
|
tags: {},
|
32
31
|
}.merge(options)
|
33
32
|
|
@@ -84,7 +83,21 @@ module Terrafying
|
|
84
83
|
private_dns_enabled: options[:private_dns],
|
85
84
|
}
|
86
85
|
|
87
|
-
|
86
|
+
@fqdn = output_of(:aws_vpc_endpoint, ident, "dns_entry.0.dns_name")
|
87
|
+
|
88
|
+
if options[:service]
|
89
|
+
endpoint_service = options[:service]
|
90
|
+
|
91
|
+
record_name = endpoint_service.fqdn.gsub(/.#{endpoint_service.zone.fqdn}$/, "")
|
92
|
+
|
93
|
+
private_zone = add! Zone.create(endpoint_service.zone.fqdn, vpc: vpc)
|
94
|
+
private_zone.add_record(
|
95
|
+
record_name, [@fqdn], type: "CNAME",
|
96
|
+
resource_name: tf_safe("#{@name}-#{endpoint_service.fqdn}"),
|
97
|
+
)
|
98
|
+
else
|
99
|
+
|
100
|
+
end
|
88
101
|
|
89
102
|
self
|
90
103
|
end
|
@@ -7,7 +7,7 @@ module Terrafying
|
|
7
7
|
|
8
8
|
class EndpointService < Terrafying::Context
|
9
9
|
|
10
|
-
attr_reader :name, :load_balancer, :service_name
|
10
|
+
attr_reader :name, :load_balancer, :service_name, :fqdn, :zone
|
11
11
|
|
12
12
|
def self.create_for(load_balancer, name, options={})
|
13
13
|
EndpointService.new.create_for(load_balancer, name, options)
|
@@ -40,6 +40,9 @@ module Terrafying
|
|
40
40
|
@name = name
|
41
41
|
@load_balancer = load_balancer
|
42
42
|
|
43
|
+
@fqdn = options[:fqdn]
|
44
|
+
@zone = options[:zone]
|
45
|
+
|
43
46
|
resource :aws_vpc_endpoint_service, name, {
|
44
47
|
acceptance_required: options[:acceptance_required],
|
45
48
|
allowed_principals: options[:allowed_principals],
|
@@ -20,7 +20,7 @@ module Terrafying
|
|
20
20
|
|
21
21
|
class Service < Terrafying::Context
|
22
22
|
|
23
|
-
attr_reader :name, :domain_names, :ports, :instance_profile, :load_balancer, :instance_set
|
23
|
+
attr_reader :name, :zone, :domain_names, :ports, :instance_profile, :load_balancer, :instance_set
|
24
24
|
|
25
25
|
include Usable
|
26
26
|
|
@@ -81,6 +81,7 @@ module Terrafying
|
|
81
81
|
ident = "#{tf_safe(vpc.name)}-#{name}"
|
82
82
|
|
83
83
|
@name = ident
|
84
|
+
@zone = options[:zone]
|
84
85
|
@ports = enrich_ports(options[:ports])
|
85
86
|
@domain_names = [ options[:zone].qualify(name) ]
|
86
87
|
|
@@ -143,7 +144,10 @@ module Terrafying
|
|
143
144
|
end
|
144
145
|
|
145
146
|
def with_endpoint_service(options = {})
|
146
|
-
add! EndpointService.create_for(@load_balancer, @name,
|
147
|
+
add! EndpointService.create_for(@load_balancer, @name, {
|
148
|
+
fqdn: @domain_names[0],
|
149
|
+
zone: @zone,
|
150
|
+
}.merge(options))
|
147
151
|
end
|
148
152
|
|
149
153
|
end
|
@@ -49,11 +49,19 @@ module Terrafying
|
|
49
49
|
|
50
50
|
ident = tf_safe(fqdn)
|
51
51
|
|
52
|
+
zone_config = {
|
53
|
+
name: fqdn,
|
54
|
+
tags: options[:tags],
|
55
|
+
}
|
56
|
+
|
57
|
+
if options[:vpc]
|
58
|
+
zone_config[:vpc_id] = options[:vpc].id
|
59
|
+
|
60
|
+
ident = tf_safe("#{options[:vpc].id}-#{ident}")
|
61
|
+
end
|
62
|
+
|
52
63
|
@fqdn = fqdn
|
53
|
-
@id = resource :aws_route53_zone, ident,
|
54
|
-
name: fqdn,
|
55
|
-
tags: options[:tags],
|
56
|
-
}
|
64
|
+
@id = resource :aws_route53_zone, ident, zone_config
|
57
65
|
|
58
66
|
if options[:parent_zone]
|
59
67
|
ns = (0..3).map{ |i| output_of(:aws_route53_zone, ident, "name_servers.#{i}") }
|
@@ -81,10 +89,10 @@ module Terrafying
|
|
81
89
|
name: qualify(name),
|
82
90
|
}.merge(options)
|
83
91
|
|
84
|
-
ctx.resource :aws_route53_record, tf_safe(options[:name]), {
|
92
|
+
ctx.resource :aws_route53_record, options[:resource_name] || tf_safe(options[:name]), {
|
85
93
|
zone_id: @id,
|
86
94
|
records: records,
|
87
|
-
}.merge(options)
|
95
|
+
}.merge(options.slice(:type, :ttl, :name, :records, :zone_id, :weight))
|
88
96
|
end
|
89
97
|
|
90
98
|
def add_alias(name, config)
|
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.
|
4
|
+
version: 1.7.4
|
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-08-
|
11
|
+
date: 2018-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|