vagrant-aws-route53 0.2.3

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 22ffe9507256dfda81161aabd23ae9d58e9a6abe
4
+ data.tar.gz: aec41c8ec0ad276bc3f0550b5808c7fdea6e5ef4
5
+ SHA512:
6
+ metadata.gz: 6c1ba5266548112219c96c801f4cfd70e59719df5d1cbe0bb76500ff7c77740114cb9428d839cf888bd9df0cb7204fd932c6297fe003f4238e656d96a5fa73d1
7
+ data.tar.gz: 0e895af5a5039957d7e40ef5d7e6bd970e81222c2956c673f4681430d5a49e5eb419a160eba52e25e963b5f09e73a5c4a84920e3fb6a042bcb173b75ce353691
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 oogatta
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,45 @@
1
+ vagrant-aws-route53
2
+ ===============
3
+
4
+ A Vagrant plugin assigns the IP of the instance which vagrant-aws provider created to a specific Route 53 record set.
5
+
6
+ ### Assigns the IP when
7
+
8
+ * initial ```vagrant up```
9
+ * ```vagrant up``` the halted instance.
10
+
11
+ ### Currently does not
12
+
13
+ * creates another hosted zone or record set.
14
+ * destroys hosted zone or record set.
15
+
16
+ ## Prerequisite
17
+
18
+ * vagrant-aws
19
+
20
+ ## Install
21
+
22
+ ```zsh
23
+ $ vagrant install vagrant-aws-route53
24
+ ```
25
+
26
+ ## Config
27
+
28
+ ```ruby
29
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
30
+ config.vm.box = 'dummy'
31
+ config.ssh.username = 'oogatta'
32
+
33
+ config.vm.provider :aws do |aws, override|
34
+ aws.ami = 'ami'
35
+ aws.access_key_id = 'key_id'
36
+ aws.secret_access_key = 'secret_key'
37
+ aws.region = 'ap-northeast-1'
38
+ aws.instance_type = 't2.medium'
39
+
40
+ override.route53.hosted_zone_id = 'Z1JUXXXXXXXXXX'
41
+ override.route53.record_set = %w(test.oogatta.com. A)
42
+ end
43
+
44
+ end
45
+ ```
@@ -0,0 +1,56 @@
1
+ require 'aws-sdk'
2
+
3
+ module VagrantPlugins
4
+ module AwsRoute53
5
+ module Action
6
+ class SetIp
7
+ def initialize(app, environment)
8
+ @app = app
9
+ end
10
+
11
+ def call(environment)
12
+ config = environment[:machine].config
13
+ provider_config = environment[:machine].provider_config
14
+
15
+ access_key_id = provider_config.access_key_id
16
+ secret_access_key = provider_config.secret_access_key
17
+ region = provider_config.region
18
+ instance_id = environment[:machine].id
19
+ hosted_zone_id = config.route53.hosted_zone_id
20
+ record_set = config.route53.record_set
21
+
22
+ set(
23
+ access_key_id: access_key_id,
24
+ secret_access_key: secret_access_key,
25
+ region: region,
26
+ instance_id: instance_id,
27
+ hosted_zone_id: hosted_zone_id,
28
+ record_set: record_set,
29
+ ) do |instance_id, pubilic_ip, record_set|
30
+ environment[:ui].info("#{instance_id}'s #{pubilic_ip} has been assigned to #{record_set[0]}[#{record_set[1]}]")
31
+ end
32
+ end
33
+
34
+ private
35
+
36
+ def set(options)
37
+ ::AWS.config(access_key_id: options[:access_key_id], secret_access_key: options[:secret_access_key], region: options[:region])
38
+
39
+ ec2 = ::AWS.ec2
40
+ public_ip = ec2.instances[options[:instance_id]].public_ip_address
41
+
42
+ record_sets = ::AWS::Route53::HostedZone.new(options[:hosted_zone_id]).rrsets
43
+ record_set = record_sets[*options[:record_set]]
44
+ record_set.resource_records = [{ value: public_ip }]
45
+ record_set.update
46
+
47
+ if block_given?
48
+ yield options[:instance_id], public_ip, options[:record_set]
49
+ end
50
+
51
+ nil
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,21 @@
1
+ require 'vagrant'
2
+
3
+ module VagrantPlugins
4
+ module AwsRoute53
5
+ class Config < Vagrant.plugin('2', :config)
6
+ attr_accessor :hosted_zone_id
7
+ attr_accessor :record_set
8
+
9
+ def initialize
10
+ @hosted_zone_id = UNSET_VALUE
11
+ @record_set = UNSET_VALUE
12
+ end
13
+
14
+ def validate(machine)
15
+ errors = _detected_errors
16
+
17
+ { 'AwsRoute53' => errors }
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,23 @@
1
+ require 'vagrant'
2
+
3
+ module VagrantPlugins
4
+ module AwsRoute53
5
+ class Plugin < Vagrant.plugin('2')
6
+ name 'AwsRoute53'
7
+
8
+ description <<-DESC
9
+ DESC
10
+
11
+ config :route53 do
12
+ require_relative './config'
13
+ Config
14
+ end
15
+
16
+ action_hook :assign_ip, :machine_action_up do |hook|
17
+ require_relative './action/set_ip'
18
+ hook.after VagrantPlugins::AWS::Action::RunInstance, VagrantPlugins::AwsRoute53::Action::SetIp
19
+ hook.after VagrantPlugins::AWS::Action::StartInstance, VagrantPlugins::AwsRoute53::Action::SetIp
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module AwsRoute53
3
+ VERSION = '0.2.3'
4
+ end
5
+ end
@@ -0,0 +1,6 @@
1
+ require 'vagrant-aws-route53/plugin'
2
+
3
+ module VagrantPlugins
4
+ module AwsRoute53
5
+ end
6
+ end
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-aws-route53
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.3
5
+ platform: ruby
6
+ authors:
7
+ - Naohiro Oogatta
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: aws-sdk
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: A Vagrant plugin assigns the IP of the instance which vagrant-aws provider
28
+ created to a specific Route 53 record set.
29
+ email: oogatta@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - lib/vagrant-aws-route53/action/set_ip.rb
35
+ - lib/vagrant-aws-route53/config.rb
36
+ - lib/vagrant-aws-route53/plugin.rb
37
+ - lib/vagrant-aws-route53/version.rb
38
+ - lib/vagrant-aws-route53.rb
39
+ - LICENSE
40
+ - README.md
41
+ homepage: https://github.com/oogatta/vagrant-aws-route53
42
+ licenses:
43
+ - MIT
44
+ metadata: {}
45
+ post_install_message:
46
+ rdoc_options: []
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - '>='
57
+ - !ruby/object:Gem::Version
58
+ version: '0'
59
+ requirements: []
60
+ rubyforge_project:
61
+ rubygems_version: 2.0.14
62
+ signing_key:
63
+ specification_version: 4
64
+ summary: Assigns IPs of Vagrant AWS instances to route 53.
65
+ test_files: []