terrafying-components 1.15.4 → 1.15.5
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 +4 -4
- data/lib/terrafying/components/dynamicset.rb +26 -2
- data/lib/terrafying/components/endpoint.rb +2 -1
- data/lib/terrafying/components/ignition.rb +1 -0
- data/lib/terrafying/components/security_group.rb +30 -0
- data/lib/terrafying/components/service.rb +3 -1
- data/lib/terrafying/components/staticset.rb +28 -4
- data/lib/terrafying/components/templates/ignition.yaml +4 -1
- data/lib/terrafying/components/version.rb +1 -1
- data/lib/terrafying/components.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d47e66e01ef3a7fd52fc4c6d43bb4bda04d8095aae9e8c89261a4c41398db523
|
4
|
+
data.tar.gz: 2a78dcc08032da37b592f993dfdce10fe590207fb01e67a833f86b613cda3f2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f19da72ffd9e97c6e7f56bd45b5bcaafd1a9457aa9df57b870f1731ade00569832f44b950145e638036296060312ecdd9dc20d9b934b753fe0676480d8ffce48
|
7
|
+
data.tar.gz: 7eee51612523adcfe49a29c853b9826cd28e9ba772ec24b259777eb8cbd886162ed7770cac4b0946ec377897939acfc724cd26e6a6cf384055687c20bf409fd3
|
@@ -43,7 +43,8 @@ module Terrafying
|
|
43
43
|
ssh_group: vpc.ssh_group,
|
44
44
|
subnets: vpc.subnets.fetch(:private, []),
|
45
45
|
depends_on: [],
|
46
|
-
rolling_update: :simple
|
46
|
+
rolling_update: :simple,
|
47
|
+
vpc_endpoints_egress: []
|
47
48
|
}.merge(options)
|
48
49
|
|
49
50
|
ident = "#{tf_safe(vpc.name)}-#{name}"
|
@@ -57,7 +58,12 @@ module Terrafying
|
|
57
58
|
tags: options[:tags],
|
58
59
|
vpc_id: vpc.id
|
59
60
|
|
60
|
-
|
61
|
+
vpc_endpoints_egress = options[:vpc_endpoints_egress]
|
62
|
+
if vpc_endpoints_egress.empty?
|
63
|
+
default_egress_rule(ident, @security_group)
|
64
|
+
else
|
65
|
+
vpc_endpoint_egress_rules(ident, @security_group, vpc, vpc_endpoints_egress)
|
66
|
+
end
|
61
67
|
|
62
68
|
path_mtu_setup!
|
63
69
|
|
@@ -115,6 +121,24 @@ module Terrafying
|
|
115
121
|
self
|
116
122
|
end
|
117
123
|
|
124
|
+
def vpc_endpoint_egress_rules(ident, security_group, vpc, vpc_endpoints)
|
125
|
+
prefix_ids = vpc_endpoints.map do | e |
|
126
|
+
vpc_endpoint = data :aws_vpc_endpoint, "#{ident}-#{tf_safe(e)}", {
|
127
|
+
vpc_id: vpc.id,
|
128
|
+
service_name: e,
|
129
|
+
}
|
130
|
+
vpc_endpoint[:prefix_list_id]
|
131
|
+
end
|
132
|
+
|
133
|
+
resource :aws_security_group_rule, "#{ident}-vpc-endpoint-egress",
|
134
|
+
security_group_id: security_group,
|
135
|
+
type: 'egress',
|
136
|
+
from_port: 0,
|
137
|
+
to_port: 0,
|
138
|
+
protocol: -1,
|
139
|
+
prefix_list_ids: prefix_ids
|
140
|
+
end
|
141
|
+
|
118
142
|
def default_egress_rule(ident, security_group)
|
119
143
|
resource :aws_security_group_rule, "#{ident}-default-egress",
|
120
144
|
security_group_id: security_group,
|
@@ -25,6 +25,7 @@ module Terrafying
|
|
25
25
|
auto_accept: true,
|
26
26
|
subnets: vpc.subnets.fetch(:private, []),
|
27
27
|
private_dns: false,
|
28
|
+
vpc_endpoint_type: "Interface",
|
28
29
|
tags: {}
|
29
30
|
}.merge(options)
|
30
31
|
|
@@ -73,7 +74,7 @@ module Terrafying
|
|
73
74
|
resource :aws_vpc_endpoint, ident,
|
74
75
|
vpc_id: vpc.id,
|
75
76
|
service_name: service_name,
|
76
|
-
vpc_endpoint_type:
|
77
|
+
vpc_endpoint_type: options[:vpc_endpoint_type],
|
77
78
|
security_group_ids: [@security_group],
|
78
79
|
auto_accept: options[:auto_accept],
|
79
80
|
subnet_ids: options[:subnets].map(&:id),
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'terrafying/components/usable'
|
2
|
+
require 'terrafying'
|
3
|
+
|
4
|
+
module Terrafying
|
5
|
+
module Components
|
6
|
+
class SecurityGroup < Terrafying::Context
|
7
|
+
include Usable
|
8
|
+
def self.create_in(vpc, name, ports:)
|
9
|
+
new.create_in(vpc, name, ports: ports)
|
10
|
+
end
|
11
|
+
|
12
|
+
def create_in(vpc, name, ports:)
|
13
|
+
@name = name
|
14
|
+
@ports = ports
|
15
|
+
@security_group_ref = resource :aws_security_group, tf_safe(name),{
|
16
|
+
|
17
|
+
vpc_id: vpc.id,
|
18
|
+
name: name,
|
19
|
+
tags: {
|
20
|
+
'Name' => name
|
21
|
+
}
|
22
|
+
}
|
23
|
+
@security_group = @security_group_ref[:id]
|
24
|
+
self
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -54,12 +54,14 @@ module Terrafying
|
|
54
54
|
units: [],
|
55
55
|
files: [],
|
56
56
|
tags: {},
|
57
|
+
users: [],
|
57
58
|
ssh_group: vpc.ssh_group,
|
58
59
|
subnets: vpc.subnets.fetch(:private, []),
|
59
60
|
startup_grace_period: 300,
|
60
61
|
depends_on: [],
|
61
62
|
audit_role: "arn:aws:iam::#{aws.account_id}:role/auditd_logging",
|
62
|
-
metrics_ports: []
|
63
|
+
metrics_ports: [],
|
64
|
+
vpc_endpoints_egress: []
|
63
65
|
}.merge(options)
|
64
66
|
|
65
67
|
unless options[:audit_role].nil?
|
@@ -49,7 +49,8 @@ module Terrafying
|
|
49
49
|
tags: {},
|
50
50
|
ssh_group: vpc.ssh_group,
|
51
51
|
depends_on: [],
|
52
|
-
volumes: []
|
52
|
+
volumes: [],
|
53
|
+
vpc_endpoints_egress: []
|
53
54
|
}.merge(options)
|
54
55
|
|
55
56
|
ident = "#{tf_safe(vpc.name)}-#{name}"
|
@@ -62,9 +63,13 @@ module Terrafying
|
|
62
63
|
description: "Describe the ingress and egress of the static set #{ident}",
|
63
64
|
tags: options[:tags],
|
64
65
|
vpc_id: vpc.id
|
65
|
-
|
66
|
-
|
67
|
-
|
66
|
+
|
67
|
+
vpc_endpoints_egress = options[:vpc_endpoints_egress]
|
68
|
+
if vpc_endpoints_egress.empty?
|
69
|
+
default_egress_rule(ident, @security_group)
|
70
|
+
else
|
71
|
+
vpc_endpoint_egress_rules(ident, @security_group, vpc, vpc_endpoints_egress)
|
72
|
+
end
|
68
73
|
path_mtu_setup!
|
69
74
|
|
70
75
|
@instances = options[:instances].map.with_index do |config, i|
|
@@ -114,6 +119,25 @@ module Terrafying
|
|
114
119
|
cidr_blocks: ['0.0.0.0/0']
|
115
120
|
end
|
116
121
|
|
122
|
+
|
123
|
+
def vpc_endpoint_egress_rules(ident, security_group, vpc, vpc_endpoints)
|
124
|
+
prefix_ids = vpc_endpoints.map do | e |
|
125
|
+
vpc_endpoint = data :aws_vpc_endpoint, "#{ident}-#{tf_safe(e)}", {
|
126
|
+
vpc_id: vpc.id,
|
127
|
+
service_name: e,
|
128
|
+
}
|
129
|
+
vpc_endpoint[:prefix_list_id]
|
130
|
+
end
|
131
|
+
|
132
|
+
resource :aws_security_group_rule, "#{ident}-vpc-endpoint-egress",
|
133
|
+
security_group_id: security_group,
|
134
|
+
type: 'egress',
|
135
|
+
from_port: 0,
|
136
|
+
to_port: 0,
|
137
|
+
protocol: -1,
|
138
|
+
prefix_list_ids: prefix_ids
|
139
|
+
end
|
140
|
+
|
117
141
|
def volume_for(name, instance, volume, tags)
|
118
142
|
vol_opts = {
|
119
143
|
availability_zone: instance.subnet.az,
|
@@ -9,7 +9,10 @@ passwd:
|
|
9
9
|
sshAuthorizedKeys:
|
10
10
|
- "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDlIRM5H4lz/t8PfiGptR8cWqVrD8NCwROZly1XuYooWiIdTinJAvkATdR54ic6YuNenoKOeqtTj0dkytbzi5xItBti6cqzHvFAOXhKzVCsR5n/Mdt2KPbp215pFS96yfsx/24Z4cGygXe24SEXv28KdWZ1nWQyUrlne9jMaB7n3cGzNaXOPy42l03/bAaflWoyD7gyyS9XHDuZkLxVrhtlO43UtIXL4IZzKTCy1cZdaabZxRsrSzHUp+/5p3fHYgcYmwyO0Y+W3TP6LRC2ebeQe0r4Rh1o83sRvcbmuG14Wk7wDVFtu0vjtwOflCsRHGRibep/rXvtqf1/bG3brQ9tAV3oIeZ4r4yPUZenwIfM2pQH3ElD3kqw+Pdh1la1QXb4FDxeEw29nLU1eQF6ggnp3gzJJDRQWRB/I2RjKje5M1NcKjn+8ZBG1PHBikaOkjMRkXzOb8JQxKcWmeuRHo/ZTh7oUDDMObAVej9K91eCP3Dtz5QqmL1+J4+7YCjoBOBPpX3J+mrkxHRHcJYEIyJF6/mNDtov09Vji7Rdd0j1A5CJ2fvcuuUGK0LUHMSEyzLKg830E8b/kIZrufWEsljqlcHrYCJAO/LYl77PFe6B/vNfZtyw4fI6juGDlZNYWYXLJ2c+poCS8+2o1KjCli1lV2BOAjDUKEJxQ9NAw6MxPQ== tom.booth@uswitch.com"
|
11
11
|
groups: ["sudo", "docker"]
|
12
|
-
|
12
|
+
<% users.each do |user| %>
|
13
|
+
- name: "<%= user[:name] %>"
|
14
|
+
sshAuthorizedKeys: <%= Array(user[:sshkeys]) %>
|
15
|
+
<% end %>
|
13
16
|
systemd:
|
14
17
|
units:
|
15
18
|
<% if disable_update_engine %>
|
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.15.
|
4
|
+
version: 1.15.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- uSwitch Limited
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- lib/terrafying/components/security/store.rb
|
110
110
|
- lib/terrafying/components/security/trail.rb
|
111
111
|
- lib/terrafying/components/security/vpc.rb
|
112
|
+
- lib/terrafying/components/security_group.rb
|
112
113
|
- lib/terrafying/components/selfsignedca.rb
|
113
114
|
- lib/terrafying/components/service.rb
|
114
115
|
- lib/terrafying/components/staticset.rb
|