-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* cosmetic changes
- Loading branch information
Showing
9 changed files
with
145 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
resource "azapi_resource" "fabric_capacity" { | ||
type = "Microsoft.Fabric/capacities@2022-07-01-preview" | ||
name = "fab${var.basename}" | ||
parent_id = var.resource_group_id | ||
location = var.location | ||
schema_validation_enabled = false | ||
|
||
body = jsonencode({ | ||
properties = { | ||
administration = { | ||
members = [ | ||
var.admin_email | ||
] | ||
} | ||
} | ||
sku = { | ||
name = var.sku, | ||
tier = "Fabric" | ||
} | ||
}) | ||
tags = var.tags | ||
resource "azapi_resource" "fab_capacity" { | ||
type = "Microsoft.Fabric/capacities@2022-07-01-preview" | ||
name = "fab${var.basename}" | ||
parent_id = var.resource_group_id | ||
location = var.location | ||
schema_validation_enabled = false | ||
|
||
body = jsonencode({ | ||
properties = { | ||
administration = { | ||
members = [ | ||
var.admin_email | ||
] | ||
} | ||
} | ||
sku = { | ||
name = var.sku, | ||
tier = "Fabric" | ||
} | ||
}) | ||
tags = var.tags | ||
|
||
count = var.module_enabled ? 1 : 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
output "id" { | ||
value = ( | ||
length(azapi_resource.fab_capacity) > 0 ? | ||
azapi_resource.fab_capacity[0].id : "" | ||
) | ||
description = "Resource identifier of the instance of Fabric Capacity." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
terraform { | ||
required_providers { | ||
azapi = { | ||
source = "Azure/azapi" | ||
} | ||
} | ||
terraform { | ||
required_providers { | ||
azapi = { | ||
source = "Azure/azapi" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
module "fabric_capacity" { | ||
source = "../" | ||
basename = random_string.postfix.result | ||
resource_group_id = module.local_rg.id | ||
location = var.location | ||
sku = var.sku | ||
admin_email = var.admin_email | ||
tags = {} | ||
} | ||
|
||
# Modules dependencies | ||
|
||
module "local_rg" { | ||
source = "../../../resource-group" | ||
basename = random_string.postfix.result | ||
location = var.location | ||
tags = local.tags | ||
module "fabric_capacity" { | ||
source = "../" | ||
basename = random_string.postfix.result | ||
resource_group_id = module.local_rg.id | ||
location = var.location | ||
sku = var.sku | ||
admin_email = var.admin_email | ||
tags = {} | ||
} | ||
|
||
# Modules dependencies | ||
|
||
module "local_rg" { | ||
source = "../../../resource-group" | ||
basename = random_string.postfix.result | ||
location = var.location | ||
tags = local.tags | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
locals { | ||
tags = { | ||
Project = "Azure/azure-data-labs-modules" | ||
Module = "fabric-capacity" | ||
Toolkit = "Terraform" | ||
} | ||
locals { | ||
tags = { | ||
Project = "Azure/azure-data-labs-modules" | ||
Module = "fabric-capacity" | ||
Toolkit = "Terraform" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "id" { | ||
value = module.fabric_capacity.id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
terraform { | ||
backend "azurerm" { | ||
resource_group_name = "rg-adl-terraform-state" | ||
storage_account_name = "stadlterraformstate" | ||
container_name = "default" | ||
key = "fabriccapacity.terraform.tfstate" | ||
} | ||
|
||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = "= 3.53.0" | ||
} | ||
azapi = { | ||
source = "azure/azapi" | ||
} | ||
} | ||
} | ||
|
||
provider "azurerm" { | ||
features {} | ||
} | ||
|
||
provider "azapi" { | ||
terraform { | ||
# backend "azurerm" { | ||
# resource_group_name = "rg-adl-terraform-state" | ||
# storage_account_name = "stadlterraformstate" | ||
# container_name = "default" | ||
# key = "fabriccapacity.terraform.tfstate" | ||
# } | ||
|
||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = "= 3.53.0" | ||
} | ||
azapi = { | ||
source = "azure/azapi" | ||
} | ||
} | ||
} | ||
|
||
provider "azurerm" { | ||
features {} | ||
} | ||
|
||
provider "azapi" { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
resource "random_string" "postfix" { | ||
length = 8 | ||
special = false | ||
upper = false | ||
} | ||
|
||
variable "location" { | ||
type = string | ||
default = "North Europe" | ||
} | ||
|
||
variable "sku" { | ||
type = string | ||
default = "F2" | ||
} | ||
|
||
variable "admin_email" { | ||
type = string | ||
default = "[email protected]" | ||
resource "random_string" "postfix" { | ||
length = 8 | ||
special = false | ||
upper = false | ||
} | ||
|
||
variable "location" { | ||
type = string | ||
default = "North Europe" | ||
} | ||
|
||
variable "sku" { | ||
type = string | ||
default = "F2" | ||
} | ||
|
||
variable "admin_email" { | ||
type = string | ||
default = "[email protected]" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,41 @@ | ||
variable "basename" { | ||
type = string | ||
description = "Basename of the module." | ||
validation { | ||
condition = can(regex("^[-0-9a-zA-Z]{1,21}$", var.basename)) && can(regex("[0-9a-zA-Z]+$", var.basename)) | ||
error_message = "The name must be between 1 and 21 characters, can contain only letters, numbers, and hyphens. Must end with a letter or number. Cannot contain consecutive hyphens." | ||
} | ||
} | ||
|
||
variable "resource_group_id" { | ||
type = string | ||
description = "Resource group id." | ||
} | ||
|
||
variable "location" { | ||
type = string | ||
description = "Location of the resource group." | ||
} | ||
|
||
variable "tags" { | ||
type = map(string) | ||
default = {} | ||
description = "A mapping of tags which should be assigned to the deployed resource." | ||
} | ||
|
||
variable "sku" { | ||
type = string | ||
default = "F2" | ||
description = "" | ||
} | ||
|
||
variable "admin_email" { | ||
type = string | ||
description = "" | ||
variable "basename" { | ||
type = string | ||
description = "Basename of the module." | ||
validation { | ||
condition = can(regex("^[-0-9a-zA-Z]{1,21}$", var.basename)) && can(regex("[0-9a-zA-Z]+$", var.basename)) | ||
error_message = "The name must be between 1 and 21 characters, can contain only letters, numbers, and hyphens. Must end with a letter or number. Cannot contain consecutive hyphens." | ||
} | ||
} | ||
|
||
variable "resource_group_id" { | ||
type = string | ||
description = "Resource group id." | ||
} | ||
|
||
variable "location" { | ||
type = string | ||
description = "Location of the resource group." | ||
} | ||
|
||
variable "tags" { | ||
type = map(string) | ||
default = {} | ||
description = "A mapping of tags which should be assigned to the deployed resource." | ||
} | ||
|
||
variable "module_enabled" { | ||
type = bool | ||
description = "Variable to enable or disable the module." | ||
default = true | ||
} | ||
|
||
variable "sku" { | ||
type = string | ||
default = "F2" | ||
description = "SKU name" | ||
} | ||
|
||
variable "admin_email" { | ||
type = string | ||
description = "Fabric administrator email" | ||
} |