diff --git a/quickstart/101-azure-api-management-create-with-api/README.md b/quickstart/101-azure-api-management-create-with-api/README.md index 8b39a508a..7b854fae8 100644 --- a/quickstart/101-azure-api-management-create-with-api/README.md +++ b/quickstart/101-azure-api-management-create-with-api/README.md @@ -22,5 +22,7 @@ This template deploys an Azure API Management service, containing an API (based | `resource_group_location` | Location of the resource group. | eastus | | `open_api_spec_content_format` | The format of the content from which the API Definition should be imported. Possible values are: openapi, openapi+json, openapi+json-link, openapi-link, swagger-json, swagger-link-json, wadl-link-json, wadl-xml, wsdl and wsdl-link. | swagger-link-json | | `open_api_spec_content_value` | The Content from which the API Definition should be imported. When a content_format of *-link-* is specified this must be a URL, otherwise this must be defined inline. | http://conferenceapi.azurewebsites.net/?format=json | - -## Example +| `publisher_email` | Email address of the owner of the service. | test@contoso.com | +| `publisher_name` | Name of the owner of the service. | publisher | +| `sku_name` | Pricing tier of this API Management service. Must be one of the following values: Basic, BasicV2, Consumption, Developer, Premium, PremiumV2, Standard, StandardV2 | BasicV2 | +| `sku_count` | Instance size of this API Management service. | 1 | diff --git a/quickstart/101-azure-api-management-create-with-api/main.tf b/quickstart/101-azure-api-management-create-with-api/main.tf index a506d308a..0c39df9a0 100644 --- a/quickstart/101-azure-api-management-create-with-api/main.tf +++ b/quickstart/101-azure-api-management-create-with-api/main.tf @@ -19,22 +19,9 @@ resource "azurerm_api_management" "apim_service" { name = "${random_string.apim_service_name.result}-apim-service" location = azurerm_resource_group.rg.location resource_group_name = azurerm_resource_group.rg.name - publisher_name = "Example Publisher" - publisher_email = "publisher@example.com" - sku_name = "Developer_1" - tags = { - Environment = "Example" - } - policy { - xml_content = < - - - - - -XML - } + publisher_email = var.publisher_email + publisher_name = var.publisher_name + sku_name = "${var.sku_name}_${var.sku_count}" } resource "random_string" "api_name" { diff --git a/quickstart/101-azure-api-management-create-with-api/providers.tf b/quickstart/101-azure-api-management-create-with-api/providers.tf index b052395bb..76e9ac65e 100644 --- a/quickstart/101-azure-api-management-create-with-api/providers.tf +++ b/quickstart/101-azure-api-management-create-with-api/providers.tf @@ -4,7 +4,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "~>3.0" + version = "~>4.0" } random = { source = "hashicorp/random" diff --git a/quickstart/101-azure-api-management-create-with-api/variables.tf b/quickstart/101-azure-api-management-create-with-api/variables.tf index 28d8ceedf..d0fa57aab 100644 --- a/quickstart/101-azure-api-management-create-with-api/variables.tf +++ b/quickstart/101-azure-api-management-create-with-api/variables.tf @@ -25,3 +25,44 @@ variable "open_api_spec_content_value" { default = "https://petstore3.swagger.io/api/v3/openapi.json" description = "The Content from which the API Definition should be imported. When a content_format of *-link-* is specified this must be a URL, otherwise this must be defined inline." } + + +variable "publisher_email" { + default = "test@contoso.com" + description = "The email address of the owner of the service" + type = string + validation { + condition = length(var.publisher_email) > 0 + error_message = "The publisher_email must contain at least one character." + } +} + +variable "publisher_name" { + default = "publisher" + description = "The name of the owner of the service" + type = string + validation { + condition = length(var.publisher_name) > 0 + error_message = "The publisher_name must contain at least one character." + } +} + +variable "sku_name" { + description = "The pricing tier of this API Management service" + default = "BasicV2" + type = string + validation { + condition = contains(["Basic", "BasicV2", "Consumption", "Developer", "Premium", "PremiumV2", "Standard", "StandardV2"], var.sku_name) + error_message = "The sku must be one of the following: Basic, BasicV2, Consumption, Developer, Premium, PremiumV2, Standard, StandardV2." + } +} + +variable "sku_count" { + description = "The instance size of this API Management service." + default = 1 + type = number + validation { + condition = contains([1, 2], var.sku_count) + error_message = "The sku_count must be one of the following: 1, 2." + } +} \ No newline at end of file diff --git a/quickstart/101-azure-api-management-create/providers.tf b/quickstart/101-azure-api-management-create/providers.tf index 4fd5f6ba7..9b1fd1985 100644 --- a/quickstart/101-azure-api-management-create/providers.tf +++ b/quickstart/101-azure-api-management-create/providers.tf @@ -3,7 +3,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "~>3.0" + version = "~>4.0" } random = { source = "hashicorp/random"