github.com/mohanarpit/terraform@v0.6.16-0.20160909104007-291f29853544/builtin/providers/aws/data_source_aws_elb_service_account.go (about) 1 package aws 2 3 import ( 4 "fmt" 5 6 "github.com/hashicorp/terraform/helper/schema" 7 ) 8 9 // See http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/enable-access-logs.html#attach-bucket-policy 10 var elbAccountIdPerRegionMap = map[string]string{ 11 "ap-northeast-1": "582318560864", 12 "ap-northeast-2": "600734575887", 13 "ap-south-1": "718504428378", 14 "ap-southeast-1": "114774131450", 15 "ap-southeast-2": "783225319266", 16 "cn-north-1": "638102146993", 17 "eu-central-1": "054676820928", 18 "eu-west-1": "156460612806", 19 "sa-east-1": "507241528517", 20 "us-east-1": "127311923021", 21 "us-gov-west": "048591011584", 22 "us-west-1": "027434742980", 23 "us-west-2": "797873946194", 24 } 25 26 func dataSourceAwsElbServiceAccount() *schema.Resource { 27 return &schema.Resource{ 28 Read: dataSourceAwsElbServiceAccountRead, 29 30 Schema: map[string]*schema.Schema{ 31 "region": &schema.Schema{ 32 Type: schema.TypeString, 33 Optional: true, 34 }, 35 }, 36 } 37 } 38 39 func dataSourceAwsElbServiceAccountRead(d *schema.ResourceData, meta interface{}) error { 40 region := meta.(*AWSClient).region 41 if v, ok := d.GetOk("region"); ok { 42 region = v.(string) 43 } 44 45 if accid, ok := elbAccountIdPerRegionMap[region]; ok { 46 d.SetId(accid) 47 return nil 48 } 49 50 return fmt.Errorf("Unknown region (%q)", region) 51 }