github.com/vtorhonen/terraform@v0.9.0-beta2.0.20170307220345-5d894e4ffda7/builtin/providers/azurerm/data_source_arm_client_config.go (about)

     1  package azurerm
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/hashicorp/terraform/helper/schema"
     7  )
     8  
     9  func dataSourceArmClientConfig() *schema.Resource {
    10  	return &schema.Resource{
    11  		Read: dataSourceArmClientConfigRead,
    12  
    13  		Schema: map[string]*schema.Schema{
    14  			"client_id": {
    15  				Type:     schema.TypeString,
    16  				Computed: true,
    17  			},
    18  			"tenant_id": {
    19  				Type:     schema.TypeString,
    20  				Computed: true,
    21  			},
    22  			"subscription_id": {
    23  				Type:     schema.TypeString,
    24  				Computed: true,
    25  			},
    26  		},
    27  	}
    28  }
    29  
    30  func dataSourceArmClientConfigRead(d *schema.ResourceData, meta interface{}) error {
    31  	client := meta.(*ArmClient)
    32  
    33  	d.SetId(time.Now().UTC().String())
    34  	d.Set("client_id", client.clientId)
    35  	d.Set("tenant_id", client.tenantId)
    36  	d.Set("subscription_id", client.subscriptionId)
    37  
    38  	return nil
    39  }