cloud-mu 3.4.0 → 3.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/ansible/roles/mu-nat/tasks/main.yml +3 -0
- data/bin/mu-aws-setup +41 -7
- data/bin/mu-azure-setup +34 -0
- data/bin/mu-configure +214 -119
- data/bin/mu-gcp-setup +37 -2
- data/bin/mu-node-manage +3 -0
- data/bin/mu-refresh-ssl +67 -0
- data/bin/mu-run-tests +14 -4
- data/bin/mu-self-update +30 -10
- data/bin/mu-upload-chef-artifacts +30 -26
- data/cloud-mu.gemspec +8 -6
- data/cookbooks/mu-master/attributes/default.rb +5 -1
- data/cookbooks/mu-master/metadata.rb +2 -2
- data/cookbooks/mu-master/recipes/default.rb +81 -26
- data/cookbooks/mu-master/recipes/init.rb +197 -62
- data/cookbooks/mu-master/recipes/update_nagios_only.rb +1 -1
- data/cookbooks/mu-master/recipes/vault.rb +78 -77
- data/cookbooks/mu-master/templates/default/mods/rewrite.conf.erb +1 -0
- data/cookbooks/mu-master/templates/default/nagios.conf.erb +103 -0
- data/cookbooks/mu-master/templates/default/web_app.conf.erb +14 -30
- data/cookbooks/mu-tools/attributes/default.rb +5 -0
- data/cookbooks/mu-tools/files/centos-6/CentOS-Base.repo +47 -0
- data/cookbooks/mu-tools/libraries/helper.rb +12 -2
- data/cookbooks/mu-tools/libraries/monkey.rb +1 -1
- data/cookbooks/mu-tools/recipes/apply_security.rb +6 -0
- data/cookbooks/mu-tools/recipes/aws_api.rb +6 -4
- data/cookbooks/mu-tools/recipes/base_repositories.rb +1 -1
- data/cookbooks/mu-tools/recipes/gcloud.rb +2 -9
- data/cookbooks/mu-tools/recipes/google_api.rb +5 -2
- data/cookbooks/mu-tools/resources/disk.rb +108 -58
- data/extras/Gemfile.lock.bootstrap +394 -0
- data/extras/bucketstubs/error.html +0 -0
- data/extras/bucketstubs/index.html +0 -0
- data/extras/clean-stock-amis +9 -9
- data/extras/git_rpm/build.sh +20 -0
- data/extras/git_rpm/mugit.spec +53 -0
- data/extras/image-generators/VMWare/centos8.yaml +15 -0
- data/extras/openssl_rpm/build.sh +19 -0
- data/extras/openssl_rpm/mussl.spec +46 -0
- data/extras/python_rpm/muthon.spec +14 -4
- data/extras/ruby_rpm/muby.spec +9 -5
- data/extras/sqlite_rpm/build.sh +19 -0
- data/extras/sqlite_rpm/muqlite.spec +47 -0
- data/install/installer +7 -5
- data/modules/mu.rb +12 -5
- data/modules/mu/cloud/machine_images.rb +1 -1
- data/modules/mu/cloud/providers.rb +6 -1
- data/modules/mu/cloud/resource_base.rb +1 -1
- data/modules/mu/cloud/ssh_sessions.rb +4 -0
- data/modules/mu/config.rb +28 -12
- data/modules/mu/config/database.rb +2 -2
- data/modules/mu/config/firewall_rule.rb +1 -1
- data/modules/mu/config/ref.rb +2 -2
- data/modules/mu/config/schema_helpers.rb +12 -3
- data/modules/mu/config/server.rb +10 -4
- data/modules/mu/config/server_pool.rb +2 -2
- data/modules/mu/config/vpc.rb +10 -10
- data/modules/mu/defaults/AWS.yaml +32 -32
- data/modules/mu/deploy.rb +23 -10
- data/modules/mu/groomers/chef.rb +2 -2
- data/modules/mu/master.rb +49 -3
- data/modules/mu/mommacat.rb +8 -5
- data/modules/mu/mommacat/naming.rb +2 -2
- data/modules/mu/mommacat/storage.rb +22 -27
- data/modules/mu/providers/aws.rb +142 -48
- data/modules/mu/providers/aws/alarm.rb +3 -3
- data/modules/mu/providers/aws/bucket.rb +19 -19
- data/modules/mu/providers/aws/cache_cluster.rb +22 -22
- data/modules/mu/providers/aws/cdn.rb +2 -2
- data/modules/mu/providers/aws/collection.rb +14 -14
- data/modules/mu/providers/aws/container_cluster.rb +27 -27
- data/modules/mu/providers/aws/database.rb +40 -39
- data/modules/mu/providers/aws/dnszone.rb +5 -5
- data/modules/mu/providers/aws/endpoint.rb +35 -35
- data/modules/mu/providers/aws/firewall_rule.rb +26 -23
- data/modules/mu/providers/aws/function.rb +28 -28
- data/modules/mu/providers/aws/group.rb +7 -7
- data/modules/mu/providers/aws/habitat.rb +2 -2
- data/modules/mu/providers/aws/job.rb +6 -6
- data/modules/mu/providers/aws/loadbalancer.rb +34 -34
- data/modules/mu/providers/aws/log.rb +14 -14
- data/modules/mu/providers/aws/msg_queue.rb +10 -10
- data/modules/mu/providers/aws/nosqldb.rb +8 -8
- data/modules/mu/providers/aws/notifier.rb +7 -7
- data/modules/mu/providers/aws/role.rb +17 -15
- data/modules/mu/providers/aws/search_domain.rb +10 -10
- data/modules/mu/providers/aws/server.rb +176 -95
- data/modules/mu/providers/aws/server_pool.rb +65 -105
- data/modules/mu/providers/aws/storage_pool.rb +17 -9
- data/modules/mu/providers/aws/user.rb +1 -1
- data/modules/mu/providers/aws/vpc.rb +103 -51
- data/modules/mu/providers/aws/vpc_subnet.rb +43 -39
- data/modules/mu/providers/azure.rb +78 -12
- data/modules/mu/providers/azure/server.rb +18 -3
- data/modules/mu/providers/cloudformation/server.rb +1 -1
- data/modules/mu/providers/google.rb +19 -4
- data/modules/mu/providers/google/folder.rb +6 -2
- data/modules/mu/providers/google/function.rb +65 -30
- data/modules/mu/providers/google/role.rb +1 -1
- data/modules/mu/providers/google/vpc.rb +27 -2
- data/modules/tests/aws-servers-with-handrolled-iam.yaml +37 -0
- data/modules/tests/k8s.yaml +1 -1
- metadata +24 -8
|
@@ -36,7 +36,7 @@ module MU
|
|
|
36
36
|
@dependencies[dimension["depclass"]][dimension["name"]].cloudobj.cloud_id
|
|
37
37
|
end
|
|
38
38
|
elsif dimension["mu_name"] and dimension["deploy_id"]
|
|
39
|
-
found = MU::MommaCat.findStray("AWS", deps_class, deploy_id: dimension["deploy_id"], mu_name: dimension["mu_name"], region: @
|
|
39
|
+
found = MU::MommaCat.findStray("AWS", deps_class, deploy_id: dimension["deploy_id"], mu_name: dimension["mu_name"], region: @region)
|
|
40
40
|
raise MuError, "Couldn't find #{deps_class} #{dimension["mu_name"]}" if found.nil? || found.empty?
|
|
41
41
|
resp = found.first.deploydata["cloud_id"]
|
|
42
42
|
resp.downcase if %w{database cache_cluster}.include?(deps_class)
|
|
@@ -79,8 +79,8 @@ module MU
|
|
|
79
79
|
evaluation_periods: @config["evaluation_periods"],
|
|
80
80
|
threshold: @config["threshold"],
|
|
81
81
|
comparison_operator: @config["comparison_operator"],
|
|
82
|
-
region: @
|
|
83
|
-
credentials: @
|
|
82
|
+
region: @region,
|
|
83
|
+
credentials: @credentials
|
|
84
84
|
)
|
|
85
85
|
|
|
86
86
|
@cloud_id = @mu_name
|
|
@@ -39,20 +39,20 @@ module MU
|
|
|
39
39
|
bucket_name = @deploy.getResourceName(@config["name"], max_length: 63).downcase
|
|
40
40
|
|
|
41
41
|
MU.log "Creating S3 bucket #{bucket_name}"
|
|
42
|
-
MU::Cloud::AWS.s3(credentials: @
|
|
42
|
+
MU::Cloud::AWS.s3(credentials: @credentials, region: @region).create_bucket(
|
|
43
43
|
acl: @config['acl'],
|
|
44
44
|
bucket: bucket_name
|
|
45
45
|
)
|
|
46
46
|
|
|
47
47
|
@cloud_id = bucket_name
|
|
48
|
-
is_live = MU::Cloud::AWS::Bucket.find(cloud_id: @cloud_id, region: @
|
|
48
|
+
is_live = MU::Cloud::AWS::Bucket.find(cloud_id: @cloud_id, region: @region, credentials: @credentials).values.first
|
|
49
49
|
begin
|
|
50
|
-
is_live = MU::Cloud::AWS::Bucket.find(cloud_id: @cloud_id, region: @
|
|
50
|
+
is_live = MU::Cloud::AWS::Bucket.find(cloud_id: @cloud_id, region: @region, credentials: @credentials).values.first
|
|
51
51
|
sleep 3
|
|
52
52
|
end while !is_live
|
|
53
53
|
|
|
54
54
|
@@region_cache_semaphore.synchronize {
|
|
55
|
-
@@region_cache[@cloud_id] ||= @
|
|
55
|
+
@@region_cache[@cloud_id] ||= @region
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
tagBucket if !@config['scrub_mu_isms']
|
|
@@ -78,7 +78,7 @@ module MU
|
|
|
78
78
|
}
|
|
79
79
|
end
|
|
80
80
|
|
|
81
|
-
MU::Cloud::AWS.s3(credentials: @
|
|
81
|
+
MU::Cloud::AWS.s3(credentials: @credentials, region: @region).put_bucket_tagging(
|
|
82
82
|
bucket: @cloud_id,
|
|
83
83
|
tagging: {
|
|
84
84
|
tag_set: tagset
|
|
@@ -120,7 +120,7 @@ module MU
|
|
|
120
120
|
def groom
|
|
121
121
|
|
|
122
122
|
@@region_cache_semaphore.synchronize {
|
|
123
|
-
@@region_cache[@cloud_id] ||= @
|
|
123
|
+
@@region_cache[@cloud_id] ||= @region
|
|
124
124
|
}
|
|
125
125
|
tagBucket if !@config['scrub_mu_isms']
|
|
126
126
|
|
|
@@ -129,7 +129,7 @@ module MU
|
|
|
129
129
|
|
|
130
130
|
if @config['versioning'] and current["versioning"].status != "Enabled"
|
|
131
131
|
MU.log "Enabling versioning on S3 bucket #{@cloud_id}", MU::NOTICE
|
|
132
|
-
MU::Cloud::AWS.s3(credentials: @
|
|
132
|
+
MU::Cloud::AWS.s3(credentials: @credentials, region: @region).put_bucket_versioning(
|
|
133
133
|
bucket: @cloud_id,
|
|
134
134
|
versioning_configuration: {
|
|
135
135
|
mfa_delete: "Disabled",
|
|
@@ -138,7 +138,7 @@ module MU
|
|
|
138
138
|
)
|
|
139
139
|
elsif !@config['versioning'] and current["versioning"].status == "Enabled"
|
|
140
140
|
MU.log "Suspending versioning on S3 bucket #{@cloud_id}", MU::NOTICE
|
|
141
|
-
MU::Cloud::AWS.s3(credentials: @
|
|
141
|
+
MU::Cloud::AWS.s3(credentials: @credentials, region: @region).put_bucket_versioning(
|
|
142
142
|
bucket: @cloud_id,
|
|
143
143
|
versioning_configuration: {
|
|
144
144
|
mfa_delete: "Disabled",
|
|
@@ -163,14 +163,14 @@ module MU
|
|
|
163
163
|
end
|
|
164
164
|
|
|
165
165
|
Hash[upload_me].each_pair { |file, url|
|
|
166
|
-
self.class.upload(url, file: file, credentials: @credentials, region: @
|
|
166
|
+
self.class.upload(url, file: file, credentials: @credentials, region: @region, acl: batch['acl'])
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
end
|
|
170
170
|
|
|
171
171
|
if @config['web'] and current["website"].nil?
|
|
172
172
|
MU.log "Enabling web service on S3 bucket #{@cloud_id}", MU::NOTICE
|
|
173
|
-
MU::Cloud::AWS.s3(credentials: @
|
|
173
|
+
MU::Cloud::AWS.s3(credentials: @credentials, region: @region).put_bucket_website(
|
|
174
174
|
bucket: @cloud_id,
|
|
175
175
|
website_configuration: {
|
|
176
176
|
error_document: {
|
|
@@ -183,13 +183,13 @@ module MU
|
|
|
183
183
|
)
|
|
184
184
|
['web_error_object', 'web_index_object'].each { |key|
|
|
185
185
|
begin
|
|
186
|
-
MU::Cloud::AWS.s3(credentials: @
|
|
186
|
+
MU::Cloud::AWS.s3(credentials: @credentials, region: @region).head_object(
|
|
187
187
|
bucket: @cloud_id,
|
|
188
188
|
key: @config[key]
|
|
189
189
|
)
|
|
190
190
|
rescue Aws::S3::Errors::NotFound
|
|
191
191
|
MU.log "Uploading placeholder #{@config[key]} to bucket #{@cloud_id}"
|
|
192
|
-
MU::Cloud::AWS.s3(credentials: @
|
|
192
|
+
MU::Cloud::AWS.s3(credentials: @credentials, region: @region).put_object(
|
|
193
193
|
acl: "public-read",
|
|
194
194
|
bucket: @cloud_id,
|
|
195
195
|
key: @config[key],
|
|
@@ -200,7 +200,7 @@ module MU
|
|
|
200
200
|
# XXX check if error and index objs exist, and if not provide placeholders
|
|
201
201
|
elsif !@config['web'] and !current["website"].nil?
|
|
202
202
|
MU.log "Disabling web service on S3 bucket #{@cloud_id}", MU::NOTICE
|
|
203
|
-
MU::Cloud::AWS.s3(credentials: @
|
|
203
|
+
MU::Cloud::AWS.s3(credentials: @credentials, region: @region).delete_bucket_website(
|
|
204
204
|
bucket: @cloud_id
|
|
205
205
|
)
|
|
206
206
|
end
|
|
@@ -225,7 +225,7 @@ module MU
|
|
|
225
225
|
|
|
226
226
|
if @config['cors']
|
|
227
227
|
MU.log "Setting CORS rules on #{@cloud_id}", details: @config['cors']
|
|
228
|
-
MU::Cloud::AWS.s3(credentials: @
|
|
228
|
+
MU::Cloud::AWS.s3(credentials: @credentials, region: @region).put_bucket_cors(
|
|
229
229
|
bucket: @cloud_id,
|
|
230
230
|
cors_configuration: {
|
|
231
231
|
cors_rules: symbolify_keys.call(@config['cors'])
|
|
@@ -235,7 +235,7 @@ module MU
|
|
|
235
235
|
|
|
236
236
|
MU.log "Bucket #{@config['name']}: s3://#{@cloud_id}", MU::SUMMARY
|
|
237
237
|
if @config['web']
|
|
238
|
-
MU.log "Bucket #{@config['name']} web access: http://#{@cloud_id}.s3-website-#{@
|
|
238
|
+
MU.log "Bucket #{@config['name']} web access: http://#{@cloud_id}.s3-website-#{@region}.amazonaws.com/", MU::SUMMARY
|
|
239
239
|
end
|
|
240
240
|
end
|
|
241
241
|
|
|
@@ -377,13 +377,13 @@ module MU
|
|
|
377
377
|
# Canonical Amazon Resource Number for this resource
|
|
378
378
|
# @return [String]
|
|
379
379
|
def arn
|
|
380
|
-
"arn:"+(MU::Cloud::AWS.isGovCloud?(@
|
|
380
|
+
"arn:"+(MU::Cloud::AWS.isGovCloud?(@region) ? "aws-us-gov" : "aws")+":s3:::"+@cloud_id
|
|
381
381
|
end
|
|
382
382
|
|
|
383
383
|
# Return the metadata for this user cofiguration
|
|
384
384
|
# @return [Hash]
|
|
385
385
|
def notify
|
|
386
|
-
desc = MU::Cloud::AWS::Bucket.describe_bucket(@cloud_id, credentials: @
|
|
386
|
+
desc = MU::Cloud::AWS::Bucket.describe_bucket(@cloud_id, credentials: @credentials, region: @region)
|
|
387
387
|
MU.structToHash(desc)
|
|
388
388
|
end
|
|
389
389
|
|
|
@@ -448,7 +448,7 @@ module MU
|
|
|
448
448
|
def toKitten(**_args)
|
|
449
449
|
bok = {
|
|
450
450
|
"cloud" => "AWS",
|
|
451
|
-
"credentials" => @
|
|
451
|
+
"credentials" => @credentials,
|
|
452
452
|
"cloud_id" => @cloud_id
|
|
453
453
|
}
|
|
454
454
|
|
|
@@ -611,7 +611,7 @@ end
|
|
|
611
611
|
policy_docs = MU::Cloud.resourceClass("AWS", "Role").genPolicyDocument(@config['policies'], deploy_obj: @deploy, bucket_style: true, version: "2008-10-17", doc_id: doc_id)
|
|
612
612
|
policy_docs.each { |doc|
|
|
613
613
|
MU.log "Applying S3 bucket policy #{doc.keys.first} to bucket #{@cloud_id}", MU::NOTICE, details: JSON.pretty_generate(doc.values.first)
|
|
614
|
-
MU::Cloud::AWS.s3(credentials: @
|
|
614
|
+
MU::Cloud::AWS.s3(credentials: @credentials, region: @region).put_bucket_policy(
|
|
615
615
|
bucket: @cloud_id,
|
|
616
616
|
policy: JSON.generate(doc.values.first)
|
|
617
617
|
)
|
|
@@ -35,7 +35,7 @@ module MU
|
|
|
35
35
|
# Canonical Amazon Resource Number for this resource
|
|
36
36
|
# @return [String]
|
|
37
37
|
def arn
|
|
38
|
-
"arn:"+(MU::Cloud::AWS.isGovCloud?(@
|
|
38
|
+
"arn:"+(MU::Cloud::AWS.isGovCloud?(@region) ? "aws-us-gov" : "aws")+":elasticache:"+@region+":"+MU::Cloud::AWS.credToAcct(@credentials)+":cluster/"+@cloud_id
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
# Locate an existing Cache Cluster or Cache Clusters and return an array containing matching AWS resource descriptors for those that match.
|
|
@@ -109,7 +109,7 @@ module MU
|
|
|
109
109
|
def addStandardTags(resource, resource_type, region: MU.curRegion)
|
|
110
110
|
MU.log "Adding tags to ElasticCache resource #{resource}"
|
|
111
111
|
MU::Cloud::AWS.elasticache(region: region).add_tags_to_resource(
|
|
112
|
-
resource_name: MU::Cloud::AWS::CacheCluster.getARN(resource, resource_type, "elasticache", region: @
|
|
112
|
+
resource_name: MU::Cloud::AWS::CacheCluster.getARN(resource, resource_type, "elasticache", region: @region, credentials: @credentials),
|
|
113
113
|
tags: allTags
|
|
114
114
|
)
|
|
115
115
|
end
|
|
@@ -170,12 +170,12 @@ module MU
|
|
|
170
170
|
# config_struct[:preferred_cache_cluster_a_zs] = @config["preferred_cache_cluster_azs"]
|
|
171
171
|
|
|
172
172
|
MU.log "Creating cache replication group #{@config['identifier']}"
|
|
173
|
-
MU::Cloud::AWS.elasticache(region: @
|
|
173
|
+
MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).create_replication_group(config_struct).replication_group
|
|
174
174
|
|
|
175
175
|
wait_start_time = Time.now
|
|
176
176
|
retries = 0
|
|
177
177
|
begin
|
|
178
|
-
MU::Cloud::AWS.elasticache(region: @
|
|
178
|
+
MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).wait_until(:replication_group_available, replication_group_id: @config['identifier']) do |waiter|
|
|
179
179
|
waiter.max_attempts = nil
|
|
180
180
|
waiter.before_attempt do |attempts|
|
|
181
181
|
MU.log "Waiting for cache replication group #{@config['identifier']} to become available", MU::NOTICE if attempts % 5 == 0
|
|
@@ -192,11 +192,11 @@ module MU
|
|
|
192
192
|
retry
|
|
193
193
|
end
|
|
194
194
|
|
|
195
|
-
resp = MU::Cloud::AWS::CacheCluster.getCacheReplicationGroupById(@config['identifier'], region: @
|
|
195
|
+
resp = MU::Cloud::AWS::CacheCluster.getCacheReplicationGroupById(@config['identifier'], region: @region)
|
|
196
196
|
|
|
197
197
|
# We want to make sure the clusters in the cache replication group get our tags
|
|
198
198
|
resp.member_clusters.each { |member|
|
|
199
|
-
addStandardTags(member, "cluster", region: @
|
|
199
|
+
addStandardTags(member, "cluster", region: @region)
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
MU::Cloud.resourceClass("AWS", "DNSZone").genericMuDNSEntry(
|
|
@@ -228,7 +228,7 @@ module MU
|
|
|
228
228
|
|
|
229
229
|
MU.log "Creating cache cluster #{@config['identifier']}"
|
|
230
230
|
begin
|
|
231
|
-
MU::Cloud::AWS.elasticache(region: @
|
|
231
|
+
MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).create_cache_cluster(config_struct).cache_cluster
|
|
232
232
|
rescue ::Aws::ElastiCache::Errors::InvalidParameterValue => e
|
|
233
233
|
if e.message.match(/security group (sg-[^\s]+)/)
|
|
234
234
|
bad_sg = Regexp.last_match[1]
|
|
@@ -243,7 +243,7 @@ module MU
|
|
|
243
243
|
wait_start_time = Time.now
|
|
244
244
|
retries = 0
|
|
245
245
|
begin
|
|
246
|
-
MU::Cloud::AWS.elasticache(region: @
|
|
246
|
+
MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).wait_until(:cache_cluster_available, cache_cluster_id: @config['identifier']) do |waiter|
|
|
247
247
|
waiter.max_attempts = nil
|
|
248
248
|
waiter.before_attempt do |attempts|
|
|
249
249
|
MU.log "Waiting for cache cluster #{@config['identifier']} to become available", MU::NOTICE if attempts % 5 == 0
|
|
@@ -260,7 +260,7 @@ module MU
|
|
|
260
260
|
retry
|
|
261
261
|
end
|
|
262
262
|
|
|
263
|
-
resp = MU::Cloud::AWS::CacheCluster.getCacheClusterById(@config['identifier'], region: @
|
|
263
|
+
resp = MU::Cloud::AWS::CacheCluster.getCacheClusterById(@config['identifier'], region: @region, credentials: @credentials)
|
|
264
264
|
MU.log "Cache Cluster #{@config['identifier']} is ready to use"
|
|
265
265
|
@cloud_id = resp.cache_cluster_id
|
|
266
266
|
end
|
|
@@ -291,10 +291,10 @@ module MU
|
|
|
291
291
|
# If we didn't specify a VPC try to figure out if the account has a default VPC
|
|
292
292
|
vpc_id = nil
|
|
293
293
|
subnets = []
|
|
294
|
-
MU::Cloud::AWS.ec2(region: @
|
|
294
|
+
MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_vpcs.vpcs.each { |vpc|
|
|
295
295
|
if vpc.is_default
|
|
296
296
|
vpc_id = vpc.vpc_id
|
|
297
|
-
subnets = MU::Cloud::AWS.ec2(region: @
|
|
297
|
+
subnets = MU::Cloud::AWS.ec2(region: @region, credentials: @credentials).describe_subnets(
|
|
298
298
|
filters: [
|
|
299
299
|
{
|
|
300
300
|
name: "vpc-id",
|
|
@@ -327,7 +327,7 @@ module MU
|
|
|
327
327
|
else
|
|
328
328
|
MU.log "Creating subnet group #{@config["subnet_group_name"]} for cache cluster #{@config['identifier']}"
|
|
329
329
|
|
|
330
|
-
MU::Cloud::AWS.elasticache(region: @
|
|
330
|
+
MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).create_cache_subnet_group(
|
|
331
331
|
cache_subnet_group_name: @config["subnet_group_name"],
|
|
332
332
|
cache_subnet_group_description: @config["subnet_group_name"],
|
|
333
333
|
subnet_ids: subnet_ids
|
|
@@ -347,7 +347,7 @@ module MU
|
|
|
347
347
|
# Create a Cache Cluster parameter group.
|
|
348
348
|
def createParameterGroup
|
|
349
349
|
MU.log "Creating a cache cluster parameter group #{@config["parameter_group_name"]}"
|
|
350
|
-
MU::Cloud::AWS.elasticache(region: @
|
|
350
|
+
MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).create_cache_parameter_group(
|
|
351
351
|
cache_parameter_group_name: @config["parameter_group_name"],
|
|
352
352
|
cache_parameter_group_family: @config["parameter_group_family"],
|
|
353
353
|
description: "Parameter group for #{@config["parameter_group_family"]}"
|
|
@@ -360,7 +360,7 @@ module MU
|
|
|
360
360
|
}
|
|
361
361
|
|
|
362
362
|
MU.log "Modifiying cache cluster parameter group #{@config["parameter_group_name"]}"
|
|
363
|
-
MU::Cloud::AWS.elasticache(region: @
|
|
363
|
+
MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).modify_cache_parameter_group(
|
|
364
364
|
cache_parameter_group_name: @config["parameter_group_name"],
|
|
365
365
|
parameter_name_values: params
|
|
366
366
|
)
|
|
@@ -370,7 +370,7 @@ module MU
|
|
|
370
370
|
# Retrieve a Cache Cluster parameter group name of on existing parameter group.
|
|
371
371
|
# @return [String]: Cache Cluster parameter group name.
|
|
372
372
|
def getParameterGroup
|
|
373
|
-
MU::Cloud::AWS.elasticache(region: @
|
|
373
|
+
MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).describe_cache_parameter_groups(
|
|
374
374
|
cache_parameter_group_name: @config["parameter_group_name"]
|
|
375
375
|
).cache_parameter_groups.first.cache_parameter_group_name
|
|
376
376
|
end
|
|
@@ -404,7 +404,7 @@ module MU
|
|
|
404
404
|
def notify
|
|
405
405
|
### TO DO: Flatten the replication group deployment metadata structure. It is probably waaaaaaay too nested.
|
|
406
406
|
if @config["create_replication_group"]
|
|
407
|
-
repl_group = MU::Cloud::AWS::CacheCluster.getCacheReplicationGroupById(@config['identifier'], region: @
|
|
407
|
+
repl_group = MU::Cloud::AWS::CacheCluster.getCacheReplicationGroupById(@config['identifier'], region: @region, credentials: @credentials)
|
|
408
408
|
# DNS records for the "real" zone should always be registered as late as possible so override_existing only overwrites the records after the resource is ready to use.
|
|
409
409
|
if @config['dns_records']
|
|
410
410
|
@config['dns_records'].each { |dnsrec|
|
|
@@ -418,7 +418,7 @@ module MU
|
|
|
418
418
|
deploy_struct = {
|
|
419
419
|
"identifier" => repl_group.replication_group_id,
|
|
420
420
|
"create_style" => @config["create_style"],
|
|
421
|
-
"region" => @
|
|
421
|
+
"region" => @region,
|
|
422
422
|
"members" => repl_group.member_clusters,
|
|
423
423
|
"automatic_failover" => repl_group.automatic_failover,
|
|
424
424
|
"snapshotting_cluster_id" => repl_group.snapshotting_cluster_id,
|
|
@@ -427,7 +427,7 @@ module MU
|
|
|
427
427
|
}
|
|
428
428
|
|
|
429
429
|
repl_group.member_clusters.each { |id|
|
|
430
|
-
cluster = MU::Cloud::AWS::CacheCluster.getCacheClusterById(id, region: @
|
|
430
|
+
cluster = MU::Cloud::AWS::CacheCluster.getCacheClusterById(id, region: @region)
|
|
431
431
|
|
|
432
432
|
vpc_sg_ids = []
|
|
433
433
|
cluster.security_groups.each { |vpc_sg|
|
|
@@ -468,7 +468,7 @@ module MU
|
|
|
468
468
|
deploy_struct[member.cache_cluster_id]["current_role"] = member.current_role
|
|
469
469
|
}
|
|
470
470
|
else
|
|
471
|
-
cluster = MU::Cloud::AWS::CacheCluster.getCacheClusterById(@config['identifier'], region: @
|
|
471
|
+
cluster = MU::Cloud::AWS::CacheCluster.getCacheClusterById(@config['identifier'], region: @region, credentials: @credentials)
|
|
472
472
|
|
|
473
473
|
vpc_sg_ids = []
|
|
474
474
|
cluster.security_groups.each { |vpc_sg|
|
|
@@ -515,7 +515,7 @@ module MU
|
|
|
515
515
|
|
|
516
516
|
attempts = 0
|
|
517
517
|
begin
|
|
518
|
-
MU::Cloud::AWS.elasticache(region: @
|
|
518
|
+
MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).create_snapshot(
|
|
519
519
|
cache_cluster_id: @config["identifier"],
|
|
520
520
|
snapshot_name: snap_id
|
|
521
521
|
)
|
|
@@ -535,7 +535,7 @@ module MU
|
|
|
535
535
|
MU.log "Waiting for snapshot of cache cluster #{@config["identifier"]} to be ready...", MU::NOTICE if attempts % 20 == 0
|
|
536
536
|
MU.log "Waiting for snapshot of cache cluster #{@config["identifier"]} to be ready...", MU::DEBUG
|
|
537
537
|
|
|
538
|
-
snapshot_resp = MU::Cloud::AWS.elasticache(region: @
|
|
538
|
+
snapshot_resp = MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).describe_snapshots(snapshot_name: snap_id)
|
|
539
539
|
attempts += 1
|
|
540
540
|
break unless snapshot_resp.snapshots.first.snapshot_status != "available"
|
|
541
541
|
sleep 15
|
|
@@ -546,7 +546,7 @@ module MU
|
|
|
546
546
|
|
|
547
547
|
# @return [String]: The cloud provider's identifier for the snapshot.
|
|
548
548
|
def getExistingSnapshot
|
|
549
|
-
MU::Cloud::AWS.elasticache(region: @
|
|
549
|
+
MU::Cloud::AWS.elasticache(region: @region, credentials: @credentials).describe_snapshots(snapshot_name: @config["identifier"]).snapshots.first.snapshot_name
|
|
550
550
|
rescue NoMethodError
|
|
551
551
|
raise MuError, "Snapshot #{@config["identifier"]} doesn't exist, make sure you provided a valid snapshot ID/Name"
|
|
552
552
|
end
|
|
@@ -227,7 +227,7 @@ module MU
|
|
|
227
227
|
def toKitten(**_args)
|
|
228
228
|
bok = {
|
|
229
229
|
"cloud" => "AWS",
|
|
230
|
-
"credentials" => @
|
|
230
|
+
"credentials" => @credentials,
|
|
231
231
|
"cloud_id" => @cloud_id
|
|
232
232
|
}
|
|
233
233
|
|
|
@@ -512,7 +512,7 @@ module MU
|
|
|
512
512
|
end
|
|
513
513
|
target_ref = MU::Config::Ref.get(o[sib_type])
|
|
514
514
|
if target_ref.name
|
|
515
|
-
MU::Config.addDependency(cdn, target_ref.name, sib_type,
|
|
515
|
+
MU::Config.addDependency(cdn, target_ref.name, sib_type, their_phase: "groom")
|
|
516
516
|
end
|
|
517
517
|
count += 1
|
|
518
518
|
end
|
|
@@ -25,15 +25,15 @@ module MU
|
|
|
25
25
|
def initialize(**args)
|
|
26
26
|
super
|
|
27
27
|
@mu_name ||= @deploy.getResourceName(@config['name'], need_unique_string: true)
|
|
28
|
-
MU.setVar("curRegion", @
|
|
28
|
+
MU.setVar("curRegion", @region) if !@region.nil?
|
|
29
29
|
end
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
# Called automatically by {MU::Deploy#createResources}
|
|
33
33
|
def create
|
|
34
34
|
flag="SUCCESS"
|
|
35
|
-
MU.setVar("curRegion", @
|
|
36
|
-
region = @
|
|
35
|
+
MU.setVar("curRegion", @region) if !@region.nil?
|
|
36
|
+
region = @region
|
|
37
37
|
server=@config["name"]
|
|
38
38
|
stack_name = getStackName(@config["name"])
|
|
39
39
|
|
|
@@ -108,10 +108,10 @@ module MU
|
|
|
108
108
|
end
|
|
109
109
|
|
|
110
110
|
MU.log "Creating CloudFormation stack '#{@config['name']}'", details: stack_descriptor
|
|
111
|
-
MU::Cloud::AWS.cloudformation(region: region, credentials: @
|
|
111
|
+
MU::Cloud::AWS.cloudformation(region: region, credentials: @credentials).create_stack(stack_descriptor);
|
|
112
112
|
|
|
113
113
|
sleep(10);
|
|
114
|
-
stack_response = MU::Cloud::AWS.cloudformation(region: region, credentials: @
|
|
114
|
+
stack_response = MU::Cloud::AWS.cloudformation(region: region, credentials: @credentials).describe_stacks({:stack_name => stack_name}).stacks.first
|
|
115
115
|
attempts = 0
|
|
116
116
|
begin
|
|
117
117
|
if attempts % 5 == 0
|
|
@@ -119,7 +119,7 @@ module MU
|
|
|
119
119
|
else
|
|
120
120
|
MU.log "Waiting for CloudFormation stack '#{@config['name']}' to be ready...", MU::DEBUG
|
|
121
121
|
end
|
|
122
|
-
stack_response =MU::Cloud::AWS.cloudformation(region: region, credentials: @
|
|
122
|
+
stack_response =MU::Cloud::AWS.cloudformation(region: region, credentials: @credentials).describe_stacks({:stack_name => stack_name}).stacks.first
|
|
123
123
|
sleep 60
|
|
124
124
|
end while stack_response.stack_status == "CREATE_IN_PROGRESS"
|
|
125
125
|
|
|
@@ -135,14 +135,14 @@ module MU
|
|
|
135
135
|
end
|
|
136
136
|
|
|
137
137
|
if flag == "FAIL" then
|
|
138
|
-
MU::Cloud::AWS.cloudformation(region: region, credentials: @
|
|
138
|
+
MU::Cloud::AWS.cloudformation(region: region, credentials: @credentials).delete_stack({:stack_name => stack_name})
|
|
139
139
|
exit 1
|
|
140
140
|
end
|
|
141
141
|
|
|
142
142
|
MU.log "CloudFormation stack '#{@config['name']}' complete"
|
|
143
143
|
|
|
144
144
|
begin
|
|
145
|
-
resources = MU::Cloud::AWS.cloudformation(region: region, credentials: @
|
|
145
|
+
resources = MU::Cloud::AWS.cloudformation(region: region, credentials: @credentials).describe_stack_resources(:stack_name => stack_name)
|
|
146
146
|
|
|
147
147
|
resources[:stack_resources].each { |resource|
|
|
148
148
|
|
|
@@ -150,7 +150,7 @@ module MU
|
|
|
150
150
|
when "AWS::EC2::Instance"
|
|
151
151
|
MU::Cloud::AWS.createStandardTags(resource.physical_resource_id)
|
|
152
152
|
instance_name = MU.deploy_id+"-"+@config['name']+"-"+resource.logical_resource_id
|
|
153
|
-
MU::Cloud::AWS.createTag(resource.physical_resource_id, "Name", instance_name, credentials: @
|
|
153
|
+
MU::Cloud::AWS.createTag(resource.physical_resource_id, "Name", instance_name, credentials: @credentials)
|
|
154
154
|
|
|
155
155
|
instance = MU::Cloud.resourceClass("AWS", "Server").notifyDeploy(
|
|
156
156
|
@config['name']+"-"+resource.logical_resource_id,
|
|
@@ -177,14 +177,14 @@ module MU
|
|
|
177
177
|
|
|
178
178
|
when "AWS::EC2::SecurityGroup"
|
|
179
179
|
MU::Cloud::AWS.createStandardTags(resource.physical_resource_id)
|
|
180
|
-
MU::Cloud::AWS.createTag(resource.physical_resource_id, "Name", MU.deploy_id+"-"+@config['name']+'-'+resource.logical_resource_id, credentials: @
|
|
180
|
+
MU::Cloud::AWS.createTag(resource.physical_resource_id, "Name", MU.deploy_id+"-"+@config['name']+'-'+resource.logical_resource_id, credentials: @credentials)
|
|
181
181
|
MU::Cloud.resourceClass("AWS", "FirewallRule").notifyDeploy(
|
|
182
182
|
@config['name']+"-"+resource.logical_resource_id,
|
|
183
183
|
resource.physical_resource_id
|
|
184
184
|
)
|
|
185
185
|
when "AWS::EC2::Subnet"
|
|
186
186
|
MU::Cloud::AWS.createStandardTags(resource.physical_resource_id)
|
|
187
|
-
MU::Cloud::AWS.createTag(resource.physical_resource_id, "Name", MU.deploy_id+"-"+@config['name']+'-'+resource.logical_resource_id, credentials: @
|
|
187
|
+
MU::Cloud::AWS.createTag(resource.physical_resource_id, "Name", MU.deploy_id+"-"+@config['name']+'-'+resource.logical_resource_id, credentials: @credentials)
|
|
188
188
|
data = {
|
|
189
189
|
"collection" => @config["name"],
|
|
190
190
|
"subnet_id" => resource.physical_resource_id,
|
|
@@ -192,7 +192,7 @@ module MU
|
|
|
192
192
|
@deploy.notify("subnets", @config['name']+"-"+resource.logical_resource_id, data)
|
|
193
193
|
when "AWS::EC2::VPC"
|
|
194
194
|
MU::Cloud::AWS.createStandardTags(resource.physical_resource_id)
|
|
195
|
-
MU::Cloud::AWS.createTag(resource.physical_resource_id, "Name", MU.deploy_id+"-"+@config['name']+'-'+resource.logical_resource_id, credentials: @
|
|
195
|
+
MU::Cloud::AWS.createTag(resource.physical_resource_id, "Name", MU.deploy_id+"-"+@config['name']+'-'+resource.logical_resource_id, credentials: @credentials)
|
|
196
196
|
data = {
|
|
197
197
|
"collection" => @config["name"],
|
|
198
198
|
"vpc_id" => resource.physical_resource_id,
|
|
@@ -200,10 +200,10 @@ module MU
|
|
|
200
200
|
@deploy.notify("vpcs", @config['name']+"-"+resource.logical_resource_id, data)
|
|
201
201
|
when "AWS::EC2::InternetGateway"
|
|
202
202
|
MU::Cloud::AWS.createStandardTags(resource.physical_resource_id)
|
|
203
|
-
MU::Cloud::AWS.createTag(resource.physical_resource_id, "Name", MU.deploy_id+"-"+@config['name']+'-'+resource.logical_resource_id, credentials: @
|
|
203
|
+
MU::Cloud::AWS.createTag(resource.physical_resource_id, "Name", MU.deploy_id+"-"+@config['name']+'-'+resource.logical_resource_id, credentials: @credentials)
|
|
204
204
|
when "AWS::EC2::RouteTable"
|
|
205
205
|
MU::Cloud::AWS.createStandardTags(resource.physical_resource_id)
|
|
206
|
-
MU::Cloud::AWS.createTag(resource.physical_resource_id, "Name", MU.deploy_id+"-"+@config['name']+'-'+resource.logical_resource_id, credentials: @
|
|
206
|
+
MU::Cloud::AWS.createTag(resource.physical_resource_id, "Name", MU.deploy_id+"-"+@config['name']+'-'+resource.logical_resource_id, credentials: @credentials)
|
|
207
207
|
|
|
208
208
|
# The rest of these aren't anything we act on
|
|
209
209
|
when "AWS::EC2::Route"
|