-
Notifications
You must be signed in to change notification settings - Fork 703
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #920 from aztfmod/sm-apim-gateway
Add support for APIM Gateway
- Loading branch information
Showing
22 changed files
with
453 additions
and
1 deletion.
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
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
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
52 changes: 52 additions & 0 deletions
52
examples/apim/112-api_management_gateway/configuration.tfvars
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,52 @@ | ||
global_settings = { | ||
default_region = "region1" | ||
regions = { | ||
region1 = "southeastasia" | ||
} | ||
} | ||
|
||
resource_groups = { | ||
rg1 = { | ||
name = "example-agw" | ||
region = "region1" | ||
} | ||
} | ||
|
||
|
||
api_management = { | ||
apim1 = { | ||
name = "example-apim" | ||
region = "region1" | ||
resource_group = { | ||
key = "rg1" | ||
} | ||
publisher_name = "My Company" | ||
publisher_email = "[email protected]" | ||
|
||
sku_name = "Developer_1" | ||
} | ||
} | ||
|
||
api_management_gateway = { | ||
apimgw1= { | ||
name = "example-gateway" | ||
api_management = { | ||
key = "apim1" | ||
#lz_key = "" | ||
#name = "" | ||
} | ||
description = "Example API Management gateway" | ||
resource_group = { | ||
key = "rg1" | ||
#lz_key = "" | ||
#name = "" | ||
} | ||
|
||
location_data = { | ||
name = "example name" | ||
city = "example city" | ||
district = "example district" | ||
region = "example region" | ||
} | ||
} | ||
} |
88 changes: 88 additions & 0 deletions
88
examples/apim/113-api_management_gateway_api/configuration.tfvars
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,88 @@ | ||
global_settings = { | ||
default_region = "region1" | ||
regions = { | ||
region1 = "southeastasia" | ||
} | ||
} | ||
|
||
resource_groups = { | ||
rg1 = { | ||
name = "example-agw" | ||
region = "region1" | ||
} | ||
} | ||
|
||
|
||
api_management = { | ||
apim1 = { | ||
name = "example-apim" | ||
region = "region1" | ||
resource_group = { | ||
key = "rg1" | ||
} | ||
publisher_name = "My Company" | ||
publisher_email = "[email protected]" | ||
|
||
sku_name = "Developer_1" | ||
} | ||
} | ||
|
||
api_management_api = { | ||
apima1 = { | ||
name = "example-api" | ||
resource_group = { | ||
key = "rg1" | ||
} | ||
api_management = { | ||
key = "apim1" | ||
} | ||
revision = "1" | ||
display_name = "Example API" | ||
path = "example" | ||
protocols = ["https"] | ||
|
||
import = { | ||
content_format = "swagger-link-json" | ||
content_value = "http://conferenceapi.azurewebsites.net/?format=json" | ||
} | ||
} | ||
} | ||
|
||
api_management_gateway = { | ||
apimgw1= { | ||
name = "example-gateway" | ||
api_management = { | ||
key = "apim1" | ||
#lz_key = "" | ||
#name = "" | ||
} | ||
description = "Example API Management gateway" | ||
resource_group = { | ||
key = "rg1" | ||
#lz_key = "" | ||
#name = "" | ||
} | ||
|
||
location_data = { | ||
name = "example name" | ||
city = "example city" | ||
district = "example district" | ||
region = "example region" | ||
} | ||
} | ||
} | ||
|
||
api_management_gateway_api = { | ||
apimgwapi1 = { | ||
api_management_gateway = { | ||
key = "apimgw1" | ||
#lz_key = "" | ||
#id = "" | ||
} | ||
api_management_api = { | ||
key = "apima1" | ||
#lz_key = "" | ||
#id = "" | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
examples/apim/114-api-management-group/configuration.tfvars
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,43 @@ | ||
global_settings = { | ||
default_region = "region1" | ||
regions = { | ||
region1 = "southeastasia" | ||
} | ||
} | ||
|
||
resource_groups = { | ||
rg1 = { | ||
name = "example-agw" | ||
region = "region1" | ||
} | ||
} | ||
|
||
|
||
api_management = { | ||
apim1 = { | ||
name = "example-apim" | ||
region = "region1" | ||
resource_group = { | ||
key = "rg1" | ||
} | ||
publisher_name = "My Company" | ||
publisher_email = "[email protected]" | ||
|
||
sku_name = "Developer_1" | ||
} | ||
} | ||
|
||
api_management_group = { | ||
apimg1 = { | ||
|
||
name = "example-apimg" | ||
resource_group = { | ||
key = "rg1" | ||
} | ||
api_management = { | ||
key = "apim1" | ||
} | ||
display_name = "Example Group" | ||
description = "This is an example API management group." | ||
} | ||
} |
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
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
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
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
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,8 @@ | ||
terraform { | ||
required_providers { | ||
azurecaf = { | ||
source = "aztfmod/azurecaf" | ||
} | ||
} | ||
required_version = ">= 0.13" | ||
} |
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,41 @@ | ||
resource "azurecaf_name" "apim" { | ||
name = var.settings.name | ||
resource_type = "azurerm_data_factory" #"azurerm_api_management_api" | ||
prefixes = var.global_settings.prefixes | ||
random_length = var.global_settings.random_length | ||
clean_input = true | ||
passthrough = var.global_settings.passthrough | ||
use_slug = var.global_settings.use_slug | ||
} | ||
|
||
resource "azurerm_api_management_gateway" "apim" { | ||
name = azurecaf_name.apim.result | ||
|
||
api_management_id = coalesce( | ||
try(var.remote_objects.api_management[var.settings.api_management.lz_key][var.settings.api_management.key].id, null), | ||
try(var.remote_objects.api_management[var.client_config.landingzone_key][var.settings.api_management.key].id, null), | ||
try(var.settings.api_management.id, null) | ||
) | ||
|
||
# resource_group_name exists in the documentation but not in the provider Source code | ||
# https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_gateway | ||
# | ||
# | ||
# resource_group_name = coalesce( | ||
# try(var.remote_objects.resource_group[var.settings.resource_group.lz_key][var.settings.resource_group.key].name, null), | ||
# try(var.remote_objects.resource_group[var.client_config.landingzone_key][var.settings.resource_group.key].name, null), | ||
# try(var.settings.resource_group.name, null) | ||
# ) | ||
|
||
description = try(var.settings.description, null) | ||
|
||
dynamic "location_data" { | ||
for_each = try(var.settings.location_data, null) != null ? [var.settings.location_data] : [] | ||
content { | ||
name = try(location_data.value.name, null) | ||
region = try(location_data.value.region, null) | ||
city = try(location_data.value.city, null) | ||
district = try(location_data.value.district, null) | ||
} | ||
} | ||
} |
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,4 @@ | ||
output "id" { | ||
value = azurerm_api_management_gateway.apim.id | ||
description = "The ID of the API Management Gateway." | ||
} |
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,18 @@ | ||
variable "global_settings" { | ||
description = "Global settings object (see module README.md)" | ||
} | ||
variable "client_config" { | ||
description = "Client configuration object (see module README.md)." | ||
} | ||
variable "settings" { | ||
description = "(Required) Used to handle passthrough paramenters." | ||
} | ||
variable "remote_objects" { | ||
description = "(Required) Specifies the supported Azure location where to create the resource. Changing this forces a new resource to be created." | ||
default = {} | ||
} | ||
variable "base_tags" { | ||
description = "Base tags for the resource to be inherited from the resource group." | ||
type = map(any) | ||
default = {} | ||
} |
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,8 @@ | ||
terraform { | ||
required_providers { | ||
azurecaf = { | ||
source = "aztfmod/azurecaf" | ||
} | ||
} | ||
required_version = ">= 0.13" | ||
} |
Oops, something went wrong.