github.com/mohanarpit/terraform@v0.6.16-0.20160909104007-291f29853544/builtin/providers/aws/data_source_aws_redshift_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/redshift/latest/mgmt/db-auditing.html#db-auditing-enable-logging 10 var redshiftServiceAccountPerRegionMap = map[string]string{ 11 "us-east-1": "193672423079", 12 "us-west-1": "262260360010", 13 "us-west-2": "902366379725", 14 "ap-south-1": "865932855811", 15 "ap-northeast-2": "760740231472", 16 "ap-southeast-1": "361669875840", 17 "ap-southeast-2": "762762565011", 18 "ap-northeast-1": "404641285394", 19 "eu-central-1": "053454850223", 20 "eu-west-1": "210876761215", 21 } 22 23 func dataSourceAwsRedshiftServiceAccount() *schema.Resource { 24 return &schema.Resource{ 25 Read: dataSourceAwsRedshiftServiceAccountRead, 26 27 Schema: map[string]*schema.Schema{ 28 "region": &schema.Schema{ 29 Type: schema.TypeString, 30 Optional: true, 31 }, 32 }, 33 } 34 } 35 36 func dataSourceAwsRedshiftServiceAccountRead(d *schema.ResourceData, meta interface{}) error { 37 region := meta.(*AWSClient).region 38 if v, ok := d.GetOk("region"); ok { 39 region = v.(string) 40 } 41 42 if accid, ok := redshiftServiceAccountPerRegionMap[region]; ok { 43 d.SetId(accid) 44 return nil 45 } 46 47 return fmt.Errorf("Unknown region (%q)", region) 48 }