Skip to content

Commit

Permalink
update code
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-yechenwei committed Nov 15, 2023
1 parent 06d7fb6 commit 7a76b3e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 27 deletions.
35 changes: 16 additions & 19 deletions quickstart/301-service-fabric-apim/apim.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
resource "azurerm_api_management" "default" {
name = "${var.dns_prefix}-${var.name}-${var.environment}-apim"
location = "${azurerm_resource_group.default.location}"
resource_group_name = "${azurerm_resource_group.default.name}"
publisher_name = "${var.api_publisher_name}"
publisher_email = "${var.api_publisher_email}"
location = azurerm_resource_group.default.location
resource_group_name = azurerm_resource_group.default.name
publisher_name = var.api_publisher_name
publisher_email = var.api_publisher_email

sku {
name = "Developer"
capacity = 1
}
sku_name = "Developer_1"

# Ignore certificate changes in the future
lifecycle {
Expand All @@ -26,8 +23,8 @@ resource "azurerm_api_management" "default" {

resource "azurerm_api_management_api" "default" {
name = "demo"
resource_group_name = "${azurerm_resource_group.default.name}"
api_management_name = "${azurerm_api_management.default.name}"
resource_group_name = azurerm_resource_group.default.name
api_management_name = azurerm_api_management.default.name
revision = "1"
display_name = "Demo API"
path = ""
Expand All @@ -36,23 +33,23 @@ resource "azurerm_api_management_api" "default" {

resource "azurerm_api_management_backend" "sf" {
name = "service-fabric-backend"
resource_group_name = "${azurerm_resource_group.default.name}"
api_management_name = "${azurerm_api_management.default.name}"
resource_group_name = azurerm_resource_group.default.name
api_management_name = azurerm_api_management.default.name
protocol = "http"
url = "fabric:/fake/service"
resource_id = "${azurerm_service_fabric_cluster.default.management_endpoint}"
resource_id = azurerm_service_fabric_cluster.default.management_endpoint

service_fabric_cluster {
client_certificate_thumbprint = "${azurerm_key_vault_certificate.client.thumbprint}"
server_certificate_thumbprints = ["${azurerm_key_vault_certificate.cluster.thumbprint}"]
management_endpoints = ["${azurerm_service_fabric_cluster.default.management_endpoint}"]
max_partition_resolution_retries = 3
client_certificate_thumbprint = azurerm_key_vault_certificate.client.thumbprint
server_certificate_thumbprints = ["${azurerm_key_vault_certificate.cluster.thumbprint}"]
management_endpoints = ["${azurerm_service_fabric_cluster.default.management_endpoint}"]
max_partition_resolution_retries = 3
}
}

resource "azurerm_application_insights" "default" {
name = "${var.name}-${var.environment}-ai"
location = "West US 2"
resource_group_name = "${azurerm_resource_group.default.name}"
resource_group_name = azurerm_resource_group.default.name
application_type = "web"
}
}
10 changes: 2 additions & 8 deletions quickstart/301-service-fabric-apim/azuread.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,8 @@ resource "azuread_service_principal" "cluster" {
application_id = azuread_application.cluster.application_id
}

resource "random_string" "cluster_password" {
length = 32
special = true
}

resource "azuread_service_principal_password" "cluster" {
service_principal_id = azuread_service_principal.cluster.id
value = random_string.cluster_password.result
end_date = "2099-01-01T01:00:00Z"
}

Expand All @@ -26,8 +20,8 @@ resource "random_uuid" "reader" {

# Service Fabric Client
resource "azuread_application" "client" {
display_name = "${var.name}-client-${var.environment}"
reply_urls = ["https://${azurerm_public_ip.sf.fqdn}:19080/Explorer/index.html"]
display_name = "${var.name}-client-${var.environment}"
redirect_uris = ["https://${azurerm_public_ip.sf.fqdn}:19080/Explorer/index.html"]

app_role {
id = random_uuid.admin.result
Expand Down

0 comments on commit 7a76b3e

Please sign in to comment.