github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/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-east-2": "391106570357", 13 "us-west-1": "262260360010", 14 "us-west-2": "902366379725", 15 "ap-south-1": "865932855811", 16 "ap-northeast-2": "760740231472", 17 "ap-southeast-1": "361669875840", 18 "ap-southeast-2": "762762565011", 19 "ap-northeast-1": "404641285394", 20 "ca-central-1": "907379612154", 21 "eu-central-1": "053454850223", 22 "eu-west-1": "210876761215", 23 } 24 25 func dataSourceAwsRedshiftServiceAccount() *schema.Resource { 26 return &schema.Resource{ 27 Read: dataSourceAwsRedshiftServiceAccountRead, 28 29 Schema: map[string]*schema.Schema{ 30 "region": &schema.Schema{ 31 Type: schema.TypeString, 32 Optional: true, 33 }, 34 }, 35 } 36 } 37 38 func dataSourceAwsRedshiftServiceAccountRead(d *schema.ResourceData, meta interface{}) error { 39 region := meta.(*AWSClient).region 40 if v, ok := d.GetOk("region"); ok { 41 region = v.(string) 42 } 43 44 if accid, ok := redshiftServiceAccountPerRegionMap[region]; ok { 45 d.SetId(accid) 46 return nil 47 } 48 49 return fmt.Errorf("Unknown region (%q)", region) 50 }