-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
partition_data_source.go
49 lines (37 loc) · 1.17 KB
/
partition_data_source.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
package meta
import (
"log"
"github.com/cloudposse/terraform-provider-awsutils/internal/conns"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func DataSourcePartition() *schema.Resource {
return &schema.Resource{
Read: dataSourcePartitionRead,
Schema: map[string]*schema.Schema{
"partition": {
Type: schema.TypeString,
Computed: true,
},
"dns_suffix": {
Type: schema.TypeString,
Computed: true,
},
"reverse_dns_prefix": {
Type: schema.TypeString,
Computed: true,
},
},
}
}
func dataSourcePartitionRead(d *schema.ResourceData, meta interface{}) error {
client := meta.(*conns.AWSClient)
log.Printf("[DEBUG] Reading Partition.")
d.SetId(meta.(*conns.AWSClient).Partition)
log.Printf("[DEBUG] Setting AWS Partition to %s.", client.Partition)
d.Set("partition", meta.(*conns.AWSClient).Partition)
log.Printf("[DEBUG] Setting AWS URL Suffix to %s.", client.DNSSuffix)
d.Set("dns_suffix", meta.(*conns.AWSClient).DNSSuffix)
d.Set("reverse_dns_prefix", meta.(*conns.AWSClient).ReverseDNSPrefix)
log.Printf("[DEBUG] Setting service prefix to %s.", meta.(*conns.AWSClient).ReverseDNSPrefix)
return nil
}