Skip to content

Commit

Permalink
Merge branch 'marvinbuss/ai_studio_tst' of https://github.com/Perfect…
Browse files Browse the repository at this point in the history
…ThymeTech/terraform-azurerm-modules into marvinbuss/ai_studio_tst
  • Loading branch information
marvinbuss committed Nov 12, 2024
2 parents 50e5272 + 985bc29 commit 6248ca6
Show file tree
Hide file tree
Showing 25 changed files with 288 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/terraform-appserviceplan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
with:
environment: "dev"
config: "appserviceplan"
terraform_version: "1.9.5"
terraform_version: "1.9.8"
node_version: 20
tenant_id: "37963dd4-f4e6-40f8-a7d6-24b97919e452"
subscription_id: "1fdab118-1638-419a-8b12-06c9543714a0"
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/terraform-databricksaccessconnector.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: databricksaccessconnector tests
on:
push:
branches:
- main
paths:
- "modules/databricksaccessconnector/**"
- ".github/workflows/terraform-databricksaccessconnector.yml"

pull_request:
branches:
- main
paths:
- "modules/databricksaccessconnector/**"
- ".github/workflows/terraform-databricksaccessconnector.yml"

jobs:
terraform_dev:
uses: ./.github/workflows/_terraformTestTemplate.yml
name: "Dev"
with:
environment: "dev"
config: "databricksaccessconnector"
terraform_version: "1.9.8"
node_version: 20
tenant_id: "37963dd4-f4e6-40f8-a7d6-24b97919e452"
subscription_id: "1fdab118-1638-419a-8b12-06c9543714a0"
secrets:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
2 changes: 1 addition & 1 deletion .github/workflows/terraform-datafactory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
with:
environment: "dev"
config: "datafactory"
terraform_version: "1.9.6"
terraform_version: "1.9.8"
node_version: 20
tenant_id: "37963dd4-f4e6-40f8-a7d6-24b97919e452"
subscription_id: "1fdab118-1638-419a-8b12-06c9543714a0"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/terraform-storage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
with:
environment: "dev"
config: "storage"
terraform_version: "1.9.6"
terraform_version: "1.9.8"
node_version: 20
tenant_id: "37963dd4-f4e6-40f8-a7d6-24b97919e452"
subscription_id: "1fdab118-1638-419a-8b12-06c9543714a0"
Expand Down
3 changes: 3 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ exclude: |
modules/botservice/README.md|
modules/containerregistry/README.md|
modules/cosmosdb/README.md|
modules/databricksaccessconnector/README.md|
modules/datafactory/README.md|
modules/fabriccapacity/README.md|
modules/fabricworkspace/README.md|
Expand Down Expand Up @@ -49,6 +50,8 @@ repos:
args: ["-c", "./.terraform-docs.yml", "./modules/containerregistry"]
- id: terraform-docs-go
args: ["-c", "./.terraform-docs.yml", "./modules/cosmosdb"]
- id: terraform-docs-go
args: ["-c", "./.terraform-docs.yml", "./modules/databricksaccessconnector"]
- id: terraform-docs-go
args: ["-c", "./.terraform-docs.yml", "./modules/datafactory"]
- id: terraform-docs-go
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ This repository contains secure by default Terraform modules for Azure Services.
- [Azure Container Registry](/modules/containerregistry/)
- [Azure Cosmos DB](/modules/cosmosdb/)
- [Azure Data Factory](/modules/datafactory/)
- [Azure Databricks Access Connector](/modules/databricksaccessconnector/)
- [Azure Key Vault](/modules/keyvault/)
- [Azure Log Analytics Workspace](/modules/loganalytics/)
- [Azure Storage Account](/modules/storage/)
Expand Down
4 changes: 2 additions & 2 deletions code/utilities/terraform_override.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "4.6.0"
version = "4.8.0"
}
azapi = {
source = "Azure/azapi"
version = "1.15.0"
version = "2.0.1"
}
time = {
source = "hashicorp/time"
Expand Down
2 changes: 1 addition & 1 deletion modules/appserviceplan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ The following requirements are needed by this module:

- <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) (>=0.12)

- <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) (>= 4.0.0)
- <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) (~> 4.0)

## Modules

Expand Down
2 changes: 1 addition & 1 deletion modules/appserviceplan/terraform.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 4.0.0"
version = "~> 4.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ run "create_appserviceplan" {
service_plan_maximum_elastic_worker_count = null
service_plan_os_type = "Linux"
service_plan_per_site_scaling_enabled = false
service_plan_sku_name = "Y1"
service_plan_sku_name = "FC1"
service_plan_worker_count = 1
service_plan_zone_balancing_enabled = false
diagnostics_configurations = []
Expand Down
24 changes: 24 additions & 0 deletions modules/appserviceplan/tests/test002.tftest.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
run "create_appserviceplan" {
command = apply

variables {
location = "northeurope"
resource_group_name = "tfmodule-test-rg"
tags = {
test = "appserviceplan"
}
service_plan_name = "tftstr-asp002"
service_plan_maximum_elastic_worker_count = null
service_plan_os_type = "Linux"
service_plan_per_site_scaling_enabled = false
service_plan_sku_name = "Y1"
service_plan_worker_count = 1
service_plan_zone_balancing_enabled = false
diagnostics_configurations = []
}

assert {
condition = azurerm_service_plan.service_plan.resource_group_name == "tfmodule-test-rg"
error_message = "Failed to deploy."
}
}
88 changes: 88 additions & 0 deletions modules/databricksaccessconnector/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<!-- BEGIN_TF_DOCS -->
# Azure Databricks Terraform Module

## Documentation
<!-- markdownlint-disable MD033 -->

## Requirements

The following requirements are needed by this module:

- <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) (>=0.12)

- <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) (~> 4.0)

## Modules

No modules.

<!-- markdownlint-disable MD013 -->
<!-- markdownlint-disable MD034 -->
## Required Inputs

The following input variables are required:

### <a name="input_databricks_access_connector_name"></a> [databricks\_access\_connector\_name](#input\_databricks\_access\_connector\_name)

Description: Specifies the name of the Azure Databricks workspace.

Type: `string`

### <a name="input_location"></a> [location](#input\_location)

Description: Specifies the location of all resources.

Type: `string`

### <a name="input_resource_group_name"></a> [resource\_group\_name](#input\_resource\_group\_name)

Description: Specifies the resource group name in which all resources will get deployed.

Type: `string`

## Optional Inputs

The following input variables are optional (have default values):

### <a name="input_diagnostics_configurations"></a> [diagnostics\_configurations](#input\_diagnostics\_configurations)

Description: Specifies the diagnostic configuration for the service.

Type:

```hcl
list(object({
log_analytics_workspace_id = optional(string, ""),
storage_account_id = optional(string, "")
}))
```

Default: `[]`

### <a name="input_tags"></a> [tags](#input\_tags)

Description: Specifies a key value map of tags to set on every taggable resources.

Type: `map(string)`

Default: `{}`

## Outputs

The following outputs are exported:

### <a name="output_databricks_access_connector_id"></a> [databricks\_access\_connector\_id](#output\_databricks\_access\_connector\_id)

Description: Specifies the resource id of the Azure Databricks access connector.

### <a name="output_databricks_access_connector_name"></a> [databricks\_access\_connector\_name](#output\_databricks\_access\_connector\_name)

Description: Specifies the resource name of the Azure Databricks access connector.

### <a name="output_databricks_access_connector_principal_id"></a> [databricks\_access\_connector\_principal\_id](#output\_databricks\_access\_connector\_principal\_id)

Description: Specifies the principal id of the Azure Databricks access connector.

<!-- markdownlint-enable -->

<!-- END_TF_DOCS -->
Empty file.
1 change: 1 addition & 0 deletions modules/databricksaccessconnector/README_header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Azure Databricks Terraform Module
9 changes: 9 additions & 0 deletions modules/databricksaccessconnector/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "azurerm_databricks_access_connector" "databricks_access_connector" {
name = var.databricks_access_connector_name
location = var.location
resource_group_name = var.resource_group_name
tags = var.tags
identity {
type = "SystemAssigned"
}
}
17 changes: 17 additions & 0 deletions modules/databricksaccessconnector/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
output "databricks_access_connector_id" {
description = "Specifies the resource id of the Azure Databricks access connector."
value = azurerm_databricks_access_connector.databricks_access_connector.id
sensitive = false
}

output "databricks_access_connector_name" {
description = "Specifies the resource name of the Azure Databricks access connector."
value = azurerm_databricks_access_connector.databricks_access_connector.name
sensitive = false
}

output "databricks_access_connector_principal_id" {
description = "Specifies the principal id of the Azure Databricks access connector."
value = azurerm_databricks_access_connector.databricks_access_connector.identity[0].principal_id
sensitive = true
}
10 changes: 10 additions & 0 deletions modules/databricksaccessconnector/terraform.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
terraform {
required_version = ">=0.12"

required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 4.0"
}
}
}
18 changes: 18 additions & 0 deletions modules/databricksaccessconnector/tests/test.tftest.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
run "create_databricks_access_connector" {
command = apply

variables {
location = "northeurope"
resource_group_name = "tfmodule-test-rg"
tags = {
test = "databricks_access_connector"
}
databricks_access_connector_name = "tftstdbac001"
diagnostics_configurations = []
}

assert {
condition = azurerm_databricks_access_connector.databricks_access_connector.resource_group_name == "tfmodule-test-rg"
error_message = "Failed to deploy."
}
}
56 changes: 56 additions & 0 deletions modules/databricksaccessconnector/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# General variables
variable "location" {
description = "Specifies the location of all resources."
type = string
sensitive = false
nullable = false
}

variable "resource_group_name" {
description = "Specifies the resource group name in which all resources will get deployed."
type = string
sensitive = false
nullable = false
validation {
condition = length(var.resource_group_name) >= 2
error_message = "Please specify a valid resource group name."
}
}

variable "tags" {
description = "Specifies a key value map of tags to set on every taggable resources."
type = map(string)
sensitive = false
nullable = false
default = {}
}

# Service variables
variable "databricks_access_connector_name" {
description = "Specifies the name of the Azure Databricks workspace."
type = string
sensitive = false
nullable = false
validation {
condition = length(var.databricks_access_connector_name) >= 2
error_message = "Please specify a valid name."
}
}

# Diagnostics variables
variable "diagnostics_configurations" {
description = "Specifies the diagnostic configuration for the service."
type = list(object({
log_analytics_workspace_id = optional(string, ""),
storage_account_id = optional(string, "")
}))
sensitive = false
nullable = false
default = []
validation {
condition = alltrue([
length([for diagnostics_configuration in toset(var.diagnostics_configurations) : diagnostics_configuration if diagnostics_configuration.log_analytics_workspace_id == "" && diagnostics_configuration.storage_account_id == ""]) <= 0
])
error_message = "Please specify a valid resource ID."
}
}
10 changes: 8 additions & 2 deletions modules/datafactory/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ The following requirements are needed by this module:

- <a name="requirement_azapi"></a> [azapi](#requirement\_azapi) (~> 2.0)

- <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) (>= 4.0.0)
- <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) (~> 4.0)

- <a name="requirement_time"></a> [time](#requirement\_time) (~> 0.9)

## Modules

Expand Down Expand Up @@ -238,10 +240,14 @@ The following outputs are exported:

Description: Specifies the id of the data factory.

### <a name="output_fabric_capacity_name"></a> [fabric\_capacity\_name](#output\_fabric\_capacity\_name)
### <a name="output_data_factory_name"></a> [data\_factory\_name](#output\_data\_factory\_name)

Description: Specifies the name of the data factory.

### <a name="output_data_factory_principal_id"></a> [data\_factory\_principal\_id](#output\_data\_factory\_principal\_id)

Description: Specifies the principal id of the data factory.

<!-- markdownlint-enable -->

<!-- END_TF_DOCS -->
8 changes: 7 additions & 1 deletion modules/datafactory/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@ output "data_factory_id" {
sensitive = false
}

output "fabric_capacity_name" {
output "data_factory_name" {
description = "Specifies the name of the data factory."
value = azurerm_data_factory.data_factory.name
sensitive = false
}

output "data_factory_principal_id" {
description = "Specifies the principal id of the data factory."
value = azurerm_data_factory.data_factory.identity[0].principal_id
sensitive = false
}
Loading

0 comments on commit 6248ca6

Please sign in to comment.