From 74b0900081a6403954f8ca639d9ba98fc45359e4 Mon Sep 17 00:00:00 2001 From: Tom Archer Date: Tue, 29 Jul 2025 14:11:06 -0700 Subject: [PATCH 1/5] updates per api change --- .../README.md | 6 ++- .../main.tf | 19 ++------- .../variables.tf | 41 +++++++++++++++++++ 3 files changed, 48 insertions(+), 18 deletions(-) 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..02fd2831d 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` | Pricing tier of this API Management service. Must be one of the following values: Consumption, Developer, Basic, BasicV2, Standard, StandardV2, Premium, PremiumV2. | Developer | +| `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..3699650c6 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}_${var.sku_count}" } resource "random_string" "api_name" { 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..954da77d8 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" { + description = "The pricing tier of this API Management service" + default = "Developer" + type = string + validation { + condition = contains(["Consumption", "Developer", "Basic", "BasicV2", "Standard", "StandardV2", "Premium", "PremiumV2"], var.sku) + error_message = "The sku must be one of the following: Consumption, Developer, Basic, BasicV2, Standard, StandardV2, Premium, PremiumV2." + } +} + +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 From b339c13c59ac9eb334bbc6d39e82b1842bc59b29 Mon Sep 17 00:00:00 2001 From: Tom Archer Date: Fri, 1 Aug 2025 13:19:47 -0700 Subject: [PATCH 2/5] changes to work with latest azurerm provider --- quickstart/101-azure-api-management-create/providers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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" From 0163770807cc26aedca1958062db5bcc43b3975e Mon Sep 17 00:00:00 2001 From: Tom Archer Date: Fri, 1 Aug 2025 13:32:50 -0700 Subject: [PATCH 3/5] updates --- .../101-azure-api-management-create-with-api/README.md | 2 +- .../101-azure-api-management-create-with-api/main.tf | 2 +- .../101-azure-api-management-create-with-api/variables.tf | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) 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 02fd2831d..86c33183e 100644 --- a/quickstart/101-azure-api-management-create-with-api/README.md +++ b/quickstart/101-azure-api-management-create-with-api/README.md @@ -24,5 +24,5 @@ This template deploys an Azure API Management service, containing an API (based | `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 | | `publisher_email` | Email address of the owner of the service. | test@contoso.com | | `publisher_name` | Name of the owner of the service. | publisher | -| `sku` | Pricing tier of this API Management service. Must be one of the following values: Consumption, Developer, Basic, BasicV2, Standard, StandardV2, Premium, PremiumV2. | Developer | +| `sku_name` | Pricing tier of this API Management service. Must be one of the following values: Basic, BasicV2, Consumption, Developer, Premium, PremiumV2, Standard, StandardV2 | BatchV2 | | `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 3699650c6..0c39df9a0 100644 --- a/quickstart/101-azure-api-management-create-with-api/main.tf +++ b/quickstart/101-azure-api-management-create-with-api/main.tf @@ -21,7 +21,7 @@ resource "azurerm_api_management" "apim_service" { resource_group_name = azurerm_resource_group.rg.name publisher_email = var.publisher_email publisher_name = var.publisher_name - sku_name = "${var.sku}_${var.sku_count}" + sku_name = "${var.sku_name}_${var.sku_count}" } resource "random_string" "api_name" { 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 954da77d8..14683f34c 100644 --- a/quickstart/101-azure-api-management-create-with-api/variables.tf +++ b/quickstart/101-azure-api-management-create-with-api/variables.tf @@ -47,13 +47,13 @@ variable "publisher_name" { } } -variable "sku" { +variable "sku_name" { description = "The pricing tier of this API Management service" - default = "Developer" + default = "BatchV2" type = string validation { - condition = contains(["Consumption", "Developer", "Basic", "BasicV2", "Standard", "StandardV2", "Premium", "PremiumV2"], var.sku) - error_message = "The sku must be one of the following: Consumption, Developer, Basic, BasicV2, Standard, StandardV2, Premium, PremiumV2." + 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." } } From 10bc244762392454b038fa4f712a3e346c6b1247 Mon Sep 17 00:00:00 2001 From: Tom Archer Date: Fri, 1 Aug 2025 13:35:16 -0700 Subject: [PATCH 4/5] fixed typo --- quickstart/101-azure-api-management-create-with-api/README.md | 2 +- .../101-azure-api-management-create-with-api/variables.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 86c33183e..7b854fae8 100644 --- a/quickstart/101-azure-api-management-create-with-api/README.md +++ b/quickstart/101-azure-api-management-create-with-api/README.md @@ -24,5 +24,5 @@ This template deploys an Azure API Management service, containing an API (based | `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 | | `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 | BatchV2 | +| `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/variables.tf b/quickstart/101-azure-api-management-create-with-api/variables.tf index 14683f34c..d0fa57aab 100644 --- a/quickstart/101-azure-api-management-create-with-api/variables.tf +++ b/quickstart/101-azure-api-management-create-with-api/variables.tf @@ -49,7 +49,7 @@ variable "publisher_name" { variable "sku_name" { description = "The pricing tier of this API Management service" - default = "BatchV2" + default = "BasicV2" type = string validation { condition = contains(["Basic", "BasicV2", "Consumption", "Developer", "Premium", "PremiumV2", "Standard", "StandardV2"], var.sku_name) From d2ef93663ed1efbb536847519e9b88b146a0f0b7 Mon Sep 17 00:00:00 2001 From: Tom Archer Date: Fri, 1 Aug 2025 13:45:37 -0700 Subject: [PATCH 5/5] set provider version --- .../101-azure-api-management-create-with-api/providers.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"