itamae-mitsurin 0.8 → 0.9

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: e97c933691d17f91c2c1c4264349bb262cfbb18b
4
- data.tar.gz: 029195b19075695902c96f3542d87fa381fb6db1
3
+ metadata.gz: 0a45ec76366a924a92771e4cf08f53c866383967
4
+ data.tar.gz: 1b142ae15b1d125bbcd642872e4a2865da5bd939
5
5
  SHA512:
6
- metadata.gz: 6d987dd2f60c4d83910b537c1a4494814ed8178ccdc90b9c60cae176988aef7ad28cb0ed30cc4df06c130975b5bea502e2edcb827570eee91171a85c5ebde439
7
- data.tar.gz: d6aa204d123181354c6cf027c10dee0e94c29d1e6d90537326891e07345f9484ecfe3e2d0e022e38e713f5c9cd9cea757f5f08db2187ee46a70a77132254cc95
6
+ metadata.gz: 6f0cadfe3f00e8a2c7b0304734402365eb473fc30d587cd8f0dbb0669930429f72cbf6ae6ca03e0fdcee5da4d83393c18cfb2942d7fed83f0956b8c813163566
7
+ data.tar.gz: 98b3fac81b5f878849588417f7ce3b96f7a6587d8ae8b7523f1bdc08f70396fabea63e6195ec61ce4fa6294037e4ca3a0355fc6fc83c131a5a9beb20ae92acae
@@ -2,85 +2,92 @@ require 'itamae-mitsurin'
2
2
  require 'itamae-mitsurin/mitsurin'
3
3
 
4
4
  module ItamaeMitsurin
5
- module Resource
6
- class AwsEbsVolume < Base
5
+ module Resource
6
+ class AwsEbsVolume < Base
7
+ define_attribute :action, default: :create
8
+ define_attribute :name, type: String, default_name: true
9
+ define_attribute :region, type: String
10
+ define_attribute :availability_zone, type: String
11
+ define_attribute :device, type: String
12
+ define_attribute :instance_id, type: String
13
+ define_attribute :volume_type, type: String
14
+ define_attribute :size, type: Integer
7
15
 
8
- define_attribute :region, type: String
9
- define_attribute :action, default: :create
10
- define_attribute :name, type: String, default_name: true
11
- define_attribute :availability_zone, type: String
12
- define_attribute :device, type: String
13
- define_attribute :instance_id, type: String
14
- define_attribute :volume_type, type: String
15
- define_attribute :size, type: Integer
16
+ def action_create(options)
17
+ ec2 = ::Aws::EC2::Client.new(region: attributes.region)
18
+ volumes = ec2.describe_volumes(
19
+ {
20
+ filters: [
21
+ {
22
+ name: 'tag:Name',
23
+ values: [ attributes.name ],
24
+ },
25
+ ],
26
+ }
27
+ ).volumes
28
+
29
+ if volumes.empty?
30
+ @volume = ec2.create_volume(
31
+ size: attributes[:size], # attributes.size returns the size of attributes hash
32
+ availability_zone: attributes.availability_zone,
33
+ volume_type: attributes.volume_type,
34
+ )
35
+ ec2.wait_until(:volume_available, volume_ids: [ @volume.volume_id ])
16
36
 
17
- def action_create(options)
18
- Aws.config[:region] = attributes.region
19
- ec2 = ::Aws::EC2::Client.new
20
- volumes = ec2.describe_volumes(
21
- {
22
- filters: [
37
+ ec2.create_tags(
23
38
  {
24
- name: 'tag:Name',
25
- values: [ attributes.name ],
26
- },
27
- ],
28
- }
29
- ).volumes
39
+ resources: [ @volume.volume_id ],
40
+ tags: [
41
+ {
42
+ key: 'Name',
43
+ value: attributes.name,
44
+ },
45
+ ],
46
+ }
47
+ )
30
48
 
31
- if volumes.empty?
32
- @volume = ec2.create_volume(
33
- size: attributes[:size], # attributes.size returns the size of attributes hash
34
- availability_zone: attributes.availability_zone,
35
- volume_type: attributes.volume_type,
36
- )
49
+ ItamaeMitsurin.logger.color(:green) do
50
+ ItamaeMitsurin.info "create volume compleated!"
51
+ end
52
+ updated!
53
+ else
54
+ @volume = volumes[0]
55
+ end
37
56
 
38
- ec2.create_tags(
57
+ end
58
+
59
+ def action_attach(options)
60
+ ec2 = ::Aws::EC2::Client.new(region: attributes.region)
61
+ volumes = ec2.describe_volumes(
39
62
  {
40
- resources: [ @volume.volume_id ],
41
- tags: [
63
+ filters: [
42
64
  {
43
- key: 'Name',
44
- value: attributes.name,
65
+ name: 'tag:Name',
66
+ values: [ attributes.name ],
45
67
  },
46
68
  ],
47
69
  }
48
- )
70
+ ).volumes
49
71
 
50
- updated!
51
- sleep(3)
52
- else
53
- @volume = volumes[0]
54
- end
55
- end
72
+ unless volumes.empty?
73
+ @volume = ec2.attach_volume({
74
+ volume_id: @volume.volume_id,
75
+ instance_id: attributes.instance_id,
76
+ device: attributes.device
77
+ })
78
+ ec2.wait_until(:volume_in_use, volume_ids: [ @volume.volume_id ])
56
79
 
57
- def action_attach(options)
58
- Aws.config[:region] = attributes.region
59
- ec2 = ::Aws::EC2::Client.new
60
- volumes = ec2.describe_volumes(
61
- {
62
- filters: [
63
- {
64
- name: 'tag:Name',
65
- values: [ attributes.name ],
66
- },
67
- ],
68
- }
69
- ).volumes
70
80
 
71
- unless volumes.empty?
72
- @volume = ec2.attach_volume({
73
- volume_id: @volume.volume_id,
74
- instance_id: attributes.instance_id,
75
- device: attributes.device
76
- })
81
+ ItamaeMitsurin.logger.color(:green) do
82
+ ItamaeMitsurin.info "attach volume compleated!"
83
+ end
84
+ updated!
85
+ else
86
+ @volume = volumes[0]
87
+ end
77
88
 
78
- updated!
79
- else
80
- @volume = volumes[0]
81
89
  end
82
90
  end
83
91
  end
84
- end
85
92
  end
86
93
 
@@ -0,0 +1,175 @@
1
+ require 'itamae-mitsurin'
2
+ require 'itamae-mitsurin/mitsurin'
3
+
4
+ module ItamaeMitsurin
5
+ module Resource
6
+ class AwsEc2Instance < Base
7
+
8
+ define_attribute :region, type: String
9
+ define_attribute :action, default: :create
10
+ define_attribute :dry_run, type: [TrueClass, FalseClass], default_name: false
11
+ define_attribute :name, type: String, default_name: true
12
+ define_attribute :image_id, type: String, required: true
13
+ define_attribute :key_name, type: String, required: true
14
+ define_attribute :security_group_ids, type: Array
15
+ define_attribute :user_data, type: String
16
+ define_attribute :instance_type, type: String, required: true
17
+ define_attribute :kernel_id, type: String
18
+ define_attribute :ramdisk_id, type: String
19
+ define_attribute :device_name, type: String
20
+ define_attribute :snapshot_id, type: String
21
+ define_attribute :volume_size, type: Integer
22
+ define_attribute :delete_on_termination, type: [TrueClass, FalseClass], default: true
23
+ define_attribute :volume_type, type: String, default: "gp2"
24
+ define_attribute :iops, type: Integer
25
+ define_attribute :encrypted, type: [TrueClass, FalseClass]
26
+ define_attribute :monitoring, type: [TrueClass, FalseClass], default: false
27
+ define_attribute :subnet_id, type: String
28
+ define_attribute :disable_api_termination, type: [TrueClass, FalseClass], default: false
29
+ define_attribute :instance_initiated_shutdown_behavior, type: String, default: "stop"
30
+ define_attribute :private_ip_address, type: String
31
+ define_attribute :client_token, type: String
32
+ define_attribute :additional_info, type: String
33
+ define_attribute :network_interface_id, type: String
34
+ define_attribute :device_index, type: String
35
+ define_attribute :subnet_id, type: String
36
+ define_attribute :private_ip_address, type: String
37
+ define_attribute :groups, type: Array
38
+ define_attribute :private_ip_address, type: String
39
+ define_attribute :primary, type: [TrueClass, FalseClass], default: true
40
+ define_attribute :secondary_private_ip_address_count, type: Integer
41
+ define_attribute :associate_public_ip_address, type: [TrueClass, FalseClass], default: true
42
+ define_attribute :iam_instance_profile, type: String
43
+ define_attribute :ebs_optimized, type: [TrueClass, FalseClass], default: false
44
+ define_attribute :tags, type: Array
45
+
46
+ def pre_action
47
+ logger = ItamaeMitsurin.logger
48
+ @ec2 = ::Aws::EC2::Client.new(region: attributes.region)
49
+
50
+ instance = @ec2.describe_instances({
51
+ filters: [
52
+ {
53
+ name: 'tag:Name',
54
+ values: [ attributes.name ],
55
+ },
56
+ ],
57
+ }).reservations
58
+
59
+ @flag = nil
60
+ unless instance.empty?
61
+ logger.color(:white) {logger.debug "instance describe status =>\n #{instance.to_s.gsub(/,/, "\n")}"}
62
+ instance[0][:instances][0][:tags].each do |tag|
63
+ st = tag.values.include? attributes.name
64
+ end
65
+ @flag = instance[0][:instances][0][:state].code
66
+ @instance_id = Array.new(1) {instance[0][:instances][0][:instance_id]}
67
+ end
68
+
69
+ @instance_hash = {
70
+ dry_run: attributes.dry_run,
71
+ image_id: attributes.image_id,
72
+ min_count: 1,
73
+ max_count: 1,
74
+ key_name: attributes.key_name,
75
+ security_group_ids: attributes.security_group_ids,
76
+ user_data: attributes.user_data,
77
+ instance_type: attributes.instance_type,
78
+ kernel_id: attributes.kernel_id,
79
+ ramdisk_id: attributes.ramdisk_id,
80
+ block_device_mappings: [
81
+ {
82
+ device_name: attributes.device_name,
83
+ ebs: {
84
+ snapshot_id: attributes.snapshot_id,
85
+ volume_size: attributes.volume_size,
86
+ delete_on_termination: attributes.delete_on_termination,
87
+ volume_type: attributes.volume_type,
88
+ iops: attributes.iops,
89
+ encrypted: attributes.encrypted,
90
+ },
91
+ },
92
+ ],
93
+ monitoring: {
94
+ enabled: attributes.monitoring,
95
+ },
96
+ subnet_id: attributes.subnet_id,
97
+ disable_api_termination: attributes.disable_api_termination,
98
+ instance_initiated_shutdown_behavior: attributes.instance_initiated_shutdown_behavior,
99
+ private_ip_address: attributes.private_ip_address,
100
+ client_token: attributes.client_token,
101
+ additional_info: attributes.additional_info,
102
+ iam_instance_profile: {
103
+ name: attributes.iam_instance_profile,
104
+ },
105
+ ebs_optimized: attributes.ebs_optimized,
106
+ }
107
+ logger.debug "created hash =>\n #{@instance_hash.inspect}"
108
+ end
109
+
110
+ def action_create(options)
111
+ logger = ItamaeMitsurin.logger
112
+ if @flag == nil or @flag == 48
113
+ resp = @ec2.run_instances(@instance_hash)
114
+ instance_id = Array.new(1) {resp[:instances][0][:instance_id]}
115
+ logger.color(:green) {logger.info "created instance #{instance_id}"}
116
+
117
+ @ec2.create_tags({
118
+ resources: instance_id,
119
+ tags: [
120
+ {
121
+ key: "Name",
122
+ value: attributes.name,
123
+ },
124
+ ],
125
+ })
126
+
127
+ attributes.tags.each do |tag_h|
128
+ @ec2.create_tags({
129
+ resources: instance_id,
130
+ tags: [
131
+ {
132
+ key: tag_h.keys.join,
133
+ value: tag_h.values.join,
134
+ },
135
+ ],
136
+ })
137
+ end
138
+
139
+ logger.color(:green) {logger.info "start up to instance #{instance_id}"}
140
+ @ec2.start_instances(instance_ids: instance_id)
141
+ resp = @ec2.wait_until(:instance_running, instance_ids: instance_id) do |w|
142
+ w.interval = 15
143
+ w.max_attempts = 60
144
+ w.before_wait do |attempts, response|
145
+ logger.info "wait Initializing..."
146
+ end
147
+ end
148
+ sleep 60
149
+ logger.color(:green) {logger.info "started running instance #{instance_id}"}
150
+
151
+ updated!
152
+ end
153
+ end
154
+
155
+ def action_start(options)
156
+ logger = ItamaeMitsurin.logger
157
+ unless @flag == nil or @flag == 48 or @flag == 16
158
+ @ec2.start_instances(instance_ids: @instance_id)
159
+ ItamaeMitsurin.logger.info "start up to instance #{@instance_id}"
160
+ resp = @ec2.wait_until(:instance_running, instance_ids: @instance_id) do |w|
161
+ w.interval = 15
162
+ w.max_attempts = 60
163
+ w.before_wait do |attempts, response|
164
+ logger.info "wait Initializing..."
165
+ end
166
+ end
167
+ sleep 60
168
+ logger.color(:green) {logger.info "started running instance #{@instance_id}"}
169
+
170
+ updated!
171
+ end
172
+ end
173
+ end
174
+ end
175
+ end
@@ -5,92 +5,94 @@ module ItamaeMitsurin
5
5
  module Resource
6
6
  class AwsRoute53Rrset < Base
7
7
 
8
- define_attribute :region, type: String
9
- define_attribute :action, default: :create
10
- define_attribute :name, type: String, default_name: true
11
- define_attribute :hosted_zone_id, type: String, required: true
12
- define_attribute :type, type: String, required: true
13
- define_attribute :weight, type: Integer
14
- define_attribute :failover, type: String
15
- define_attribute :ttl, type: Integer
16
- define_attribute :value, type: String, required: true
17
- define_attribute :health_check_id, type: String
18
- define_attribute :traffic_policy_instance_id, type: String
8
+ define_attribute :region, type: String
9
+ define_attribute :action, default: :create
10
+ define_attribute :name, type: String, default_name: true
11
+ define_attribute :hosted_zone_id, type: String, required: true
12
+ define_attribute :type, type: String, required: true, required: true
13
+ define_attribute :weight, type: Integer
14
+ define_attribute :failover, type: String
15
+ define_attribute :ttl, type: Integer
16
+ define_attribute :value, type: String, required: true
17
+ define_attribute :health_check_id, type: String
18
+ define_attribute :traffic_policy_instance_id, type: String
19
19
 
20
- def pre_action
21
- Aws.config[:region] = attributes.region
22
- route53 = ::Aws::Route53::Client.new
20
+ def pre_action
21
+ Aws.config[:region] = attributes.region
22
+ route53 = ::Aws::Route53::Client.new
23
23
 
24
- @record = route53.list_resource_record_sets({
25
- hosted_zone_id: attributes.hosted_zone_id,
26
- start_record_name: attributes.name,
27
- start_record_type: attributes.type,
28
- max_items: 1,
29
- })
24
+ @record = route53.list_resource_record_sets({
25
+ hosted_zone_id: attributes.hosted_zone_id,
26
+ start_record_name: attributes.name,
27
+ start_record_type: attributes.type,
28
+ max_items: 1,
29
+ })
30
30
 
31
- if attributes.failover == "PRIMARY"
32
- set_identifier = "PRIMARY-" + attributes.name.split(".")[0]
33
- elsif attributes.failover == "SECONDARY"
34
- set_identifier = "SECONDARY-" + attributes.name.split(".")[0]
35
- else
36
- set_identifier = nil
37
- end
31
+ if attributes.failover == "PRIMARY"
32
+ set_identifier = "PRIMARY-" + attributes.name.split(".")[0]
33
+ elsif attributes.failover == "SECONDARY"
34
+ set_identifier = "SECONDARY-" + attributes.name.split(".")[0]
35
+ else
36
+ set_identifier = nil
37
+ end
38
38
 
39
- @rrset_hash = {
40
- hosted_zone_id: attributes.hosted_zone_id,
41
- change_batch: {
42
- comment: nil,
43
- changes: [
44
- {
45
- action: attributes.action.to_s.upcase,
46
- resource_record_set: {
47
- name: attributes.name,
48
- type: attributes.type,
49
- set_identifier: set_identifier,
50
- weight: attributes.weight,
51
- failover: attributes.failover,
52
- ttl: attributes.ttl,
53
- resource_records: [
54
- {
55
- value: attributes.value,
39
+ @rrset_hash = {
40
+ hosted_zone_id: attributes.hosted_zone_id,
41
+ change_batch: {
42
+ comment: nil,
43
+ changes: [
44
+ {
45
+ action: attributes.action.to_s.upcase,
46
+ resource_record_set: {
47
+ name: attributes.name,
48
+ type: attributes.type,
49
+ set_identifier: set_identifier,
50
+ weight: attributes.weight,
51
+ failover: attributes.failover,
52
+ ttl: attributes.ttl,
53
+ resource_records: [
54
+ {
55
+ value: attributes.value,
56
+ },
57
+ ],
58
+ health_check_id: attributes.health_check_id,
59
+ traffic_policy_instance_id: attributes.traffic_policy_instance_id,
56
60
  },
57
- ],
58
- health_check_id: attributes.health_check_id,
59
- traffic_policy_instance_id: attributes.traffic_policy_instance_id,
60
- },
61
+ },
62
+ ],
61
63
  },
62
- ],
63
- },
64
- }
65
- end
64
+ }
66
65
 
67
- def action_create(options)
68
- Aws.config[:region] = attributes.region
69
- route53 = ::Aws::Route53::Client.new
70
-
71
- unless @record[0][0][0] == attributes.name
72
- resp = route53.change_resource_record_sets(@rrset_hash)
73
- updated!
74
66
  end
75
- end
76
67
 
77
- def action_upsert(options)
78
- Aws.config[:region] = attributes.region
79
- route53 = ::Aws::Route53::Client.new
68
+ def action_create(options)
69
+ Aws.config[:region] = attributes.region
70
+ route53 = ::Aws::Route53::Client.new
80
71
 
81
- resp = route53.change_resource_record_sets(@rrset_hash)
82
- updated!
83
- end
72
+ unless @record[0][0][0] == attributes.name
73
+ resp = route53.change_resource_record_sets(@rrset_hash)
74
+ updated!
75
+ end
76
+ end
84
77
 
85
- def action_delete(options)
86
- Aws.config[:region] = attributes.region
87
- route53 = ::Aws::Route53::Client.new
78
+ def action_upsert(options)
79
+ Aws.config[:region] = attributes.region
80
+ route53 = ::Aws::Route53::Client.new
88
81
 
89
- if @record[0][0][0] == attributes.name
90
82
  resp = route53.change_resource_record_sets(@rrset_hash)
91
83
  updated!
92
84
  end
93
- end
85
+
86
+ def action_delete(options)
87
+ Aws.config[:region] = attributes.region
88
+ route53 = ::Aws::Route53::Client.new
89
+
90
+ if @record[0][0][0] == attributes.name
91
+ resp = route53.change_resource_record_sets(@rrset_hash)
92
+ updated!
93
+ end
94
+ end
95
+
94
96
  end
95
97
  end
96
98
  end
@@ -5,93 +5,95 @@ module ItamaeMitsurin
5
5
  module Resource
6
6
  class AwsRoute53RrsetAlias < Base
7
7
 
8
- define_attribute :region, type: String
9
- define_attribute :action, default: :create
10
- define_attribute :name, type: String, default_name: true
11
- define_attribute :type, type: String, required: true
12
- define_attribute :hosted_zone_id, type: String, required: true
13
- define_attribute :weight, type: Integer
14
- define_attribute :failover, type: String
15
- define_attribute :alias_target, type: [TrueClass, FalseClass], default: false, required: true
16
- define_attribute :alias_hosted_zone_id, type: String, required: true
17
- define_attribute :dns_name, type: String, required: true
18
- define_attribute :evaluate_target_health, type: [TrueClass, FalseClass], default: false
19
- define_attribute :health_check_id, type: String
20
- define_attribute :traffic_policy_instance_id, type: String
8
+ define_attribute :region, type: String
9
+ define_attribute :action, default: :create
10
+ define_attribute :name, type: String, default_name: true
11
+ define_attribute :type, type: String, required: true, required: true
12
+ define_attribute :hosted_zone_id, type: String, required: true
13
+ define_attribute :weight, type: Integer
14
+ define_attribute :failover, type: String
15
+ define_attribute :alias_target, type: [TrueClass, FalseClass], default: false, required: true
16
+ define_attribute :alias_hosted_zone_id, type: String, required: true
17
+ define_attribute :dns_name, type: String, required: true
18
+ define_attribute :evaluate_target_health, type: [TrueClass, FalseClass], default: false
19
+ define_attribute :health_check_id, type: String
20
+ define_attribute :traffic_policy_instance_id, type: String
21
21
 
22
- def pre_action
23
- Aws.config[:region] = attributes.region
24
- route53 = ::Aws::Route53::Client.new
22
+ def pre_action
23
+ Aws.config[:region] = attributes.region
24
+ route53 = ::Aws::Route53::Client.new
25
25
 
26
- @record = route53.list_resource_record_sets({
27
- hosted_zone_id: attributes.hosted_zone_id,
28
- start_record_name: attributes.name,
29
- start_record_type: attributes.type,
30
- max_items: 1,
31
- })
26
+ @record = route53.list_resource_record_sets({
27
+ hosted_zone_id: attributes.hosted_zone_id,
28
+ start_record_name: attributes.name,
29
+ start_record_type: attributes.type,
30
+ max_items: 1,
31
+ })
32
32
 
33
- if attributes.failover == "PRIMARY"
34
- set_identifier = "PRIMARY-" + attributes.name.split(".")[0]
35
- elsif attributes.failover == "SECONDARY"
36
- set_identifier = "SECONDARY-" + attributes.name.split(".")[0]
37
- else
38
- set_identifier = nil
39
- end
33
+ if attributes.failover == "PRIMARY"
34
+ set_identifier = "PRIMARY-" + attributes.name.split(".")[0]
35
+ elsif attributes.failover == "SECONDARY"
36
+ set_identifier = "SECONDARY-" + attributes.name.split(".")[0]
37
+ else
38
+ set_identifier = nil
39
+ end
40
40
 
41
- @rrset_hash = {
42
- hosted_zone_id: attributes.hosted_zone_id,
43
- change_batch: {
44
- comment: nil,
45
- changes: [
46
- {
47
- action: attributes.action.to_s.upcase,
48
- resource_record_set: {
49
- name: attributes.name,
50
- type: attributes.type,
51
- set_identifier: set_identifier,
52
- weight: attributes.weight,
53
- failover: attributes.failover,
54
- alias_target: {
55
- hosted_zone_id: attributes.alias_hosted_zone_id,
56
- dns_name: attributes.dns_name,
57
- evaluate_target_health: attributes.evaluate_target_health,
41
+ @rrset_hash = {
42
+ hosted_zone_id: attributes.hosted_zone_id,
43
+ change_batch: {
44
+ comment: nil,
45
+ changes: [
46
+ {
47
+ action: attributes.action.to_s.upcase,
48
+ resource_record_set: {
49
+ name: attributes.name,
50
+ type: attributes.type,
51
+ set_identifier: set_identifier,
52
+ weight: attributes.weight,
53
+ failover: attributes.failover,
54
+ alias_target: {
55
+ hosted_zone_id: attributes.alias_hosted_zone_id,
56
+ dns_name: attributes.dns_name,
57
+ evaluate_target_health: attributes.evaluate_target_health,
58
+ },
59
+ health_check_id: attributes.health_check_id,
60
+ traffic_policy_instance_id: attributes.traffic_policy_instance_id,
61
+ },
58
62
  },
59
- health_check_id: attributes.health_check_id,
60
- traffic_policy_instance_id: attributes.traffic_policy_instance_id,
61
- },
63
+ ],
62
64
  },
63
- ],
64
- },
65
- }
66
- end
65
+ }
67
66
 
68
- def action_create(options)
69
- Aws.config[:region] = attributes.region
70
- route53 = ::Aws::Route53::Client.new
71
-
72
- unless @record[0][0][0] == attributes.name
73
- resp = route53.change_resource_record_sets(@rrset_hash)
74
- updated!
75
67
  end
76
- end
77
68
 
78
- def action_upsert(options)
79
- Aws.config[:region] = attributes.region
80
- route53 = ::Aws::Route53::Client.new
69
+ def action_create(options)
70
+ Aws.config[:region] = attributes.region
71
+ route53 = ::Aws::Route53::Client.new
81
72
 
82
- resp = route53.change_resource_record_sets(@rrset_hash)
83
- updated!
84
- end
73
+ unless @record[0][0][0] == attributes.name
74
+ resp = route53.change_resource_record_sets(@rrset_hash)
75
+ updated!
76
+ end
77
+ end
85
78
 
86
- def action_delete(options)
87
- Aws.config[:region] = attributes.region
88
- route53 = ::Aws::Route53::Client.new
79
+ def action_upsert(options)
80
+ Aws.config[:region] = attributes.region
81
+ route53 = ::Aws::Route53::Client.new
89
82
 
90
- if @record[0][0][0] == attributes.name
91
83
  resp = route53.change_resource_record_sets(@rrset_hash)
92
84
  updated!
93
85
  end
94
- end
86
+
87
+ def action_delete(options)
88
+ Aws.config[:region] = attributes.region
89
+ route53 = ::Aws::Route53::Client.new
90
+
91
+ if @record[0][0][0] == attributes.name
92
+ resp = route53.change_resource_record_sets(@rrset_hash)
93
+ updated!
94
+ end
95
+ end
96
+
95
97
  end
96
98
  end
97
99
  end
@@ -1 +1 @@
1
- 0.8
1
+ 0.9
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itamae-mitsurin
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.8'
4
+ version: '0.9'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akihiro Kamiyama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-07 00:00:00.000000000 Z
11
+ date: 2016-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -280,6 +280,7 @@ files:
280
280
  - lib/itamae-mitsurin/recipe_children.rb
281
281
  - lib/itamae-mitsurin/resource.rb
282
282
  - lib/itamae-mitsurin/resource/aws_ebs_volume.rb
283
+ - lib/itamae-mitsurin/resource/aws_ec2_instance.rb
283
284
  - lib/itamae-mitsurin/resource/aws_route53_rrset.rb
284
285
  - lib/itamae-mitsurin/resource/aws_route53_rrset_alias.rb
285
286
  - lib/itamae-mitsurin/resource/base.rb