forked from Lachlan-White/terraform-module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata.tf
20 lines (12 loc) · 950 Bytes
/
data.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/*
Data sources allow Terraform to use information defined outside of Terraform, defined by another separate Terraform configuration, or modified by functions.
I personally use data sources within modules sparingly, whilst they are incredibly powerful, I usually side where possible on using the consumer of the module for the inputs to a module. There are exemptions to this rule as an example, a common practice within the Azure Module space is to use the below data source:
`data "azurerm_client_config" "current" {}`
This provides a large amount of information such as:
- client_id
- tenant_id
- subscription_id
- object_id
In some cases these pieces of information are required to deploy a resource, such as an Azure Key Vault, and asking the consumer to provide the tenant_id isn't as simple as calling the aforementioned data source which has no inputs required.
If the data.tf file is unused, it should be deleted from the module.
*/