-
Notifications
You must be signed in to change notification settings - Fork 8.9k
/
data_source_aws_elastic_beanstalk_hosted_zone.go
56 lines (47 loc) · 1.39 KB
/
data_source_aws_elastic_beanstalk_hosted_zone.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package aws
import (
"fmt"
"github.com/hashicorp/terraform/helper/schema"
)
// See # http://docs.aws.amazon.com/general/latest/gr/rande.html#elasticbeanstalk_region
var elasticBeanstalkHostedZoneIds = map[string]string{
"ap-southeast-1": "Z16FZ9L249IFLT",
"ap-southeast-2": "Z2PCDNR3VC2G1N",
"ap-northeast-1": "Z1R25G3KIG2GBW",
"ap-northeast-2": "Z3JE5OI70TWKCP",
"ap-south-1": "Z18NTBI3Y7N9TZ",
"ca-central-1": "ZJFCZL7SSZB5I",
"eu-central-1": "Z1FRNW7UH4DEZJ",
"eu-west-1": "Z2NYPWQ7DFZAZH",
"eu-west-2": "Z1GKAAAUGATPF1",
"eu-west-3": "Z5WN6GAYWG5OB",
"sa-east-1": "Z10X7K2B4QSOFV",
"us-east-1": "Z117KPS5GTRQ2G",
"us-east-2": "Z14LCN19Q5QHIC",
"us-west-1": "Z1LQECGX5PH1X",
"us-west-2": "Z38NKT9BP95V3O",
}
func dataSourceAwsElasticBeanstalkHostedZone() *schema.Resource {
return &schema.Resource{
Read: dataSourceAwsElasticBeanstalkHostedZoneRead,
Schema: map[string]*schema.Schema{
"region": {
Type: schema.TypeString,
Optional: true,
},
},
}
}
func dataSourceAwsElasticBeanstalkHostedZoneRead(d *schema.ResourceData, meta interface{}) error {
region := meta.(*AWSClient).region
if v, ok := d.GetOk("region"); ok {
region = v.(string)
}
zoneID, ok := elasticBeanstalkHostedZoneIds[region]
if !ok {
return fmt.Errorf("Unsupported region: %s", region)
}
d.SetId(zoneID)
d.Set("region", region)
return nil
}