This repository has been archived by the owner on Jun 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the region param and ENV var interchangable
This allows for creating and deleteing resources from puppet resource by passing the environment variable (which is already used for scoping). Prior to this change you would have to pass the information twice. If you do pass both we maintain the same approach as previous, giving the param a higher presendence. This also allows for not specifying the region in the DSL, and instead using the AWS_REGION variable. This matches the standard behaviour of other AWS tools, and means in the case of not providing anything the correct error bubbles through.
- Loading branch information
Showing
4 changed files
with
27 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module PuppetX | ||
module Property | ||
class AwsRegion < Puppet::Property | ||
validate do |value| | ||
name = resource[:name] | ||
fail "region for #{name} should not contains spaces" if value =~ /\s/ | ||
if !ENV['AWS_REGION'].nil? && ENV['AWS_REGION'] != value | ||
fail "if using AWS_REGION environment variable it must match the specified region value for #{name}" | ||
end | ||
end | ||
end | ||
end | ||
end |