Skip to content

Commit e99c4d5

Browse files
azure datafactory terraform module (#26)
* DEVOPS-315 azure datafactory terraform module * fix typo in rg name ref in data factory creation
1 parent e760d89 commit e99c4d5

File tree

4 files changed

+121
-0
lines changed

4 files changed

+121
-0
lines changed

data-factory/datafactory.tf

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
resource "azurerm_resource_group" "data_factory_rg" {
2+
name = var.resource_group_name
3+
location = var.location
4+
tags = {
5+
Environment = upper(var.environment)
6+
Orchestrator = "Terraform"
7+
DisplayName = upper(var.resource_group_name)
8+
ApplicationName = lower(var.application_name)
9+
Temporary = upper(var.temporary)
10+
}
11+
}
12+
13+
resource "azurerm_data_factory" "data_factory" {
14+
name = var.data_factory_name
15+
resource_group_name = azurerm_resource_group.data_factory_rg.name
16+
location = azurerm_resource_group.data_factory_rg.location
17+
public_network_enabled = var.public_network_enabled
18+
19+
managed_virtual_network_enabled = var.managed_virtual_network_enabled
20+
21+
tags = {
22+
Environment = upper(var.environment)
23+
Orchestrator = "Terraform"
24+
DisplayName = upper(var.data_factory_name)
25+
ApplicationName = lower(var.application_name)
26+
Temporary = upper(var.temporary)
27+
28+
}
29+
}

data-factory/output.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
output "resource_group" {
2+
description = "Azure data factory resource group name"
3+
value = azurerm_resource_group.data_factory_rg.name
4+
}
5+
6+
output "data_factory_name" {
7+
description = "Azure Data Factory name"
8+
value = azurerm_data_factory.data_factory.name
9+
}
10+
11+
output "data_factory_location" {
12+
description = "Azure data factory location"
13+
value = azurerm_data_factory.data_factory.location
14+
}
15+
16+
output "public_access_enabled" {
17+
description = "Azure datafactory enabled public access or not"
18+
value = azurerm_data_factory.data_factory.public_network_enabled
19+
}

data-factory/providers.tf

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
terraform {
2+
required_version = "~> 1.3"
3+
required_providers {
4+
azurerm = {
5+
source = "hashicorp/azurerm"
6+
version = "<= 4.0"
7+
}
8+
random = {
9+
source = "hashicorp/random"
10+
version = ">= 3.1"
11+
}
12+
}
13+
}
14+
provider "azurerm" {
15+
features {}
16+
}

data-factory/variables.tf

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
variable "resource_group_name" {
2+
type = string
3+
description = "Azure Datafactory Rg"
4+
default = ""
5+
}
6+
7+
variable "location" {
8+
type = string
9+
description = "Azure Data factory location"
10+
default = ""
11+
}
12+
13+
variable "data_factory_name" {
14+
description = "Azure Data factory name"
15+
type = string
16+
default = ""
17+
18+
}
19+
20+
variable "environment" {
21+
default = "DEV"
22+
description = "Environment tag value in Azure"
23+
type = string
24+
validation {
25+
condition = contains(["DEV", "QA", "UAT", "PROD"], var.environment)
26+
error_message = "Environment value should be one among DEV or QA or UAT or PROD."
27+
}
28+
}
29+
30+
variable "application_name" {
31+
default = "devwithkrishna"
32+
description = "Azure application name tag"
33+
}
34+
35+
36+
variable "temporary" {
37+
default = "TRUE"
38+
description = "Temporary tag value in Azure"
39+
type = string
40+
validation {
41+
condition = contains(["TRUE", "FALSE"], upper(var.temporary))
42+
error_message = "The temporary tag value must be either 'TRUE' or 'FALSE'."
43+
}
44+
45+
}
46+
47+
variable "managed_virtual_network_enabled" {
48+
description = "Is Managed Virtual Network enabled"
49+
default = "true"
50+
type = string
51+
}
52+
53+
variable "public_network_enabled" {
54+
description = "Is Public Network enabled"
55+
default = "true"
56+
type = string
57+
}

0 commit comments

Comments
 (0)