Skip to content
This repository was archived by the owner on Jun 5, 2020. It is now read-only.

Commit c9a1cc8

Browse files
authored
Merge pull request #529 from sheenaajay/IgnoreDisabledRegion
(MODULES-9005) Remove regions which are disabled by default
2 parents c03ea01 + 8b45a95 commit c9a1cc8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/puppet_x/puppetlabs/aws.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,24 @@ def to_s
2424

2525
class Aws < Puppet::Provider
2626
def self.regions
27+
#Remove the new AWS Regions which are disabled by default.
28+
disabled_regions = [ "ap-southeast-1", "ap-southeast-2", "ap-northeast-1", "ap-northeast-2", "ap-east1", "ap-south-1"]
29+
2730
if ENV['AWS_REGION'] and not ENV['AWS_REGION'].empty?
2831
[ENV['AWS_REGION']]
2932
elsif global_configuration and global_configuration['default'] and global_configuration['default']['region']
3033
[global_configuration['default']['region']]
3134
else
32-
ec2_client(default_region).describe_regions.data.regions.map(&:region_name)
35+
regions = ec2_client(default_region).describe_regions.data.regions.map(&:region_name)
36+
37+
#Remove the new AWS Regions which are disabled by default.
38+
disabled_regions.collect do |disabled_region|
39+
regions.delete_if { |x| x == disabled_region }
40+
end
41+
42+
regions
3343
end
44+
3445
end
3546

3647
def regions

0 commit comments

Comments
 (0)