From f04e27b44d7a95d828bb84bcd0c48b2c42369c8d Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Wed, 19 Feb 2025 11:12:41 +0800 Subject: [PATCH] Add example for Microsoft.ApiManagement_service_templates@2021-08-01 --- .../main.tf | 90 +++++++++++++++++++ .../testdata/invite.html.tpl | 17 ++++ 2 files changed, 107 insertions(+) create mode 100644 examples/Microsoft.ApiManagement_service_templates@2021-08-01/main.tf create mode 100644 examples/Microsoft.ApiManagement_service_templates@2021-08-01/testdata/invite.html.tpl diff --git a/examples/Microsoft.ApiManagement_service_templates@2021-08-01/main.tf b/examples/Microsoft.ApiManagement_service_templates@2021-08-01/main.tf new file mode 100644 index 00000000..1e34c289 --- /dev/null +++ b/examples/Microsoft.ApiManagement_service_templates@2021-08-01/main.tf @@ -0,0 +1,90 @@ +terraform { + required_providers { + azapi = { + source = "Azure/azapi" + } + } +} + +provider "azapi" { + skip_provider_registration = false +} + +variable "resource_name" { + type = string + default = "acctest0001" +} + +variable "location" { + type = string + default = "westeurope" +} + +resource "azapi_resource" "resourceGroup" { + type = "Microsoft.Resources/resourceGroups@2020-06-01" + name = var.resource_name + location = var.location +} + +resource "azapi_resource" "service" { + type = "Microsoft.ApiManagement/service@2021-08-01" + parent_id = azapi_resource.resourceGroup.id + name = var.resource_name + location = var.location + body = { + properties = { + certificates = [ + ] + customProperties = { + "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Ssl30" = "false" + "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls10" = "false" + "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Backend.Protocols.Tls11" = "false" + "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA" = "false" + "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA" = "false" + "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA" = "false" + "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA" = "false" + "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA" = "false" + "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_CBC_SHA256" = "false" + "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_128_GCM_SHA256" = "false" + "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_256_CBC_SHA" = "false" + "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_256_CBC_SHA256" = "false" + "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TLS_RSA_WITH_AES_256_GCM_SHA384" = "false" + "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Ciphers.TripleDes168" = "false" + "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Ssl30" = "false" + "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls10" = "false" + "Microsoft.WindowsAzure.ApiManagement.Gateway.Security.Protocols.Tls11" = "false" + } + disableGateway = false + publicNetworkAccess = "Enabled" + publisherEmail = "pub1@email.com" + publisherName = "pub1" + virtualNetworkType = "None" + } + sku = { + capacity = 1 + name = "Developer" + } + } + schema_validation_enabled = false + response_export_values = ["*"] + timeouts { + create = "180m" + update = "180m" + delete = "180m" + } +} + +resource "azapi_update_resource" "template" { + type = "Microsoft.ApiManagement/service/templates@2021-08-01" + name = "InviteUserNotificationMessage" + parent_id = azapi_resource.service.id + body = { + properties = { + subject = "Customized confirmation email for your new $OrganizationName API account" + body = templatefile("${path.module}/testdata/invite.html.tpl", { + developer_portal_url = azapi_resource.service.output.properties.developerPortalUrl + }) + title = "Invite user" + } + } +} diff --git a/examples/Microsoft.ApiManagement_service_templates@2021-08-01/testdata/invite.html.tpl b/examples/Microsoft.ApiManagement_service_templates@2021-08-01/testdata/invite.html.tpl new file mode 100644 index 00000000..d026169b --- /dev/null +++ b/examples/Microsoft.ApiManagement_service_templates@2021-08-01/testdata/invite.html.tpl @@ -0,0 +1,17 @@ + + + + +

Dear $DevFirstName $DevLastName,

+

+ Your account has been created. Please follow the link below to visit the $OrganizationName developer portal + and claim it: +

+

+ ${developer_portal_url}/confirm-v2/identities/basic/invite?$ConfirmQuery +

+

Best,

+

The $OrganizationName API Team

+ + \ No newline at end of file