awsdsl 0.0.1 → 0.0.2

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
  SHA1:
3
- metadata.gz: ae154e947361276d4545c34fffffbc0eb07caf3e
4
- data.tar.gz: b0a01325a610b74f8d8a9b38bf314a79e9f85324
3
+ metadata.gz: f39a342a2486e3fd3343e1e3cd1a6ae412c621e8
4
+ data.tar.gz: 736e80a97726524a1185e091d04cb76660884fa7
5
5
  SHA512:
6
- metadata.gz: 5537d5bfd37391d089dec9988d5af873d04c4b0a9e5a4ee748684a061a51d4b5e6535b06523d686b0f24a595b5efc85e235b96cded6251e8c1738119a4a0f929
7
- data.tar.gz: eedb01fb25690bd8c417f9dadfc3cd6f7f65ea1088ace302a50bc8538e88d6920724b929151d316a6bd113f73a0b608b8606b877aa9bfe8619f479024873d851
6
+ metadata.gz: 0805eda968d74aba3988fcd39f738601f7ce7fe5a0b5b9efc18648bbe23bb327df9047295a5ba2c663eee330139fb348d5eafb41edf48234a3dfa341f09f990b
7
+ data.tar.gz: 31d374d5e9655dfe00ff2581ad34ea5e32a8d72b888cc52dffa01bd1aa8300e38a177cd7513d4317abba291665325fae79d1410282c5d341b967720208fb7642
data/README.md CHANGED
@@ -14,13 +14,23 @@ Install
14
14
  -------
15
15
 
16
16
  For now I recommending using Bundler to install and manage AWS DSL.
17
- Simply add this to your Gemfile
17
+ Simply add this to your Gemfile to use the development version
18
18
 
19
19
  ```ruby
20
20
  gem 'awsdsl', git: 'https://github.com/josephglanville/awsdsl'
21
21
  ```
22
22
 
23
- I will publish the gem to RubyGems when I feel it's stabilized.
23
+ Or the currently released version (not currently recommended)
24
+
25
+ ```ruby
26
+ gem 'awsdsl', '~> 0.0.1'
27
+ ```
28
+
29
+ However you can also install from RubyGems
30
+
31
+ $ gem install awsdsl
32
+
33
+ When the gem is in-use in production I will push the version to 1.0 and follow Semver from there.
24
34
 
25
35
  Getting Started
26
36
  ---------------
@@ -23,6 +23,7 @@ module AWSDSL
23
23
  AWS.memoize do
24
24
  build_vpcs
25
25
  build_elasticaches
26
+ build_buckets
26
27
  build_roles
27
28
  end
28
29
  @t
@@ -66,6 +67,15 @@ module AWSDSL
66
67
  ToPort: port,
67
68
  CidrIp: '0.0.0.0/0'
68
69
  end
70
+ lb.allows.each do |rule|
71
+ ports = rule[:ports].is_a?(Array) ? rule[:ports] : [rule[:ports]]
72
+ ports.each do |port|
73
+ SecurityGroupIngress IpProtocol: rule[:proto] || 'tcp',
74
+ FromPort: port,
75
+ ToPort: port,
76
+ SourceSecurityGroupId: Ref("#{rule[:role].capitalize}SG")
77
+ end
78
+ end
69
79
  end
70
80
  end
71
81
 
@@ -143,6 +153,7 @@ module AWSDSL
143
153
  # Launch Configuration
144
154
  security_groups = resolve_security_groups(role.vpc, role.security_groups)
145
155
  block_devices = format_block_devices(role.block_devices)
156
+ vars = (stack.vars || {}).merge(role.vars || {})
146
157
  @t.declare do
147
158
  LaunchConfiguration "#{role_name}LaunchConfig" do
148
159
  ImageId role.ami
@@ -154,6 +165,9 @@ module AWSDSL
154
165
  IamInstanceProfile Ref("#{role_name}InstanceProfile")
155
166
  BlockDeviceMappings block_devices
156
167
  KeyName role.key_pair if role.key_pair
168
+ vars.each do |k,v|
169
+ Metadata k.to_s, v
170
+ end
157
171
  end
158
172
  end
159
173
 
@@ -356,5 +370,17 @@ module AWSDSL
356
370
  end
357
371
  end
358
372
  end
373
+
374
+ def build_buckets
375
+ stack = @stack
376
+ stack.buckets.each do |bucket|
377
+ @t.declare do
378
+ Bucket "#{bucket.name.capitalize}Bucket" do
379
+ BucketName bucket.bucket_name if bucket.bucket_name
380
+ AccessControl bucket.access_control if bucket.access_control
381
+ end
382
+ end
383
+ end
384
+ end
359
385
  end
360
386
  end
@@ -0,0 +1,7 @@
1
+ module AWSDSL
2
+ class Bucket
3
+ include DSL
4
+ # TODO(jpg): CORS, Lifecycle config etc.
5
+ attributes :bucket_name, :access_control, :tags
6
+ end
7
+ end
@@ -2,6 +2,6 @@ module AWSDSL
2
2
  class Elasticache
3
3
  include DSL
4
4
  multi_attributes :allow, :subnet
5
- attributes :engine, :node_type, :port, :num_nodes, :vpc
5
+ attributes :engine, :node_type, :port, :num_nodes, :vpc, :tags
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module AWSDSL
2
2
  class LoadBalancer
3
3
  include DSL
4
- multi_attributes :listener, :dns_record, :security_group, :subnet
5
- attributes :health_check, :internal, :connection_settings
4
+ multi_attributes :listener, :dns_record, :security_group, :subnet, :allow
5
+ attributes :health_check, :internal, :connection_settings, :tags
6
6
  end
7
7
  end
@@ -21,6 +21,7 @@ module AWSDSL
21
21
  :vpc,
22
22
  :base_ami,
23
23
  :vars,
24
- :key_pair
24
+ :key_pair,
25
+ :tags
25
26
  end
26
27
  end
@@ -21,7 +21,8 @@ module AWSDSL
21
21
  :vpc,
22
22
  :base_ami,
23
23
  :vars,
24
- :key_pair
24
+ :key_pair,
25
+ :tags
25
26
 
26
27
  def initialize(name, &block)
27
28
  @block = block if block_given?
@@ -1,8 +1,8 @@
1
1
  module AWSDSL
2
2
  class Stack
3
3
  include DSL
4
- attributes :description, :vars
5
- sub_components :role, :role_profile, :elasticache, :vpc
4
+ attributes :description, :vars, :tags
5
+ sub_components :role, :role_profile, :elasticache, :vpc, :bucket
6
6
 
7
7
  def mixin_profiles
8
8
  @roles.each do |role|
@@ -1,7 +1,7 @@
1
1
  module AWSDSL
2
2
  class Subnet
3
3
  include DSL
4
- attributes :igw
4
+ attributes :igw, :tags
5
5
  multi_attributes :az
6
6
  end
7
7
  end
@@ -2,6 +2,6 @@ module AWSDSL
2
2
  class Vpc
3
3
  include DSL
4
4
  sub_components :subnet
5
- attributes :cidr, :dns, :dns_hostnames, :igw, :region, :subnet_bits
5
+ attributes :cidr, :dns, :dns_hostnames, :igw, :region, :subnet_bits, :tags
6
6
  end
7
7
  end
@@ -6,6 +6,7 @@ require 'awsdsl/dsl/load_balancer'
6
6
  require 'awsdsl/dsl/elasticache'
7
7
  require 'awsdsl/dsl/vpc'
8
8
  require 'awsdsl/dsl/subnet'
9
+ require 'awsdsl/dsl/bucket'
9
10
  require 'awsdsl/fn'
10
11
 
11
12
  module AWSDSL
@@ -1,3 +1,3 @@
1
1
  module AWSDSL
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -67,9 +67,11 @@ stack 'logs' do
67
67
  instance_type 't2.micro'
68
68
  block_device name: '/dev/sda1', size: 20
69
69
  chef_provisioner runlist: 'elasticsearch'
70
+ tags Cluster: 'ESCluster'
70
71
  allow role: 'logstash', ports: 9200
71
72
  allow role: 'utility', ports: 9200
72
73
  allow role: 'elasticsearch', ports: 9200
74
+ vars Cluster: 'ESCluster'
73
75
  end
74
76
 
75
77
  role 'utility' do
@@ -97,4 +99,9 @@ stack 'logs' do
97
99
  node_type 't2.micro'
98
100
  allow role: 'logstash'
99
101
  end
102
+
103
+ bucket 'builds' do
104
+ bucket_name 'builds'
105
+ access_control 'Public'
106
+ end
100
107
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awsdsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Glanville
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-27 00:00:00.000000000 Z
11
+ date: 2015-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk
@@ -117,6 +117,7 @@ files:
117
117
  - lib/awsdsl/cfn_helpers.rb
118
118
  - lib/awsdsl/command_line.rb
119
119
  - lib/awsdsl/dsl.rb
120
+ - lib/awsdsl/dsl/bucket.rb
120
121
  - lib/awsdsl/dsl/elasticache.rb
121
122
  - lib/awsdsl/dsl/load_balancer.rb
122
123
  - lib/awsdsl/dsl/role.rb