Skip to content

Commit

Permalink
Merge pull request #1 from AnkitToTheNew/ankit
Browse files Browse the repository at this point in the history
API Management  Terraform Module
  • Loading branch information
rahulttn authored Aug 20, 2024
2 parents 60dfb5e + 65396b6 commit e22e578
Show file tree
Hide file tree
Showing 16 changed files with 1,051 additions and 21 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.terraform
main.tf
terraform.tfvars
.terraform.lock.hcl
!examples/**/main.tf
!examples/**/terraform.tfvars
197 changes: 178 additions & 19 deletions README.md

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions _data.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
data "azurecaf_name" "apim" {
name = var.stack
resource_type = "azurerm_api_management"
prefixes = var.name_prefix == "" ? null : [local.name_prefix]
suffixes = compact([var.client_name, var.environment, local.name_suffix, var.use_caf_naming ? "" : "apim"])
use_slug = var.use_caf_naming
clean_input = true
separator = "-"
}

data "azurecaf_name" "apim_nsg_rule" {
name = var.stack
resource_type = "azurerm_network_security_rule"
prefixes = var.name_prefix == "" ? null : [local.name_prefix]
suffixes = compact([var.client_name, var.environment, local.name_suffix, var.use_caf_naming ? "" : "apim-nsg"])
use_slug = var.use_caf_naming
clean_input = true
separator = "-"
}
13 changes: 13 additions & 0 deletions _locals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
locals {
default_tags = var.default_tags_enabled ? {
env = var.environment
stack = var.stack
} : {}

# Naming locals/constants
name_prefix = lower(var.name_prefix)
name_suffix = lower(var.name_suffix)

apim_name = coalesce(var.custom_name, data.azurecaf_name.apim.result)
nsg_rule_name = coalesce(var.custom_management_rule_name, data.azurecaf_name.apim_nsg_rule.result)
}
54 changes: 54 additions & 0 deletions _outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
output "api_management_name" {
description = "The name of the API Management Service"
value = azurerm_api_management.apim.name
}

output "api_management_id" {
description = "The ID of the API Management Service"
value = azurerm_api_management.apim.id
}

output "api_management_additional_location" {
description = "Map listing gateway_regional_url and public_ip_addresses associated"
value = azurerm_api_management.apim.additional_location
}

output "api_management_gateway_url" {
description = "The URL of the Gateway for the API Management Service"
value = azurerm_api_management.apim.gateway_url
}

output "api_management_gateway_regional_url" {
description = "The Region URL for the Gateway of the API Management Service"
value = azurerm_api_management.apim.gateway_regional_url
}

output "api_management_management_api_url" {
description = "The URL for the Management API associated with this API Management service"
value = azurerm_api_management.apim.management_api_url
}

output "api_management_portal_url" {
description = "The URL for the Publisher Portal associated with this API Management service"
value = azurerm_api_management.apim.portal_url
}

output "api_management_public_ip_addresses" {
description = "The Public IP addresses of the API Management Service"
value = azurerm_api_management.apim.public_ip_addresses
}

output "api_management_private_ip_addresses" {
description = "The Private IP addresses of the API Management Service"
value = azurerm_api_management.apim.private_ip_addresses
}

output "api_management_scm_url" {
description = "The URL for the SCM Endpoint associated with this API Management service"
value = azurerm_api_management.apim.scm_url
}

output "api_management_identity" {
description = "The identity of the API Management"
value = azurerm_api_management.apim.identity
}
Loading

0 comments on commit e22e578

Please sign in to comment.