github.com/nathanielks/terraform@v0.6.1-0.20170509030759-13e1a62319dc/builtin/providers/aws/data_source_aws_partition.go (about)

     1  package aws
     2  
     3  import (
     4  	"log"
     5  	"time"
     6  
     7  	"github.com/hashicorp/terraform/helper/schema"
     8  )
     9  
    10  func dataSourceAwsPartition() *schema.Resource {
    11  	return &schema.Resource{
    12  		Read: dataSourceAwsPartitionRead,
    13  
    14  		Schema: map[string]*schema.Schema{
    15  			"partition": {
    16  				Type:     schema.TypeString,
    17  				Computed: true,
    18  			},
    19  		},
    20  	}
    21  }
    22  
    23  func dataSourceAwsPartitionRead(d *schema.ResourceData, meta interface{}) error {
    24  	client := meta.(*AWSClient)
    25  
    26  	log.Printf("[DEBUG] Reading Partition.")
    27  	d.SetId(time.Now().UTC().String())
    28  
    29  	log.Printf("[DEBUG] Setting AWS Partition to %s.", client.partition)
    30  	d.Set("partition", meta.(*AWSClient).partition)
    31  
    32  	return nil
    33  }