Terraform Series part 2: Terraform Language Components

In this post let us see what are different types of Terraform components available.

Components of terraform


Creates components of your infrastructure.


# Create a resource group in azure
resource "azurerm_resource_group" "example" {
  name     = "example-resources"
  location = "West Europe"


It provides resources

# Configure the Microsoft Azure Provider
provider "azurerm" {
  features {}


Input variables to use in your configuration

variable environment_tag {
    type = "string"
    default = "staging"
    description = "Env Tags"


Outputs are highlighted infrastructure values

output "resource_group_id" {
  value = azurerm_resource_group.rg.id

Data Sources

Data sources are used to fetch information outside of the current configuration.

# Get Resources from a Resource Group
data "azurerm_resources" "example" {
  resource_group_name = "example-resources"

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s