cloud-mu 2.1.0beta → 3.0.0beta
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 +5 -5
- data/Berksfile +4 -5
- data/Berksfile.lock +179 -0
- data/README.md +1 -6
- data/ansible/roles/geerlingguy.firewall/templates/firewall.bash.j2 +0 -0
- data/ansible/roles/mu-installer/README.md +33 -0
- data/ansible/roles/mu-installer/defaults/main.yml +2 -0
- data/ansible/roles/mu-installer/handlers/main.yml +2 -0
- data/ansible/roles/mu-installer/meta/main.yml +60 -0
- data/ansible/roles/mu-installer/tasks/main.yml +13 -0
- data/ansible/roles/mu-installer/tests/inventory +2 -0
- data/ansible/roles/mu-installer/tests/test.yml +5 -0
- data/ansible/roles/mu-installer/vars/main.yml +2 -0
- data/bin/mu-adopt +125 -0
- data/bin/mu-aws-setup +4 -4
- data/bin/mu-azure-setup +265 -0
- data/bin/mu-azure-tests +43 -0
- data/bin/mu-cleanup +20 -8
- data/bin/mu-configure +224 -98
- data/bin/mu-deploy +8 -3
- data/bin/mu-gcp-setup +16 -8
- data/bin/mu-gen-docs +92 -8
- data/bin/mu-load-config.rb +52 -12
- data/bin/mu-momma-cat +36 -0
- data/bin/mu-node-manage +34 -27
- data/bin/mu-self-update +2 -2
- data/bin/mu-ssh +12 -8
- data/bin/mu-upload-chef-artifacts +11 -4
- data/bin/mu-user-manage +3 -0
- data/cloud-mu.gemspec +8 -11
- data/cookbooks/firewall/libraries/helpers_iptables.rb +2 -2
- data/cookbooks/firewall/metadata.json +1 -1
- data/cookbooks/firewall/recipes/default.rb +5 -9
- data/cookbooks/mu-firewall/attributes/default.rb +2 -0
- data/cookbooks/mu-firewall/metadata.rb +1 -1
- data/cookbooks/mu-glusterfs/templates/default/mu-gluster-client.erb +0 -0
- data/cookbooks/mu-master/Berksfile +2 -2
- data/cookbooks/mu-master/files/default/check_mem.pl +0 -0
- data/cookbooks/mu-master/files/default/cloudamatic.png +0 -0
- data/cookbooks/mu-master/metadata.rb +5 -4
- data/cookbooks/mu-master/recipes/389ds.rb +1 -1
- data/cookbooks/mu-master/recipes/basepackages.rb +30 -10
- data/cookbooks/mu-master/recipes/default.rb +59 -7
- data/cookbooks/mu-master/recipes/firewall-holes.rb +1 -1
- data/cookbooks/mu-master/recipes/init.rb +65 -47
- data/cookbooks/mu-master/recipes/{eks-kubectl.rb → kubectl.rb} +4 -10
- data/cookbooks/mu-master/recipes/sssd.rb +2 -1
- data/cookbooks/mu-master/recipes/update_nagios_only.rb +6 -6
- data/cookbooks/mu-master/templates/default/web_app.conf.erb +2 -2
- data/cookbooks/mu-master/templates/mods/ldap.conf.erb +4 -0
- data/cookbooks/mu-php54/Berksfile +1 -2
- data/cookbooks/mu-php54/metadata.rb +4 -5
- data/cookbooks/mu-php54/recipes/default.rb +1 -1
- data/cookbooks/mu-splunk/templates/default/splunk-init.erb +0 -0
- data/cookbooks/mu-tools/Berksfile +3 -2
- data/cookbooks/mu-tools/files/default/Mu_CA.pem +33 -0
- data/cookbooks/mu-tools/libraries/helper.rb +20 -8
- data/cookbooks/mu-tools/metadata.rb +5 -2
- data/cookbooks/mu-tools/recipes/apply_security.rb +2 -3
- data/cookbooks/mu-tools/recipes/eks.rb +1 -1
- data/cookbooks/mu-tools/recipes/gcloud.rb +5 -30
- data/cookbooks/mu-tools/recipes/nagios.rb +1 -1
- data/cookbooks/mu-tools/recipes/rsyslog.rb +1 -0
- data/cookbooks/mu-tools/recipes/selinux.rb +19 -0
- data/cookbooks/mu-tools/recipes/split_var_partitions.rb +0 -1
- data/cookbooks/mu-tools/recipes/windows-client.rb +256 -122
- data/cookbooks/mu-tools/resources/disk.rb +3 -1
- data/cookbooks/mu-tools/templates/amazon/sshd_config.erb +1 -1
- data/cookbooks/mu-tools/templates/default/etc_hosts.erb +1 -1
- data/cookbooks/mu-tools/templates/default/{kubeconfig.erb → kubeconfig-eks.erb} +0 -0
- data/cookbooks/mu-tools/templates/default/kubeconfig-gke.erb +27 -0
- data/cookbooks/mu-tools/templates/windows-10/sshd_config.erb +137 -0
- data/cookbooks/mu-utility/recipes/nat.rb +4 -0
- data/extras/alpha.png +0 -0
- data/extras/beta.png +0 -0
- data/extras/clean-stock-amis +2 -2
- data/extras/generate-stock-images +131 -0
- data/extras/git-fix-permissions-hook +0 -0
- data/extras/image-generators/AWS/centos6.yaml +17 -0
- data/extras/image-generators/{aws → AWS}/centos7-govcloud.yaml +0 -0
- data/extras/image-generators/{aws → AWS}/centos7.yaml +0 -0
- data/extras/image-generators/{aws → AWS}/rhel7.yaml +0 -0
- data/extras/image-generators/{aws → AWS}/win2k12.yaml +0 -0
- data/extras/image-generators/{aws → AWS}/win2k16.yaml +0 -0
- data/extras/image-generators/{aws → AWS}/windows.yaml +0 -0
- data/extras/image-generators/{gcp → Google}/centos6.yaml +1 -0
- data/extras/image-generators/Google/centos7.yaml +18 -0
- data/extras/python_rpm/build.sh +0 -0
- data/extras/release.png +0 -0
- data/extras/ruby_rpm/build.sh +0 -0
- data/extras/ruby_rpm/muby.spec +1 -1
- data/install/README.md +43 -5
- data/install/deprecated-bash-library.sh +0 -0
- data/install/installer +1 -1
- data/install/jenkinskeys.rb +0 -0
- data/install/mu-master.yaml +55 -0
- data/modules/mommacat.ru +41 -7
- data/modules/mu.rb +444 -149
- data/modules/mu/adoption.rb +500 -0
- data/modules/mu/cleanup.rb +235 -158
- data/modules/mu/cloud.rb +675 -138
- data/modules/mu/clouds/aws.rb +156 -24
- data/modules/mu/clouds/aws/alarm.rb +4 -14
- data/modules/mu/clouds/aws/bucket.rb +60 -18
- data/modules/mu/clouds/aws/cache_cluster.rb +8 -20
- data/modules/mu/clouds/aws/collection.rb +12 -22
- data/modules/mu/clouds/aws/container_cluster.rb +209 -118
- data/modules/mu/clouds/aws/database.rb +120 -45
- data/modules/mu/clouds/aws/dnszone.rb +7 -18
- data/modules/mu/clouds/aws/endpoint.rb +5 -15
- data/modules/mu/clouds/aws/firewall_rule.rb +144 -72
- data/modules/mu/clouds/aws/folder.rb +4 -11
- data/modules/mu/clouds/aws/function.rb +6 -16
- data/modules/mu/clouds/aws/group.rb +4 -12
- data/modules/mu/clouds/aws/habitat.rb +11 -13
- data/modules/mu/clouds/aws/loadbalancer.rb +40 -28
- data/modules/mu/clouds/aws/log.rb +5 -13
- data/modules/mu/clouds/aws/msg_queue.rb +9 -24
- data/modules/mu/clouds/aws/nosqldb.rb +4 -12
- data/modules/mu/clouds/aws/notifier.rb +6 -13
- data/modules/mu/clouds/aws/role.rb +69 -40
- data/modules/mu/clouds/aws/search_domain.rb +17 -20
- data/modules/mu/clouds/aws/server.rb +184 -94
- data/modules/mu/clouds/aws/server_pool.rb +33 -38
- data/modules/mu/clouds/aws/storage_pool.rb +5 -12
- data/modules/mu/clouds/aws/user.rb +59 -33
- data/modules/mu/clouds/aws/userdata/linux.erb +18 -30
- data/modules/mu/clouds/aws/userdata/windows.erb +9 -9
- data/modules/mu/clouds/aws/vpc.rb +214 -145
- data/modules/mu/clouds/azure.rb +978 -44
- data/modules/mu/clouds/azure/container_cluster.rb +413 -0
- data/modules/mu/clouds/azure/firewall_rule.rb +500 -0
- data/modules/mu/clouds/azure/habitat.rb +167 -0
- data/modules/mu/clouds/azure/loadbalancer.rb +205 -0
- data/modules/mu/clouds/azure/role.rb +211 -0
- data/modules/mu/clouds/azure/server.rb +810 -0
- data/modules/mu/clouds/azure/user.rb +257 -0
- data/modules/mu/clouds/azure/userdata/README.md +4 -0
- data/modules/mu/clouds/azure/userdata/linux.erb +137 -0
- data/modules/mu/clouds/azure/userdata/windows.erb +275 -0
- data/modules/mu/clouds/azure/vpc.rb +782 -0
- data/modules/mu/clouds/cloudformation.rb +12 -9
- data/modules/mu/clouds/cloudformation/firewall_rule.rb +5 -13
- data/modules/mu/clouds/cloudformation/server.rb +10 -1
- data/modules/mu/clouds/cloudformation/server_pool.rb +1 -0
- data/modules/mu/clouds/cloudformation/vpc.rb +0 -2
- data/modules/mu/clouds/google.rb +554 -117
- data/modules/mu/clouds/google/bucket.rb +173 -32
- data/modules/mu/clouds/google/container_cluster.rb +1112 -157
- data/modules/mu/clouds/google/database.rb +24 -47
- data/modules/mu/clouds/google/firewall_rule.rb +344 -89
- data/modules/mu/clouds/google/folder.rb +156 -79
- data/modules/mu/clouds/google/group.rb +272 -82
- data/modules/mu/clouds/google/habitat.rb +177 -52
- data/modules/mu/clouds/google/loadbalancer.rb +9 -34
- data/modules/mu/clouds/google/role.rb +1211 -0
- data/modules/mu/clouds/google/server.rb +491 -227
- data/modules/mu/clouds/google/server_pool.rb +233 -48
- data/modules/mu/clouds/google/user.rb +479 -125
- data/modules/mu/clouds/google/userdata/linux.erb +3 -3
- data/modules/mu/clouds/google/userdata/windows.erb +9 -9
- data/modules/mu/clouds/google/vpc.rb +381 -223
- data/modules/mu/config.rb +689 -214
- data/modules/mu/config/bucket.rb +1 -1
- data/modules/mu/config/cache_cluster.rb +1 -1
- data/modules/mu/config/cache_cluster.yml +0 -4
- data/modules/mu/config/container_cluster.rb +18 -9
- data/modules/mu/config/database.rb +6 -23
- data/modules/mu/config/firewall_rule.rb +9 -15
- data/modules/mu/config/folder.rb +22 -21
- data/modules/mu/config/habitat.rb +22 -21
- data/modules/mu/config/loadbalancer.rb +2 -2
- data/modules/mu/config/role.rb +9 -40
- data/modules/mu/config/server.rb +26 -5
- data/modules/mu/config/server_pool.rb +1 -1
- data/modules/mu/config/storage_pool.rb +2 -2
- data/modules/mu/config/user.rb +4 -0
- data/modules/mu/config/vpc.rb +350 -110
- data/modules/mu/defaults/{amazon_images.yaml → AWS.yaml} +37 -39
- data/modules/mu/defaults/Azure.yaml +17 -0
- data/modules/mu/defaults/Google.yaml +24 -0
- data/modules/mu/defaults/README.md +1 -1
- data/modules/mu/deploy.rb +168 -125
- data/modules/mu/groomer.rb +2 -1
- data/modules/mu/groomers/ansible.rb +104 -32
- data/modules/mu/groomers/chef.rb +96 -44
- data/modules/mu/kittens.rb +20602 -0
- data/modules/mu/logger.rb +38 -11
- data/modules/mu/master.rb +90 -8
- data/modules/mu/master/chef.rb +2 -3
- data/modules/mu/master/ldap.rb +0 -1
- data/modules/mu/master/ssl.rb +250 -0
- data/modules/mu/mommacat.rb +917 -513
- data/modules/scratchpad.erb +1 -1
- data/modules/tests/super_complex_bok.yml +0 -0
- data/modules/tests/super_simple_bok.yml +0 -0
- data/roles/mu-master.json +2 -1
- data/spec/azure_creds +5 -0
- data/spec/mu.yaml +56 -0
- data/spec/mu/clouds/azure_spec.rb +164 -27
- data/spec/spec_helper.rb +5 -0
- data/test/clean_up.py +0 -0
- data/test/exec_inspec.py +0 -0
- data/test/exec_mu_install.py +0 -0
- data/test/exec_retry.py +0 -0
- data/test/smoke_test.rb +0 -0
- metadata +90 -118
- data/cookbooks/mu-jenkins/Berksfile +0 -14
- data/cookbooks/mu-jenkins/CHANGELOG.md +0 -13
- data/cookbooks/mu-jenkins/LICENSE +0 -37
- data/cookbooks/mu-jenkins/README.md +0 -105
- data/cookbooks/mu-jenkins/attributes/default.rb +0 -42
- data/cookbooks/mu-jenkins/files/default/cleanup_deploy_config.xml +0 -73
- data/cookbooks/mu-jenkins/files/default/deploy_config.xml +0 -44
- data/cookbooks/mu-jenkins/metadata.rb +0 -21
- data/cookbooks/mu-jenkins/recipes/default.rb +0 -195
- data/cookbooks/mu-jenkins/recipes/node-ssh-config.rb +0 -54
- data/cookbooks/mu-jenkins/recipes/public_key.rb +0 -24
- data/cookbooks/mu-jenkins/templates/default/example_job.config.xml.erb +0 -24
- data/cookbooks/mu-jenkins/templates/default/org.jvnet.hudson.plugins.SSHBuildWrapper.xml.erb +0 -14
- data/cookbooks/mu-jenkins/templates/default/ssh_config.erb +0 -6
- data/cookbooks/nagios/Berksfile +0 -11
- data/cookbooks/nagios/CHANGELOG.md +0 -589
- data/cookbooks/nagios/CONTRIBUTING.md +0 -11
- data/cookbooks/nagios/LICENSE +0 -37
- data/cookbooks/nagios/README.md +0 -328
- data/cookbooks/nagios/TESTING.md +0 -2
- data/cookbooks/nagios/attributes/config.rb +0 -171
- data/cookbooks/nagios/attributes/default.rb +0 -228
- data/cookbooks/nagios/chefignore +0 -102
- data/cookbooks/nagios/definitions/command.rb +0 -33
- data/cookbooks/nagios/definitions/contact.rb +0 -33
- data/cookbooks/nagios/definitions/contactgroup.rb +0 -33
- data/cookbooks/nagios/definitions/host.rb +0 -33
- data/cookbooks/nagios/definitions/hostdependency.rb +0 -33
- data/cookbooks/nagios/definitions/hostescalation.rb +0 -34
- data/cookbooks/nagios/definitions/hostgroup.rb +0 -33
- data/cookbooks/nagios/definitions/nagios_conf.rb +0 -38
- data/cookbooks/nagios/definitions/resource.rb +0 -33
- data/cookbooks/nagios/definitions/service.rb +0 -33
- data/cookbooks/nagios/definitions/servicedependency.rb +0 -33
- data/cookbooks/nagios/definitions/serviceescalation.rb +0 -34
- data/cookbooks/nagios/definitions/servicegroup.rb +0 -33
- data/cookbooks/nagios/definitions/timeperiod.rb +0 -33
- data/cookbooks/nagios/libraries/base.rb +0 -314
- data/cookbooks/nagios/libraries/command.rb +0 -91
- data/cookbooks/nagios/libraries/contact.rb +0 -230
- data/cookbooks/nagios/libraries/contactgroup.rb +0 -112
- data/cookbooks/nagios/libraries/custom_option.rb +0 -36
- data/cookbooks/nagios/libraries/data_bag_helper.rb +0 -23
- data/cookbooks/nagios/libraries/default.rb +0 -90
- data/cookbooks/nagios/libraries/host.rb +0 -412
- data/cookbooks/nagios/libraries/hostdependency.rb +0 -181
- data/cookbooks/nagios/libraries/hostescalation.rb +0 -173
- data/cookbooks/nagios/libraries/hostgroup.rb +0 -119
- data/cookbooks/nagios/libraries/nagios.rb +0 -282
- data/cookbooks/nagios/libraries/resource.rb +0 -59
- data/cookbooks/nagios/libraries/service.rb +0 -455
- data/cookbooks/nagios/libraries/servicedependency.rb +0 -215
- data/cookbooks/nagios/libraries/serviceescalation.rb +0 -195
- data/cookbooks/nagios/libraries/servicegroup.rb +0 -144
- data/cookbooks/nagios/libraries/timeperiod.rb +0 -160
- data/cookbooks/nagios/libraries/users_helper.rb +0 -54
- data/cookbooks/nagios/metadata.rb +0 -25
- data/cookbooks/nagios/recipes/_load_databag_config.rb +0 -153
- data/cookbooks/nagios/recipes/_load_default_config.rb +0 -241
- data/cookbooks/nagios/recipes/apache.rb +0 -48
- data/cookbooks/nagios/recipes/default.rb +0 -204
- data/cookbooks/nagios/recipes/nginx.rb +0 -82
- data/cookbooks/nagios/recipes/pagerduty.rb +0 -143
- data/cookbooks/nagios/recipes/server_package.rb +0 -40
- data/cookbooks/nagios/recipes/server_source.rb +0 -164
- data/cookbooks/nagios/templates/default/apache2.conf.erb +0 -96
- data/cookbooks/nagios/templates/default/cgi.cfg.erb +0 -266
- data/cookbooks/nagios/templates/default/commands.cfg.erb +0 -13
- data/cookbooks/nagios/templates/default/contacts.cfg.erb +0 -37
- data/cookbooks/nagios/templates/default/hostgroups.cfg.erb +0 -25
- data/cookbooks/nagios/templates/default/hosts.cfg.erb +0 -15
- data/cookbooks/nagios/templates/default/htpasswd.users.erb +0 -6
- data/cookbooks/nagios/templates/default/nagios.cfg.erb +0 -22
- data/cookbooks/nagios/templates/default/nginx.conf.erb +0 -62
- data/cookbooks/nagios/templates/default/pagerduty.cgi.erb +0 -185
- data/cookbooks/nagios/templates/default/resource.cfg.erb +0 -27
- data/cookbooks/nagios/templates/default/servicedependencies.cfg.erb +0 -15
- data/cookbooks/nagios/templates/default/servicegroups.cfg.erb +0 -14
- data/cookbooks/nagios/templates/default/services.cfg.erb +0 -14
- data/cookbooks/nagios/templates/default/templates.cfg.erb +0 -31
- data/cookbooks/nagios/templates/default/timeperiods.cfg.erb +0 -13
- data/extras/image-generators/aws/centos6.yaml +0 -18
- data/modules/mu/defaults/google_images.yaml +0 -16
- data/roles/mu-master-jenkins.json +0 -24
|
@@ -17,18 +17,11 @@ module MU
|
|
|
17
17
|
class AWS
|
|
18
18
|
# A log as configured in {MU::Config::BasketofKittens::logs}
|
|
19
19
|
class Folder < MU::Cloud::Folder
|
|
20
|
-
@deploy = nil
|
|
21
|
-
@config = nil
|
|
22
|
-
attr_reader :mu_name
|
|
23
|
-
attr_reader :config
|
|
24
|
-
attr_reader :cloud_id
|
|
25
20
|
|
|
26
|
-
#
|
|
27
|
-
# @param
|
|
28
|
-
def initialize(
|
|
29
|
-
|
|
30
|
-
@config = MU::Config.manxify(kitten_cfg)
|
|
31
|
-
@cloud_id ||= cloud_id
|
|
21
|
+
# Initialize this cloud resource object. Calling +super+ will invoke the initializer defined under {MU::Cloud}, which should set the attribtues listed in {MU::Cloud::PUBLIC_ATTRS} as well as applicable dependency shortcuts, like +@vpc+, for us.
|
|
22
|
+
# @param args [Hash]: Hash of named arguments passed via Ruby's double-splat
|
|
23
|
+
def initialize(**args)
|
|
24
|
+
super
|
|
32
25
|
@mu_name ||= @deploy.getResourceName(@config["name"])
|
|
33
26
|
end
|
|
34
27
|
|
|
@@ -17,21 +17,11 @@ module MU
|
|
|
17
17
|
class AWS
|
|
18
18
|
# A function as configured in {MU::Config::BasketofKittens::functions}
|
|
19
19
|
class Function < MU::Cloud::Function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
@cloudformation_data = {}
|
|
27
|
-
attr_reader :cloudformation_data
|
|
28
|
-
|
|
29
|
-
# @param mommacat [MU::MommaCat]: A {MU::Mommacat} object containing the deploy of which this resource is/will be a member.
|
|
30
|
-
# @param kitten_cfg [Hash]: The fully parsed and resolved {MU::Config} resource descriptor as defined in {MU::Config::BasketofKittens::functions}
|
|
31
|
-
def initialize(mommacat: nil, kitten_cfg: nil, mu_name: nil, cloud_id: nil)
|
|
32
|
-
@deploy = mommacat
|
|
33
|
-
@config = MU::Config.manxify(kitten_cfg)
|
|
34
|
-
@cloud_id ||= cloud_id
|
|
20
|
+
|
|
21
|
+
# Initialize this cloud resource object. Calling +super+ will invoke the initializer defined under {MU::Cloud}, which should set the attribtues listed in {MU::Cloud::PUBLIC_ATTRS} as well as applicable dependency shortcuts, like +@vpc+, for us.
|
|
22
|
+
# @param args [Hash]: Hash of named arguments passed via Ruby's double-splat
|
|
23
|
+
def initialize(**args)
|
|
24
|
+
super
|
|
35
25
|
@mu_name ||= @deploy.getResourceName(@config["name"])
|
|
36
26
|
end
|
|
37
27
|
|
|
@@ -245,7 +235,7 @@ module MU
|
|
|
245
235
|
}
|
|
246
236
|
]
|
|
247
237
|
})
|
|
248
|
-
when 'apigateway'
|
|
238
|
+
# when 'apigateway'
|
|
249
239
|
# XXX this is actually happening in ::Endpoint... maybe...
|
|
250
240
|
# MU.log "Creation of API Gateway integrations not yet implemented, you'll have to do this manually", MU::WARN, details: "(because we'll basically have to implement all of APIG for this)"
|
|
251
241
|
end
|
|
@@ -17,19 +17,11 @@ module MU
|
|
|
17
17
|
class AWS
|
|
18
18
|
# A group as configured in {MU::Config::BasketofKittens::groups}
|
|
19
19
|
class Group < MU::Cloud::Group
|
|
20
|
-
@deploy = nil
|
|
21
|
-
@config = nil
|
|
22
|
-
attr_reader :mu_name
|
|
23
|
-
attr_reader :config
|
|
24
|
-
attr_reader :cloud_id
|
|
25
|
-
|
|
26
|
-
# @param mommacat [MU::MommaCat]: A {MU::Mommacat} object containing the deploy of which this resource is/will be a member.
|
|
27
|
-
# @param kitten_cfg [Hash]: The fully parsed and resolved {MU::Config} resource descriptor as defined in {MU::Config::BasketofKittens::groups}
|
|
28
|
-
def initialize(mommacat: nil, kitten_cfg: nil, mu_name: nil, cloud_id: nil)
|
|
29
|
-
@deploy = mommacat
|
|
30
|
-
@config = MU::Config.manxify(kitten_cfg)
|
|
31
|
-
@cloud_id ||= cloud_id
|
|
32
20
|
|
|
21
|
+
# Initialize this cloud resource object. Calling +super+ will invoke the initializer defined under {MU::Cloud}, which should set the attribtues listed in {MU::Cloud::PUBLIC_ATTRS} as well as applicable dependency shortcuts, like +@vpc+, for us.
|
|
22
|
+
# @param args [Hash]: Hash of named arguments passed via Ruby's double-splat
|
|
23
|
+
def initialize(**args)
|
|
24
|
+
super
|
|
33
25
|
@mu_name ||= if @config['unique_name']
|
|
34
26
|
@deploy.getResourceName(@config["name"])
|
|
35
27
|
else
|
|
@@ -17,19 +17,11 @@ module MU
|
|
|
17
17
|
class AWS
|
|
18
18
|
# Creates an AWS account as configured in {MU::Config::BasketofKittens::habitats}
|
|
19
19
|
class Habitat < MU::Cloud::Habitat
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
attr_reader :cloud_id
|
|
26
|
-
|
|
27
|
-
# @param mommacat [MU::MommaCat]: A {MU::Mommacat} object containing the deploy of which this resource is/will be a member.
|
|
28
|
-
# @param kitten_cfg [Hash]: The fully parsed and resolved {MU::Config} resource descriptor as defined in {MU::Config::BasketofKittens::habitats}
|
|
29
|
-
def initialize(mommacat: nil, kitten_cfg: nil, mu_name: nil, cloud_id: nil)
|
|
30
|
-
@deploy = mommacat
|
|
31
|
-
@config = MU::Config.manxify(kitten_cfg)
|
|
32
|
-
@cloud_id ||= cloud_id
|
|
20
|
+
|
|
21
|
+
# Initialize this cloud resource object. Calling +super+ will invoke the initializer defined under {MU::Cloud}, which should set the attribtues listed in {MU::Cloud::PUBLIC_ATTRS} as well as applicable dependency shortcuts, like +@vpc+, for us.
|
|
22
|
+
# @param args [Hash]: Hash of named arguments passed via Ruby's double-splat
|
|
23
|
+
def initialize(**args)
|
|
24
|
+
super
|
|
33
25
|
@mu_name ||= @deploy.getResourceName(@config["name"], max_length: 63)
|
|
34
26
|
end
|
|
35
27
|
|
|
@@ -137,6 +129,12 @@ module MU
|
|
|
137
129
|
[toplevel_required, schema]
|
|
138
130
|
end
|
|
139
131
|
|
|
132
|
+
# @param account_number [String]
|
|
133
|
+
# @return [Boolean]
|
|
134
|
+
def self.isLive?(account_number, credentials = nil)
|
|
135
|
+
true
|
|
136
|
+
end
|
|
137
|
+
|
|
140
138
|
# Figure out what account we're calling from, and then figure out if
|
|
141
139
|
# it's the organization's master account- the only place from which
|
|
142
140
|
# we can create accounts, amongst other things.
|
|
@@ -18,30 +18,15 @@ module MU
|
|
|
18
18
|
# A load balancer as configured in {MU::Config::BasketofKittens::loadbalancers}
|
|
19
19
|
class LoadBalancer < MU::Cloud::LoadBalancer
|
|
20
20
|
|
|
21
|
-
@deploy = nil
|
|
22
21
|
@lb = nil
|
|
23
|
-
attr_reader :mu_name
|
|
24
|
-
attr_reader :config
|
|
25
|
-
attr_reader :cloud_id
|
|
26
22
|
attr_reader :targetgroups
|
|
27
23
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
@deploy = mommacat
|
|
35
|
-
@config = MU::Config.manxify(kitten_cfg)
|
|
36
|
-
@cloud_id ||= cloud_id
|
|
37
|
-
if !mu_name.nil?
|
|
38
|
-
@mu_name = mu_name
|
|
39
|
-
elsif @config['scrub_mu_isms']
|
|
40
|
-
@mu_name = @config['name']
|
|
41
|
-
else
|
|
42
|
-
@mu_name = @deploy.getResourceName(@config["name"], max_length: 32, need_unique_string: true)
|
|
43
|
-
@mu_name.gsub!(/[^\-a-z0-9]/i, "-") # AWS ELB naming rules
|
|
44
|
-
end
|
|
24
|
+
# Initialize this cloud resource object. Calling +super+ will invoke the initializer defined under {MU::Cloud}, which should set the attribtues listed in {MU::Cloud::PUBLIC_ATTRS} as well as applicable dependency shortcuts, like +@vpc+, for us.
|
|
25
|
+
# @param args [Hash]: Hash of named arguments passed via Ruby's double-splat
|
|
26
|
+
def initialize(**args)
|
|
27
|
+
super
|
|
28
|
+
@mu_name ||= @deploy.getResourceName(@config["name"], max_length: 32, need_unique_string: true)
|
|
29
|
+
@mu_name.gsub!(/[^\-a-z0-9]/i, "-") # AWS ELB naming rules
|
|
45
30
|
end
|
|
46
31
|
|
|
47
32
|
# Called automatically by {MU::Deploy#createResources}
|
|
@@ -208,8 +193,12 @@ module MU
|
|
|
208
193
|
:name => tg_name,
|
|
209
194
|
:protocol => tg['proto'],
|
|
210
195
|
:vpc_id => @vpc.cloud_id,
|
|
211
|
-
:port => tg['port']
|
|
196
|
+
:port => tg['port'],
|
|
197
|
+
:target_type => 'instance'
|
|
212
198
|
}
|
|
199
|
+
if tg['target_type'] && tg['target_type'] != 'instance'
|
|
200
|
+
tg_descriptor[:target_type] = tg['target_type']
|
|
201
|
+
end
|
|
213
202
|
if tg['httpcode']
|
|
214
203
|
tg_descriptor[:matcher] = {
|
|
215
204
|
:http_code => tg['httpcode']
|
|
@@ -644,7 +633,9 @@ module MU
|
|
|
644
633
|
# @param region [String]: The cloud provider region
|
|
645
634
|
# @return [void]
|
|
646
635
|
def self.cleanup(noop: false, ignoremaster: false, region: MU.curRegion, credentials: nil, flags: {})
|
|
647
|
-
|
|
636
|
+
if (MU.deploy_id.nil? or MU.deploy_id.empty?) and (!flags or !flags["vpc_id"])
|
|
637
|
+
raise MuError, "Can't touch ELBs without MU-ID or vpc_id flag"
|
|
638
|
+
end
|
|
648
639
|
|
|
649
640
|
# Check for tags matching the current deploy identifier on an elb or
|
|
650
641
|
# elb2 resource.
|
|
@@ -692,19 +683,36 @@ module MU
|
|
|
692
683
|
begin
|
|
693
684
|
tags = []
|
|
694
685
|
matched = false
|
|
695
|
-
if
|
|
696
|
-
matched =
|
|
686
|
+
if flags and flags['vpc_id']
|
|
687
|
+
matched = true if lb.vpc_id == flags['vpc_id']
|
|
697
688
|
else
|
|
698
|
-
|
|
689
|
+
if classic
|
|
690
|
+
matched = self.checkForTagMatch(lb.load_balancer_name, region, ignoremaster, credentials, classic)
|
|
691
|
+
else
|
|
692
|
+
matched = self.checkForTagMatch(lb.load_balancer_arn, region, ignoremaster, credentials, classic)
|
|
693
|
+
end
|
|
699
694
|
end
|
|
700
695
|
if matched
|
|
701
696
|
if !MU::Cloud::AWS.isGovCloud?
|
|
702
697
|
MU::Cloud::AWS::DNSZone.genericMuDNSEntry(name: lb.load_balancer_name, target: lb.dns_name, cloudclass: MU::Cloud::LoadBalancer, delete: true) if !noop
|
|
703
698
|
end
|
|
704
|
-
MU.log "Removing Elastic Load Balancer #{lb.load_balancer_name}"
|
|
705
699
|
if classic
|
|
706
|
-
MU
|
|
700
|
+
MU.log "Removing Elastic Load Balancer #{lb.load_balancer_name}"
|
|
701
|
+
if !noop
|
|
702
|
+
MU::Cloud::AWS.elb(credentials: credentials, region: region).delete_load_balancer(load_balancer_name: lb.load_balancer_name)
|
|
703
|
+
stillhere = true
|
|
704
|
+
begin
|
|
705
|
+
ext_check = MU::Cloud::AWS.elb(credentials: credentials, region: region).describe_load_balancers(load_balancer_names: [lb.load_balancer_name])
|
|
706
|
+
if !ext_check or
|
|
707
|
+
!ext_check.load_balancer_descriptions or
|
|
708
|
+
!ext_check.load_balancer_descriptions[0]
|
|
709
|
+
sleep 3
|
|
710
|
+
else stillhere = false
|
|
711
|
+
end
|
|
712
|
+
end while stillhere
|
|
713
|
+
end
|
|
707
714
|
else
|
|
715
|
+
MU.log "Removing Application Load Balancer #{lb.load_balancer_name}"
|
|
708
716
|
MU::Cloud::AWS.elb2(credentials: credentials, region: region).describe_listeners(
|
|
709
717
|
load_balancer_arn: lb.load_balancer_arn
|
|
710
718
|
).listeners.each { |l|
|
|
@@ -765,6 +773,10 @@ module MU
|
|
|
765
773
|
"proto" => {
|
|
766
774
|
"type" => "string",
|
|
767
775
|
"enum" => ["HTTP", "HTTPS", "TCP", "SSL"],
|
|
776
|
+
},
|
|
777
|
+
"target_type " => {
|
|
778
|
+
"type" => "string",
|
|
779
|
+
"enum" => ["instance", "ip", "lambda"],
|
|
768
780
|
}
|
|
769
781
|
}
|
|
770
782
|
}
|
|
@@ -17,19 +17,11 @@ module MU
|
|
|
17
17
|
class AWS
|
|
18
18
|
# A logging facility as configured in {MU::Config::BasketofKittens::logs}
|
|
19
19
|
class Log < MU::Cloud::Log
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
attr_reader :cloud_id
|
|
26
|
-
|
|
27
|
-
# @param mommacat [MU::MommaCat]: A {MU::Mommacat} object containing the deploy of which this resource is/will be a member.
|
|
28
|
-
# @param kitten_cfg [Hash]: The fully parsed and resolved {MU::Config} resource descriptor as defined in {MU::Config::BasketofKittens::logs}
|
|
29
|
-
def initialize(mommacat: nil, kitten_cfg: nil, mu_name: nil, cloud_id: nil)
|
|
30
|
-
@deploy = mommacat
|
|
31
|
-
@config = MU::Config.manxify(kitten_cfg)
|
|
32
|
-
@cloud_id ||= cloud_id
|
|
20
|
+
|
|
21
|
+
# Initialize this cloud resource object. Calling +super+ will invoke the initializer defined under {MU::Cloud}, which should set the attribtues listed in {MU::Cloud::PUBLIC_ATTRS} as well as applicable dependency shortcuts, like +@vpc+, for us.
|
|
22
|
+
# @param args [Hash]: Hash of named arguments passed via Ruby's double-splat
|
|
23
|
+
def initialize(**args)
|
|
24
|
+
super
|
|
33
25
|
@mu_name ||= @deploy.getResourceName(@config["name"])
|
|
34
26
|
end
|
|
35
27
|
|
|
@@ -17,27 +17,12 @@ module MU
|
|
|
17
17
|
class AWS
|
|
18
18
|
# A MsgQueue as configured in {MU::Config::BasketofKittens::msg_queues}
|
|
19
19
|
class MsgQueue < MU::Cloud::MsgQueue
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
@cloudformation_data = {}
|
|
27
|
-
attr_reader :cloudformation_data
|
|
28
|
-
|
|
29
|
-
# @param mommacat [MU::MommaCat]: A {MU::Mommacat} object containing the deploy of which this resource is/will be a member.
|
|
30
|
-
# @param kitten_cfg [Hash]: The fully parsed and resolved {MU::Config} resource descriptor as defined in {MU::Config::BasketofKittens::msg_queues}
|
|
31
|
-
def initialize(mommacat: nil, kitten_cfg: nil, mu_name: nil, cloud_id: nil)
|
|
32
|
-
@deploy = mommacat
|
|
33
|
-
@config = MU::Config.manxify(kitten_cfg)
|
|
34
|
-
@cloud_id ||= cloud_id
|
|
35
|
-
if mu_name
|
|
36
|
-
@mu_name = mu_name
|
|
37
|
-
cloud_desc if !@cloud_id
|
|
38
|
-
else
|
|
39
|
-
@mu_name ||= @deploy.getResourceName(@config["name"])
|
|
40
|
-
end
|
|
20
|
+
|
|
21
|
+
# Initialize this cloud resource object. Calling +super+ will invoke the initializer defined under {MU::Cloud}, which should set the attribtues listed in {MU::Cloud::PUBLIC_ATTRS} as well as applicable dependency shortcuts, like +@vpc+, for us.
|
|
22
|
+
# @param args [Hash]: Hash of named arguments passed via Ruby's double-splat
|
|
23
|
+
def initialize(**args)
|
|
24
|
+
super
|
|
25
|
+
@mu_name ||= @deploy.getResourceName(@config["name"])
|
|
41
26
|
end
|
|
42
27
|
|
|
43
28
|
# Called automatically by {MU::Deploy#createResources}
|
|
@@ -62,9 +47,9 @@ module MU
|
|
|
62
47
|
tagQueue
|
|
63
48
|
|
|
64
49
|
cur_attrs = notify
|
|
65
|
-
if cur_attrs["Policy"]
|
|
66
|
-
MU.log "FECK", MU::WARN, details: JSON.parse(cur_attrs["Policy"]).to_yaml
|
|
67
|
-
end
|
|
50
|
+
# if cur_attrs["Policy"]
|
|
51
|
+
# MU.log "FECK", MU::WARN, details: JSON.parse(cur_attrs["Policy"]).to_yaml
|
|
52
|
+
# end
|
|
68
53
|
new_attrs = genQueueAttrs
|
|
69
54
|
|
|
70
55
|
changed = false
|
|
@@ -17,22 +17,14 @@ module MU
|
|
|
17
17
|
class AWS
|
|
18
18
|
# Support for AWS DynamoDB
|
|
19
19
|
class NoSQLDB < MU::Cloud::NoSQLDB
|
|
20
|
-
@deploy = nil
|
|
21
|
-
@config = nil
|
|
22
20
|
|
|
23
21
|
@@region_cache = {}
|
|
24
22
|
@@region_cache_semaphore = Mutex.new
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
# @param mommacat [MU::MommaCat]: A {MU::Mommacat} object containing the deploy of which this resource is/will be a member.
|
|
31
|
-
# @param kitten_cfg [Hash]: The fully parsed and resolved {MU::Config} resource descriptor as defined in {MU::Config::BasketofKittens::logs}
|
|
32
|
-
def initialize(mommacat: nil, kitten_cfg: nil, mu_name: nil, cloud_id: nil)
|
|
33
|
-
@deploy = mommacat
|
|
34
|
-
@config = MU::Config.manxify(kitten_cfg)
|
|
35
|
-
@cloud_id ||= cloud_id
|
|
24
|
+
# Initialize this cloud resource object. Calling +super+ will invoke the initializer defined under {MU::Cloud}, which should set the attribtues listed in {MU::Cloud::PUBLIC_ATTRS} as well as applicable dependency shortcuts, like +@vpc+, for us.
|
|
25
|
+
# @param args [Hash]: Hash of named arguments passed via Ruby's double-splat
|
|
26
|
+
def initialize(**args)
|
|
27
|
+
super
|
|
36
28
|
@mu_name ||= @deploy.getResourceName(@config["name"])
|
|
37
29
|
end
|
|
38
30
|
|
|
@@ -17,19 +17,11 @@ module MU
|
|
|
17
17
|
class AWS
|
|
18
18
|
# Support for AWS SNS
|
|
19
19
|
class Notifier < MU::Cloud::Notifier
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
attr_reader :cloud_id
|
|
26
|
-
|
|
27
|
-
# @param mommacat [MU::MommaCat]: A {MU::Mommacat} object containing the deploy of which this resource is/will be a member.
|
|
28
|
-
# @param kitten_cfg [Hash]: The fully parsed and resolved {MU::Config} resource descriptor as defined in {MU::Config::BasketofKittens::logs}
|
|
29
|
-
def initialize(mommacat: nil, kitten_cfg: nil, mu_name: nil, cloud_id: nil)
|
|
30
|
-
@deploy = mommacat
|
|
31
|
-
@config = MU::Config.manxify(kitten_cfg)
|
|
32
|
-
@cloud_id ||= cloud_id
|
|
20
|
+
|
|
21
|
+
# Initialize this cloud resource object. Calling +super+ will invoke the initializer defined under {MU::Cloud}, which should set the attribtues listed in {MU::Cloud::PUBLIC_ATTRS} as well as applicable dependency shortcuts, like +@vpc+, for us.
|
|
22
|
+
# @param args [Hash]: Hash of named arguments passed via Ruby's double-splat
|
|
23
|
+
def initialize(**args)
|
|
24
|
+
super
|
|
33
25
|
@mu_name ||= @deploy.getResourceName(@config["name"])
|
|
34
26
|
end
|
|
35
27
|
|
|
@@ -87,6 +79,7 @@ module MU
|
|
|
87
79
|
# Canonical Amazon Resource Number for this resource
|
|
88
80
|
# @return [String]
|
|
89
81
|
def arn
|
|
82
|
+
@cloud_id ||= @mu_name
|
|
90
83
|
"arn:"+(MU::Cloud::AWS.isGovCloud?(@config["region"]) ? "aws-us-gov" : "aws")+":sns:"+@config['region']+":"+MU::Cloud::AWS.credToAcct(@config['credentials'])+":"+@cloud_id
|
|
91
84
|
end
|
|
92
85
|
|
|
@@ -17,20 +17,11 @@ module MU
|
|
|
17
17
|
class AWS
|
|
18
18
|
# A user as configured in {MU::Config::BasketofKittens::roles}
|
|
19
19
|
class Role < MU::Cloud::Role
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
# @param mommacat [MU::MommaCat]: A {MU::Mommacat} object containing the deploy of which this resource is/will be a member.
|
|
27
|
-
# @param kitten_cfg [Hash]: The fully parsed and resolved {MU::Config} resource descriptor as defined in {MU::Config::BasketofKittens::roles}
|
|
28
|
-
def initialize(mommacat: nil, kitten_cfg: nil, mu_name: nil, cloud_id: nil)
|
|
29
|
-
@deploy = mommacat
|
|
30
|
-
@config = MU::Config.manxify(kitten_cfg)
|
|
31
|
-
@cloud_id ||= cloud_id
|
|
32
|
-
@mu_name = mu_name
|
|
33
|
-
@cloud_id ||= @mu_name # should be the same
|
|
20
|
+
|
|
21
|
+
# Initialize this cloud resource object. Calling +super+ will invoke the initializer defined under {MU::Cloud}, which should set the attribtues listed in {MU::Cloud::PUBLIC_ATTRS} as well as applicable dependency shortcuts, like +@vpc+, for us.
|
|
22
|
+
# @param args [Hash]: Hash of named arguments passed via Ruby's double-splat
|
|
23
|
+
def initialize(**args)
|
|
24
|
+
super
|
|
34
25
|
@mu_name ||= @deploy.getResourceName(@config["name"])
|
|
35
26
|
end
|
|
36
27
|
|
|
@@ -132,8 +123,17 @@ module MU
|
|
|
132
123
|
version_id: desc.policy.default_version_id
|
|
133
124
|
)
|
|
134
125
|
|
|
135
|
-
if version.policy_version.document != URI.
|
|
136
|
-
|
|
126
|
+
if version.policy_version.document != URI.encode_www_form(JSON.generate(policy.values.first), /[^a-z0-9\-]/i)
|
|
127
|
+
# Special exception- we don't want to overwrite extra rules
|
|
128
|
+
# in MuSecrets policies, because our siblings might have
|
|
129
|
+
# (will have) injected those and they should stay.
|
|
130
|
+
if policy.size == 1 and policy["MuSecrets"]
|
|
131
|
+
ext = JSON.parse(URI.decode_www_form(version.policy_version.document))
|
|
132
|
+
if (ext["Statement"][0]["Resource"] & policy["MuSecrets"]["Statement"][0]["Resource"]).sort == policy["MuSecrets"]["Statement"][0]["Resource"].sort
|
|
133
|
+
next
|
|
134
|
+
end
|
|
135
|
+
end
|
|
136
|
+
MU.log "Updating IAM policy #{policy_name}", MU::NOTICE, details: policy
|
|
137
137
|
update_policy(arn, policy.values.first)
|
|
138
138
|
MU::Cloud::AWS.iam(credentials: @config['credentials']).get_policy(policy_arn: arn)
|
|
139
139
|
else
|
|
@@ -271,40 +271,55 @@ module MU
|
|
|
271
271
|
policy_arn: policy_arn
|
|
272
272
|
)
|
|
273
273
|
attachments.policy_users.each { |u|
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
274
|
+
begin
|
|
275
|
+
MU::Cloud::AWS.iam(credentials: credentials).detach_user_policy(
|
|
276
|
+
user_name: u.user_name,
|
|
277
|
+
policy_arn: policy_arn
|
|
278
|
+
)
|
|
279
|
+
rescue ::Aws::IAM::Errors::NoSuchEntity
|
|
280
|
+
end
|
|
278
281
|
}
|
|
279
282
|
attachments.policy_groups.each { |g|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
283
|
+
begin
|
|
284
|
+
MU::Cloud::AWS.iam(credentials: credentials).detach_group_policy(
|
|
285
|
+
group_name: g.group_name,
|
|
286
|
+
policy_arn: policy_arn
|
|
287
|
+
)
|
|
288
|
+
rescue ::Aws::IAM::Errors::NoSuchEntity
|
|
289
|
+
end
|
|
284
290
|
}
|
|
285
291
|
attachments.policy_roles.each { |r|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
292
|
+
begin
|
|
293
|
+
MU::Cloud::AWS.iam(credentials: credentials).detach_role_policy(
|
|
294
|
+
role_name: r.role_name,
|
|
295
|
+
policy_arn: policy_arn
|
|
296
|
+
)
|
|
297
|
+
rescue ::Aws::IAM::Errors::NoSuchEntity
|
|
298
|
+
end
|
|
290
299
|
}
|
|
291
300
|
versions = MU::Cloud::AWS.iam(credentials: credentials).list_policy_versions(
|
|
292
301
|
policy_arn: policy_arn,
|
|
293
302
|
).versions
|
|
294
303
|
versions.each { |v|
|
|
295
304
|
next if v.is_default_version
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
305
|
+
begin
|
|
306
|
+
MU::Cloud::AWS.iam(credentials: credentials).delete_policy_version(
|
|
307
|
+
policy_arn: policy_arn,
|
|
308
|
+
version_id: v.version_id
|
|
309
|
+
)
|
|
310
|
+
rescue ::Aws::IAM::Errors::NoSuchEntity
|
|
311
|
+
end
|
|
300
312
|
}
|
|
301
313
|
|
|
302
314
|
# Delete the policy, unless it's one of the global canned ones owned
|
|
303
315
|
# by AWS
|
|
304
316
|
if !policy_arn.match(/^arn:aws:iam::aws:/)
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
317
|
+
begin
|
|
318
|
+
MU::Cloud::AWS.iam(credentials: credentials).delete_policy(
|
|
319
|
+
policy_arn: policy_arn
|
|
320
|
+
)
|
|
321
|
+
rescue ::Aws::IAM::Errors::NoSuchEntity
|
|
322
|
+
end
|
|
308
323
|
end
|
|
309
324
|
end
|
|
310
325
|
|
|
@@ -340,11 +355,25 @@ module MU
|
|
|
340
355
|
}
|
|
341
356
|
end
|
|
342
357
|
|
|
358
|
+
deleteme = []
|
|
343
359
|
resp = MU::Cloud::AWS.iam(credentials: credentials).list_roles(
|
|
344
360
|
path_prefix: "/"+MU.deploy_id+"/"
|
|
345
361
|
)
|
|
346
|
-
if resp and resp.roles
|
|
347
|
-
|
|
362
|
+
deleteme.concat(resp.roles) if resp and resp.roles
|
|
363
|
+
if flags and flags["known"]
|
|
364
|
+
resp = MU::Cloud::AWS.iam(credentials: credentials).list_roles(
|
|
365
|
+
max_items: 1000
|
|
366
|
+
)
|
|
367
|
+
if resp and resp.roles
|
|
368
|
+
resp.roles.each { |r|
|
|
369
|
+
deleteme << r if flags["known"].include?(r.role_name)
|
|
370
|
+
}
|
|
371
|
+
end
|
|
372
|
+
deleteme.uniq!
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
if deleteme.size > 0
|
|
376
|
+
deleteme.each { |r|
|
|
348
377
|
MU.log "Deleting IAM role #{r.role_name}"
|
|
349
378
|
if !noop
|
|
350
379
|
# purgePolicy won't touch roles we don't own, so gently detach
|
|
@@ -444,7 +473,7 @@ module MU
|
|
|
444
473
|
path_prefix: "/"+@deploy.deploy_id+"/",
|
|
445
474
|
user_name: entityname
|
|
446
475
|
)
|
|
447
|
-
if !resp or !resp.attached_policies.map { |
|
|
476
|
+
if !resp or !resp.attached_policies.map { |a_p| a_p.policy_name }.include?(p.policy_name)
|
|
448
477
|
MU.log "Attaching IAM policy #{p.policy_name} to user #{entityname}", MU::NOTICE
|
|
449
478
|
MU::Cloud::AWS.iam(credentials: @config['credentials']).attach_user_policy(
|
|
450
479
|
policy_arn: p.arn,
|
|
@@ -456,7 +485,7 @@ module MU
|
|
|
456
485
|
path_prefix: "/"+@deploy.deploy_id+"/",
|
|
457
486
|
group_name: entityname
|
|
458
487
|
)
|
|
459
|
-
if !resp or !resp.attached_policies.map { |
|
|
488
|
+
if !resp or !resp.attached_policies.map { |a_p| a_p.policy_name }.include?(p.policy_name)
|
|
460
489
|
MU.log "Attaching policy #{p.policy_name} to group #{entityname}", MU::NOTICE
|
|
461
490
|
MU::Cloud::AWS.iam(credentials: @config['credentials']).attach_group_policy(
|
|
462
491
|
policy_arn: p.arn,
|
|
@@ -468,7 +497,7 @@ module MU
|
|
|
468
497
|
role_name: entityname
|
|
469
498
|
)
|
|
470
499
|
|
|
471
|
-
if !resp or !resp.attached_policies.map { |
|
|
500
|
+
if !resp or !resp.attached_policies.map { |a_p| a_p.policy_name }.include?(p.policy_name)
|
|
472
501
|
MU.log "Attaching policy #{p.policy_name} to role #{entityname}", MU::NOTICE
|
|
473
502
|
MU::Cloud::AWS.iam(credentials: @config['credentials']).attach_role_policy(
|
|
474
503
|
policy_arn: p.arn,
|