aws-rds 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b9fe826eb909d7aacfaa749ce2dda50fa78f661ca0118f98382dafe89a0719d6
4
- data.tar.gz: 27fc99982138438e710edeb13667615f9899a88d01bb8bb4711ae9b1160b02e7
3
+ metadata.gz: 209e982feec0bfdb302cfcf95a81deaf839bbfbeb93743654d7144dbc855ecbe
4
+ data.tar.gz: 0f15891092ddaf3f9349cb470bf8ef87ab2012963f9a59afd519a278046331ab
5
5
  SHA512:
6
- metadata.gz: 84503f0be3e434f230b6c960d9ede2f29907555cc7493c8f7bc0373f56c362f5c764a2de0b250c6356b0625c960e3c385cf79ab1449afbfaf2f8e0c18653679b
7
- data.tar.gz: 67dc8e464180f8acd84887ba59b4eed66c39a67f22ee3352b4cdfcdbcb1bce6619d89977fb188e05e9f771acc82e06bec0caa298f922e121a77df12cda71d4b5
6
+ metadata.gz: e0fe672de8e1660cfabcc43e053739f0fc8df4b10f3d10802c99651d738611f308871c4eed717931d052cbd83108e27a3f6fb1353d504672b8572dba8da2df71
7
+ data.tar.gz: 7f067c4b6f1de6fa0aaf681f36cf7b82789864a6f4ca213002183dd4005904860d2be1388ab972853580da4ab0179b580e120089f46a68fb25d146bcb1073133
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
5
5
 
6
+ ## [0.6.0]
7
+ - security-group-name option takes the highest precedence, over the the profile vpc_security_group_ids setting
8
+ - improve error messaging
9
+
6
10
  ## [0.5.0]
7
11
  - change config/env.yml option name to: fallback vpc_id and db_subnet_group_name
8
12
 
@@ -6,5 +6,5 @@ master_username: changeme
6
6
  engine: postgres
7
7
  vpc_security_group_ids: <%= config["vpc_security_group_ids"].inspect %>
8
8
  # db_name: mydb # can be overridden at the cli
9
- # vpc_security_group_ids: # can be also automatically set by specifying --security-group-name at the CLI
9
+ # vpc_security_group_ids: # can be also automatically created and set by specifying --security-group-name at the CLI
10
10
  # db_instance_identifier: not respected here. always set from the cli
@@ -22,21 +22,36 @@ class AwsRds::Create
22
22
  params
23
23
  end
24
24
 
25
+ # Explanation of different security groups:
26
+ #
27
+ # db_security_groups: classic RDS db security groups, separtae groups from
28
+ # from ec2 security groups.
29
+ # vpc_security_group_ids: vpc security groups. same groups as what the ec2
30
+ # security groups use.
31
+ #
32
+ # db_security_groups is not really recommended anymore because it is the
33
+ # EC2-classic network.
25
34
  def set_security_groups(params)
26
35
  return params if @options[:noop]
27
- # dont create SG if user has set one
28
- # db_security_groups: classic RDS db security groups, separtae groups from
29
- # from ec2 security groups.
30
- # vpc_security_group_ids: vpc security groups. same groups as what the ec2
31
- # security groups use.
32
- # db_security_groups is not really recommended anymore because it is the
33
- # EC2-classic network.
34
- return params if params['vpc_security_group_ids'] || params['db_security_groups']
35
36
 
36
- security_group_name = @options[:security_group_name] || @options[:name]
37
- sg = AwsRds::SecurityGroup.find_or_create(security_group_name)
38
- params['vpc_security_group_ids'] ||= [sg.group_id]
39
- params
37
+ if @options[:security_group_name]
38
+ security_group_name = @options[:security_group_name]
39
+ sg = AwsRds::SecurityGroup.find_or_create(security_group_name)
40
+ params['vpc_security_group_ids'] ||= [sg.group_id]
41
+ params
42
+ elsif params['vpc_security_group_ids'] || params['db_security_groups']
43
+ # security group already set in profile, do nothing
44
+ params
45
+ else
46
+ puts "ERROR: A security group was not specified.".colorize(:red)
47
+ puts <<-EOL
48
+ You can either specify the vpc_security_group_ids variable in the profile you can use the --security-group-name cli option.
49
+
50
+ If you use the --security-group-name option, then aws-rds will use the existing security group or create a new one if necessary.
51
+
52
+ EOL
53
+ exit 1
54
+ end
40
55
  end
41
56
 
42
57
  def set_db_subnet_group(params)
@@ -47,7 +62,7 @@ class AwsRds::Create
47
62
  def fallback_db_subnet_group_name
48
63
  AwsRds.config["fallback"]["db_subnet_group_name"]
49
64
  rescue NoMethodError => e
50
- puts e.message
65
+ puts "ERROR: a db_subnet_group_name was not specified.".colorize(:red)
51
66
  puts <<-EOL
52
67
  No db_subnet_group_name was specified in your profile. Also, a fallback db subnet group name was set.
53
68
 
@@ -12,7 +12,7 @@ module AwsRds
12
12
  sg = resp.security_groups.first
13
13
  return sg if sg
14
14
 
15
- puts "Creating security group #{name}"
15
+ puts "Creating security group #{name}".colorize(:green)
16
16
  result = ec2.create_security_group(
17
17
  group_name: name,
18
18
  description: name,
@@ -30,12 +30,13 @@ module AwsRds
30
30
  def fallback_vpc_id
31
31
  AwsRds.config["fallback"]["vpc_id"]
32
32
  rescue NoMethodError => e
33
- puts e.message
33
+ puts "ERROR: a vpc_id was not specified.".colorize(:red)
34
34
  puts <<-EOL
35
- Unable to load a fallback vpc id from your config/#{AwsRds.env}.yml.
36
- Please specify a fallback vpc_id setting.
35
+ No vpc_id was specified in your profile. Also, a fallback vpc_id was set.
37
36
 
38
- Example config/#{AwsRds.env}.yml:
37
+ Please add a vpc_id in your profile file or add a fallback vpc_id to your config/#{AwsRds.env}.yml.
38
+
39
+ To specify a fallback vpc_id setting. Example config/#{AwsRds.env}.yml:
39
40
  ---
40
41
  fallback:
41
42
  vpc_id: vpc-123
@@ -1,3 +1,3 @@
1
1
  module AwsRds
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-rds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen