github.com/rothwerx/packer@v0.9.0/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-southeast-1",
     8  		"ap-southeast-2",
     9  		"cn-north-1",
    10  		"eu-central-1",
    11  		"eu-west-1",
    12  		"sa-east-1",
    13  		"us-east-1",
    14  		"us-gov-west-1",
    15  		"us-west-1",
    16  		"us-west-2",
    17  	}
    18  }
    19  
    20  // ValidateRegion returns true if the supplied region is a valid AWS
    21  // region and false if it's not.
    22  func ValidateRegion(region string) bool {
    23  	for _, valid := range listEC2Regions() {
    24  		if region == valid {
    25  			return true
    26  		}
    27  	}
    28  	return false
    29  }