Skip to content

Commit

Permalink
DEVOPS-255 apim tf module
Browse files Browse the repository at this point in the history
  • Loading branch information
githubofkrishnadhas committed Jul 30, 2024
1 parent 3bbd727 commit 094ff7e
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 0 deletions.
14 changes: 14 additions & 0 deletions api-management/apim.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
resource "azurerm_resource_group" "rg" {
name = var.resource_group_name
location = var.location
}

resource "azurerm_api_management" "apim" {
name = var.api_management_name
location = var.location
resource_group_name = azurerm_resource_group.rg.name
publisher_name = tostring(var.publisher_name)
publisher_email = tostring(var.publisher_email)

sku_name = "${var.sku_name_part1}_${var.sku_name_part2}"
}
29 changes: 29 additions & 0 deletions api-management/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
output "azure_resource_group_name" {
description = "Azure resource group name"
value = azurerm_resource_group.rg.name
}

output "azure_api_management_name" {
description = "Azure API management name"
value = azurerm_api_management.apim.name
}

output "azure_api_management_location" {
description = "Azure API management location"
value = azurerm_api_management.apim.location
}

output "azure_api_management_publisher_name" {
description = "Azure API management"
value = azurerm_api_management.apim.publisher_name
}

output "azure_api_management_publisher_emailids" {
description = "Azure API management publisher emails"
value = azurerm_api_management.apim.publisher_email
}

output "azure_api_management_sku" {
description = "Azure API management SKU"
value = azurerm_api_management.apim.sku_name
}
46 changes: 46 additions & 0 deletions api-management/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
variable "resource_group_name" {
type = string
description = "Azure Storage Account Rg"
}

variable "location" {
type = string
description = "Azure storage account location"
}

variable "api_management_name" {
description = "Azure api management name"
type = string
}

variable "publisher_name" {
description = "Publisher of API"
type = list(string)
validation {
condition = can(index(var.publisher_name, 0))
error_message = "A value is required for Publisher name."
}
}

variable "publisher_email" {
description = "Email ID of API publishers"
type = list(string)
validation {
condition = can(index(var.publisher_email, 0))
error_message = "At least one Publisher email is required."
}
}

variable "sku_name_part1" {
description = "SKU name of API management "
type = string
validation {
condition = contains(["Consumption","Developer","Basic","Standard", "Premium"], var.sku_name_part1)
error_message = "SKU name should be one among Consumption, Developer,Basic,Standard,Premium."
}
}

variable "sku_name_part2" {
description = "Sku capacity part"
type = string
}
7 changes: 7 additions & 0 deletions storage-account/output.tf
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
output "azurerm_resource_group" {
description = "Azure resource group name"
value = azurerm_resource_group.storage_rg.name
}

output "storage_account_name" {
description = "Azure storage account name"
value = azurerm_storage_account.storage.name
}

output "storage_account_location" {
description = "Azure storage account location"
value = azurerm_storage_account.storage.location
}

output "storage_account_delete_retention_policy" {
description = "Azure blob retention policy"
value = azurerm_storage_account.storage.blob_properties[0].delete_retention_policy
}

output "storage_account_tier" {
description = "Azure storage account tier"
value = azurerm_storage_account.storage.access_tier
}

output "storage_account_replication_type" {
description = "Azure storage account replication type"
value = azurerm_storage_account.storage.account_replication_type
}

output "storage_account_tags" {
description = "Azure storage account tags"
value = azurerm_storage_account.storage.tags
}

0 comments on commit 094ff7e

Please sign in to comment.