github.com/amanya/packer@v0.12.1-0.20161117214323-902ac5ab2eb6/builder/amazon/common/regions.go (about)

     1  package common
     2  
     3  func listEC2Regions() []string {
     4  	return []string{
     5  		"ap-northeast-1",
     6  		"ap-northeast-2",
     7  		"ap-south-1",
     8  		"ap-southeast-1",
     9  		"ap-southeast-2",
    10  		"cn-north-1",
    11  		"eu-central-1",
    12  		"eu-west-1",
    13  		"sa-east-1",
    14  		"us-east-1",
    15  		"us-east-2",
    16  		"us-gov-west-1",
    17  		"us-west-1",
    18  		"us-west-2",
    19  	}
    20  }
    21  
    22  // ValidateRegion returns true if the supplied region is a valid AWS
    23  // region and false if it's not.
    24  func ValidateRegion(region string) bool {
    25  	for _, valid := range listEC2Regions() {
    26  		if region == valid {
    27  			return true
    28  		}
    29  	}
    30  	return false
    31  }