rubycfn 0.4.10 → 0.5.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 +4 -4
- data/CHANGELOG.md +6 -1
- data/Gemfile.lock +1 -1
- data/README.md +43 -67
- data/bin/rubycfn +17 -73
- data/lib/cli_methods.rb +2 -2
- data/lib/rubycfn/version.rb +1 -1
- data/templates/.env +2 -0
- data/templates/.env.acceptance +1 -0
- data/templates/.env.dependencies.rspec +6 -0
- data/templates/.env.development +1 -0
- data/templates/.env.production +1 -0
- data/templates/.env.rspec +1 -0
- data/templates/.env.test +1 -0
- data/templates/{.gitignore.erb → .gitignore} +3 -0
- data/templates/{.rubocop.yml.erb → .rubocop.yml} +14 -1
- data/templates/{Gemfile.erb → Gemfile} +0 -1
- data/templates/README.md +57 -0
- data/templates/{Rakefile.erb → Rakefile} +15 -8
- data/templates/bootstrap/dependency_stack.rb +49 -0
- data/templates/config.yaml +65 -0
- data/templates/lib/aws_helper/aws_sdk.rb +30 -0
- data/templates/{compiler.rb.erb → lib/aws_helper/compiler.rb} +15 -9
- data/templates/{dependencies.rb.erb → lib/aws_helper/dependencies.rb} +5 -3
- data/templates/{deploy.rb.erb → lib/aws_helper/deploy.rb} +6 -4
- data/templates/lib/aws_helper/helpers.rb +3 -0
- data/templates/{main_aws_helper.rb.erb → lib/aws_helper/main.rb} +0 -0
- data/templates/{upload_stack.rb.erb → lib/aws_helper/upload_stack.rb} +15 -6
- data/templates/lib/core/applications.rb +479 -0
- data/templates/lib/core/assume_role.rb +40 -0
- data/templates/lib/core/classes.rb +25 -0
- data/templates/{core_compile.rb.erb → lib/core/compile.rb} +1 -0
- data/templates/lib/core/dependencies.rb +22 -0
- data/templates/{core_deploy.rb.erb → lib/core/deploy.rb} +20 -10
- data/templates/lib/core/git.rb +15 -0
- data/templates/lib/core/init.rb +173 -0
- data/templates/{core_upload.rb.erb → lib/core/upload.rb} +0 -0
- data/templates/{main.rb.erb → lib/main.rb} +8 -6
- data/templates/lib/shared_concerns/global_variables.rb +56 -0
- data/templates/{helper_methods.rb.erb → lib/shared_concerns/helper_functions.rb} +0 -0
- data/templates/lib/shared_concerns/helper_methods.rb +3 -0
- data/templates/{shared_methods.rb.erb → lib/shared_concerns/shared_methods.rb} +9 -0
- data/templates/lib/stacks/acm_stack/certificate_manager.rb +79 -0
- data/templates/{new_stack.rb.erb → lib/stacks/acm_stack/main.rb} +3 -4
- data/templates/lib/stacks/ecs_stack/ecs_cluster.rb +344 -0
- data/templates/lib/stacks/ecs_stack/lifecycle_hook.rb +188 -0
- data/templates/lib/stacks/ecs_stack/load_balancer.rb +68 -0
- data/templates/{ecs_stack.rb.erb → lib/stacks/ecs_stack/main.rb} +2 -1
- data/templates/{project_stack.rb.erb → lib/stacks/parent_stack/main.rb} +2 -2
- data/templates/lib/stacks/parent_stack/parent.rb +18 -0
- data/templates/lib/stacks/vpc_stack/infra_vpc.rb +193 -0
- data/templates/{vpc_stack.rb.erb → lib/stacks/vpc_stack/main.rb} +1 -2
- data/templates/{parent_stack_spec.rb.erb → spec/lib/parent_spec.rb} +2 -5
- data/templates/{spec_helper.rb.erb → spec/spec_helper.rb} +2 -2
- metadata +54 -44
- data/format.vim +0 -3
- data/templates/.env.erb +0 -4
- data/templates/.env.production.erb +0 -6
- data/templates/.env.rspec.erb +0 -6
- data/templates/.env.test.erb +0 -6
- data/templates/.gitlab-ci.yml.erb +0 -75
- data/templates/aws_sdk.rb.erb +0 -18
- data/templates/core_diff.rb.erb +0 -59
- data/templates/ecs_stack_concern.rb.erb +0 -20
- data/templates/global_variables.rb.erb +0 -16
- data/templates/helpers.rb.erb +0 -7
- data/templates/new_concern.rb.erb +0 -10
- data/templates/project_concern.rb.erb +0 -26
- data/templates/subnets.rb.erb +0 -18
- data/templates/vpc_concerns.rb.erb +0 -87
- data/templates/vpc_spec.rb.erb +0 -39
@@ -1,87 +0,0 @@
|
|
1
|
-
require_relative "subnets"
|
2
|
-
|
3
|
-
module VpcStack
|
4
|
-
module Main
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
|
7
|
-
included do
|
8
|
-
variable :cidr_block,
|
9
|
-
default: "10.0.0.0/16",
|
10
|
-
value: ENV["VPC_CIDR_BLOCK"]
|
11
|
-
|
12
|
-
resource :<%= name.downcase %>_vpc,
|
13
|
-
type: "AWS::EC2::VPC" do |r|
|
14
|
-
r.property(:cidr_block) { cidr_block }
|
15
|
-
r.property(:enable_dns_support) { true }
|
16
|
-
r.property(:enable_dns_hostnames) { true }
|
17
|
-
end
|
18
|
-
|
19
|
-
resource "<%= name.downcase %>_internet_gateway".cfnize,
|
20
|
-
type: "AWS::EC2::InternetGateway"
|
21
|
-
|
22
|
-
resource "<%= name.downcase %>_route".cfnize,
|
23
|
-
type: "AWS::EC2::Route" do |r|
|
24
|
-
r.property(:destination_cidr_block) { "0.0.0.0/0" }
|
25
|
-
r.property(:gateway_id) { "<%= name.downcase %>_internet_gateway".cfnize.ref }
|
26
|
-
r.property(:route_table_id) { "<%= name.downcase %>_route_table".cfnize.ref }
|
27
|
-
end
|
28
|
-
|
29
|
-
resource "<%= name.downcase %>_route_table".cfnize,
|
30
|
-
type: "AWS::EC2::RouteTable" do |r|
|
31
|
-
r.property(:vpc_id) { "<%= name.downcase %>_vpc".cfnize.ref }
|
32
|
-
end
|
33
|
-
|
34
|
-
resource "<%= name.downcase %>_vpc_gateway_attachment".cfnize,
|
35
|
-
type: "AWS::EC2::VPCGatewayAttachment" do |r|
|
36
|
-
r.property(:internet_gateway_id) { "<%= name.downcase %>_internet_gateway".cfnize.ref }
|
37
|
-
r.property(:vpc_id) { "<%= name.downcase %>_vpc".cfnize.ref }
|
38
|
-
end
|
39
|
-
|
40
|
-
vpc_subnets.each_with_index do |subnet, _subnet_count|
|
41
|
-
subnet.each do |subnet_name, arguments|
|
42
|
-
resource "<%= name.downcase %>_#{subnet_name}_subnet".cfnize,
|
43
|
-
type: "AWS::EC2::Subnet",
|
44
|
-
amount: 3 do |r, index|
|
45
|
-
r.property(:availability_zone) do
|
46
|
-
{
|
47
|
-
"Fn::GetAZs": ""
|
48
|
-
}.fnselect(index)
|
49
|
-
end
|
50
|
-
r.property(:cidr_block) do
|
51
|
-
[
|
52
|
-
"<%= name %>Vpc".ref("CidrBlock"),
|
53
|
-
(3 * arguments[:offset]).to_s,
|
54
|
-
(Math.log(256) / Math.log(2)).floor.to_s
|
55
|
-
].fncidr.fnselect(index + (3 * arguments[:offset]) - 3)
|
56
|
-
end
|
57
|
-
r.property(:map_public_ip_on_launch) { arguments[:public] }
|
58
|
-
r.property(:tags) do
|
59
|
-
[
|
60
|
-
{
|
61
|
-
"Key": "owner",
|
62
|
-
"Value": arguments[:owner].to_s.cfnize
|
63
|
-
},
|
64
|
-
{
|
65
|
-
"Key": "resource_type",
|
66
|
-
"Value": subnet_name.to_s.cfnize
|
67
|
-
}
|
68
|
-
]
|
69
|
-
end
|
70
|
-
r.property(:vpc_id) { "<%= name %>Vpc".ref }
|
71
|
-
end
|
72
|
-
|
73
|
-
# Generate outputs for these subnets
|
74
|
-
3.times do |i|
|
75
|
-
output "#{subnet_name}_subnet#{i.positive? ? (i + 1) : ""}_name".cfnize,
|
76
|
-
value: "<%= name.downcase %>_#{subnet_name}_subnet#{i.positive? ? (i + 1) : ""}".cfnize.ref
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
output :vpc_cidr,
|
82
|
-
value: "<%= name %>Vpc".ref("CidrBlock")
|
83
|
-
output :<%= name.downcase %>_vpc,
|
84
|
-
value: "<%= name %>Vpc".ref
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
data/templates/vpc_spec.rb.erb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
require "rubycfn"
|
2
|
-
require_relative "../spec_helper"
|
3
|
-
require "active_support/concern"
|
4
|
-
|
5
|
-
require_relative "../../lib/main.rb"
|
6
|
-
|
7
|
-
module VpcSpec
|
8
|
-
extend ActiveSupport::Concern
|
9
|
-
include Rubycfn
|
10
|
-
|
11
|
-
included do
|
12
|
-
description "VPC Stack RSpec"
|
13
|
-
include Concerns::GlobalVariables
|
14
|
-
include Concerns::SharedMethods
|
15
|
-
include VpcStack::Main
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
VpcSpecCfn = include VpcSpec
|
20
|
-
|
21
|
-
describe VpcSpec do
|
22
|
-
RspecVpcSpec = VpcSpecCfn.render_template
|
23
|
-
let(:template) { JSON.parse(RspecVpcSpec) }
|
24
|
-
|
25
|
-
context "Renders template" do
|
26
|
-
subject { template }
|
27
|
-
it { should have_key "Resources" }
|
28
|
-
|
29
|
-
context "Has Required Resources" do
|
30
|
-
let(:resources) { template["Resources"] }
|
31
|
-
subject { resources }
|
32
|
-
it { should have_key "<%= name %>InternetGateway" }
|
33
|
-
it { should have_key "<%= name %>Route" }
|
34
|
-
it { should have_key "<%= name %>RouteTable" }
|
35
|
-
it { should have_key "<%= name %>Vpc" }
|
36
|
-
it { should have_key "<%= name %>VpcGatewayAttachment" }
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|