Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ terraform.rc
# env file
.env
*.out

*.hcl
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

## Examples

Please find the [examples]((https://github.com/devwithkrishna/terraform-azure-datafactory//tree/main/examples)) here
Please find the [examples]((https://github.com/devwithkrishna/terraform-azure-datafactory/tree/main/examples)) here

## 📂 Structure

Expand Down
19 changes: 11 additions & 8 deletions examples/sample/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@



# module "azure" {
# source = "../../" # points to the module root
module "azure" {
source = "../../" # points to the module root

# resource_group_name = var.resource_group_name
# location = var.location
# environment = var.environment
# application_name = var.application_name
# temporary = var.temporary
resource_group_name = var.resource_group_name
location = var.location
environment = var.environment
application_name = var.application_name
temporary = var.temporary
managed_virtual_network_enabled = var.managed_virtual_network_enabled
public_network_enabled = var.public_network_enabled
data_factory_name = var.data_factory_name

# }
}
33 changes: 24 additions & 9 deletions examples/sample/outputs.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
# # Outputs for Terratest to validate
# Outputs for Terratest to validate

# output "resource_group_name" {
# description = "Name of the test resource group"
# value = module.azure.resource_group_name
# }
output "resource_group_name" {
description = "Name of the test resource group"
value = module.azure.resource_group
}

# output "resource_group_id" {
# description = "ID of the test resource group"
# value = module.azure.resource_group_id
# }
output "data_factory_name" {
description = "Name of the test data factory"
value = module.azure.data_factory_name
}

output "public_access_enabled" {
description = "Public Access enabled or not"
value = module.azure.public_access_enabled
}

output "data_factory_id" {
description = "Id of Azure Data Factory resource"
value = module.azure.data_factory_id
}

output "datafactory_tags" {
description = "Azure data factory tags"
value = module.azure.datafactory_tags
}
38 changes: 19 additions & 19 deletions examples/sample/providers.tf
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# This file configures the Terraform providers and backend settings
# It defines which providers are required and their version constraints

# terraform {
# required_version = ">= 1.0"
terraform {
required_version = ">= 1.0"

# required_providers {
# azurerm = {
# source = "hashicorp/azurerm"
# version = ">= 4.0, < 4.40.0"
# }
# }
# }
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 4.0, < 4.40.0"
}
}
}


# # Configure the Azure provider
# provider "azurerm" {
# features {} # Required block for Azure provider, can configure specific features here
# # TODO: Add authentication methods if not using Azure CLI/Environment variables
# # subscription_id = var.subscription_id
# # tenant_id = var.tenant_id
# # client_id = var.client_id
# # client_secret = var.client_secret
# }
# Configure the Azure provider
provider "azurerm" {
features {} # Required block for Azure provider, can configure specific features here

# TODO: Add authentication methods if not using Azure CLI/Environment variables
# subscription_id = var.subscription_id
# tenant_id = var.tenant_id
# client_id = var.client_id
# client_secret = var.client_secret
}
75 changes: 45 additions & 30 deletions examples/sample/variables.tf
Original file line number Diff line number Diff line change
@@ -1,32 +1,47 @@
# # Variables for the test configuration

# variable "resource_group_name" {
# description = "Name of the resource group for testing"
# type = string
# }

# variable "location" {
# description = "Azure region for testing"
# type = string
# default = "East US2"
# }

# variable "environment" {
# description = "Environment tag for testing"
# type = string
# default = "DEV"

# }

# variable "application_name" {
# description = "value for application name tag"
# type = string
# default = "oscar"
# }

# variable "temporary" {
# description = "temporary name tag"
# type = string
# default = "TRUE"

# }
variable "resource_group_name" {
description = "Name of the resource group for testing"
type = string
}

variable "data_factory_name" {
description = "Azure data factory name"
type = string
}

variable "location" {
description = "Azure region for testing"
type = string
default = "East US2"
}

variable "environment" {
description = "Environment tag for testing"
type = string
default = "DEV"
}

variable "application_name" {
description = "value for application name tag"
type = string
default = "oscar"
}

variable "temporary" {
description = "temporary name tag"
type = string
default = "TRUE"
}

variable "managed_virtual_network_enabled" {
description = "Is Managed Virtual Network enabled"
default = "true"
type = string
}

variable "public_network_enabled" {
description = "Is Public Network enabled"
default = "true"
type = string
}
46 changes: 35 additions & 11 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
# #This is the main configuration file where Azure resources are defined
# #It contains the actual infrastructure as code declarations
# This is the main configuration file where Azure resources are defined
# It contains the actual infrastructure as code declarations

# resource "azurerm_resource_group" "main" {
# name = var.resource_group_name
# location = var.location
resource "azurerm_resource_group" "data_factory_rg" {
name = var.resource_group_name
location = var.location
tags = {
Environment = upper(var.environment)
Orchestrator = "Terraform"
DisplayName = upper(var.resource_group_name)
ApplicationName = lower(var.application_name)
Temporary = upper(var.temporary)
}
lifecycle {
ignore_changes = [tags]
}
}

# tags = {
# Environment = var.environment,
# ApplicationName = var.application_name
# Temporary = var.temporary
# }
# }
resource "azurerm_data_factory" "data_factory" {
name = var.data_factory_name
resource_group_name = azurerm_resource_group.data_factory_rg.name
location = azurerm_resource_group.data_factory_rg.location
public_network_enabled = var.public_network_enabled

managed_virtual_network_enabled = var.managed_virtual_network_enabled

tags = {
Environment = upper(var.environment)
Orchestrator = "Terraform"
DisplayName = upper(var.data_factory_name)
ApplicationName = lower(var.application_name)
Temporary = upper(var.temporary)
}
depends_on = [azurerm_resource_group.data_factory_rg]
lifecycle {
ignore_changes = [tags]
}
}
40 changes: 27 additions & 13 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
# This file defines output values that will be displayed after Terraform applies
# Outputs are useful for getting information about created resources

# output "resource_group_id" {
# description = "ID of the resource group"
# value = azurerm_resource_group.main.id
# }
output "resource_group" {
description = "Azure data factory resource group name"
value = azurerm_resource_group.data_factory_rg.name
}

# output "resource_group_name" {
# description = "Name of the resource group"
# value = azurerm_resource_group.main.name
# }
output "data_factory_name" {
description = "Azure Data Factory name"
value = azurerm_data_factory.data_factory.name
}

# output "resource_group_tags" {
# description = "Tags of the resource group"
# value = azurerm_resource_group.main.tags

# }
output "data_factory_location" {
description = "Azure data factory location"
value = azurerm_data_factory.data_factory.location
}

output "data_factory_id" {
description = "Id of Azure Data Factory resource"
value = azurerm_data_factory.data_factory.id
}

output "public_access_enabled" {
description = "Azure datafactory enabled public access or not"
value = azurerm_data_factory.data_factory.public_network_enabled
}

output "datafactory_tags" {
description = "Azure data factory tags"
value = azurerm_data_factory.data_factory.tags
}
42 changes: 21 additions & 21 deletions providers.tf
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# # This file configures the Terraform providers and backend settings
# # It defines which providers are required and their version constraints
# This file configures the Terraform providers and backend settings
# It defines which providers are required and their version constraints

# terraform {
# required_version = ">= 1.0"
terraform {
required_version = ">= 1.0"

# required_providers {
# azurerm = {
# source = "hashicorp/azurerm"
# version = ">= 4.0, < 4.40.0"
# }
# }
# }
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 4.0, < 4.40.0"
}
}
}


# # Configure the Azure provider
# provider "azurerm" {
# features {} # Required block for Azure provider, can configure specific features here
# # TODO: Add authentication methods if not using Azure CLI/Environment variables
# # subscription_id = var.subscription_id
# # tenant_id = var.tenant_id
# # client_id = var.client_id
# # client_secret = var.client_secret
# }
# Configure the Azure provider
provider "azurerm" {
features {} # Required block for Azure provider, can configure specific features here

# TODO: Add authentication methods if not using Azure CLI/Environment variables
# subscription_id = var.subscription_id
# tenant_id = var.tenant_id
# client_id = var.client_id
# client_secret = var.client_secret
}
43 changes: 43 additions & 0 deletions test/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
module github.com/devwithkrishna/terraform-azure-datafactory/test

go 1.24.0

toolchain go1.24.9

require (
github.com/gruntwork-io/terratest v0.51.0
github.com/stretchr/testify v1.11.1
)

require (
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-getter/v2 v2.2.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-safetemp v1.0.0 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/hashicorp/hcl/v2 v2.22.0 // indirect
github.com/hashicorp/terraform-json v0.23.0 // indirect
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a // indirect
github.com/klauspost/compress v1.16.5 // indirect
github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/tmccombs/hcl2json v0.6.4 // indirect
github.com/ulikunitz/xz v0.5.10 // indirect
github.com/zclconf/go-cty v1.15.0 // indirect
golang.org/x/crypto v0.36.0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/net v0.38.0 // indirect
golang.org/x/sync v0.12.0 // indirect
golang.org/x/sys v0.31.0 // indirect
golang.org/x/text v0.23.0 // indirect
golang.org/x/tools v0.26.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading
Loading