Skip to content

Commit 98b54c6

Browse files
authored
Removed unused APIs from Platform APIM (#650)
1 parent e59d3f5 commit 98b54c6

File tree

7 files changed

+47
-127
lines changed

7 files changed

+47
-127
lines changed

infra/resources/_modules/apim/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ No requirements.
3434
| [azurerm_api_management_api_operation_policy.set_wallet_instance_status_pdnd_policy](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_operation_policy) | resource |
3535
| [azurerm_api_management_api_operation_policy.set_wallet_instance_status_policy](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_operation_policy) | resource |
3636
| [azurerm_api_management_named_value.app_func_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource |
37-
| [azurerm_api_management_named_value.support_func_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource |
3837
| [azurerm_api_management_named_value.user_func_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource |
3938
| [azurerm_api_management_named_value.user_func_key_admin](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_named_value) | resource |
4039
| [azurerm_key_vault_secret.support_func_key_default](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/key_vault_secret) | data source |

infra/resources/_modules/apim/api/support/_base_policy.xml

Lines changed: 0 additions & 11 deletions
This file was deleted.

infra/resources/_modules/apim/apim.tf

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,27 +65,16 @@ module "apim_v2_wallet_support_api" {
6565
product_ids = [module.apim_v2_wallet_support_product.product_id]
6666
subscription_required = true
6767

68-
service_url = format("https://%s/api/v1/wallet", var.function_apps.support_function.function_hostname)
68+
service_url = "https://api.internal.wallet.io.pagopa.it/api/wallet/support/v1"
6969

7070
description = "API for Wallet Support Assistance"
7171
display_name = "IO Wallet - Support"
7272
path = "api/v1/wallet/support"
7373
protocols = ["https"]
74+
revision = "2"
7475

7576
content_format = "openapi"
76-
77-
content_value = file("${path.module}/api/support/_swagger.json")
78-
79-
xml_content = file("${path.module}/api/support/_base_policy.xml")
80-
}
81-
82-
resource "azurerm_api_management_named_value" "support_func_key" {
83-
name = "io-wallet-support-func-key"
84-
api_management_name = var.apim.name
85-
resource_group_name = var.apim.resource_group_name
86-
display_name = "io-wallet-support-func-key"
87-
value = data.azurerm_key_vault_secret.support_func_key_default.value
88-
secret = "true"
77+
content_value = file("${path.module}/api/support/_swagger.json")
8978
}
9079

9180
data "azurerm_key_vault_secret" "support_func_key_default" {

infra/resources/prod/README.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,21 @@
3636

3737
| Name | Type |
3838
|------|------|
39-
| [azurerm_api_management_api.wallet_support_v1](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api) | resource |
40-
| [azurerm_api_management_api.wallet_user_uat](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api) | resource |
41-
| [azurerm_api_management_api.wallet_user_v1](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api) | resource |
42-
| [azurerm_api_management_api_policy.wallet_support](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_policy) | resource |
43-
| [azurerm_api_management_api_policy.wallet_user](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_policy) | resource |
44-
| [azurerm_api_management_api_policy.wallet_user_uat](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_policy) | resource |
45-
| [azurerm_api_management_api_tag.wallet_support](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_tag) | resource |
39+
| [azurerm_api_management_api.wallet_user_ioapp_v1](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api) | resource |
40+
| [azurerm_api_management_api.wallet_user_uat_ioapp_v1](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api) | resource |
41+
| [azurerm_api_management_api_policy.wallet_user_uat_v1](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_policy) | resource |
42+
| [azurerm_api_management_api_policy.wallet_user_v1](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_policy) | resource |
4643
| [azurerm_api_management_api_tag.wallet_user](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_tag) | resource |
4744
| [azurerm_api_management_api_tag.wallet_user_uat](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_tag) | resource |
48-
| [azurerm_api_management_api_version_set.wallet_support](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource |
49-
| [azurerm_api_management_api_version_set.wallet_user](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource |
45+
| [azurerm_api_management_api_version_set.wallet_user_ioapp](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource |
46+
| [azurerm_api_management_api_version_set.wallet_user_uat_ioapp](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_api_version_set) | resource |
5047
| [azurerm_api_management_backend.psn](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_backend) | resource |
5148
| [azurerm_api_management_policy_fragment.wallet_authentication](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_policy_fragment) | resource |
5249
| [azurerm_api_management_product.wallet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_product) | resource |
53-
| [azurerm_api_management_product.wallet_private](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_product) | resource |
54-
| [azurerm_api_management_product_api.wallet_support](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_product_api) | resource |
55-
| [azurerm_api_management_product_api.wallet_user](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_product_api) | resource |
50+
| [azurerm_api_management_product_api.wallet_user_uat_v1](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_product_api) | resource |
51+
| [azurerm_api_management_product_api.wallet_user_v1](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_product_api) | resource |
5652
| [azurerm_api_management_tag.wallet](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/api_management_tag) | resource |
57-
| [azurerm_dns_a_record.wallet_io_pagopa_it](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/dns_a_record) | resource |
53+
| [azurerm_dns_cname_record.wallet_io_pagopa_it](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/dns_cname_record) | resource |
5854
| [azurerm_dns_txt_record.wallet_io_pagopa_it](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/dns_txt_record) | resource |
5955
| [azurerm_key_vault_secret.app_insights_connection_string](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource |
6056
| [azurerm_key_vault_secret.func_support_default_key](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_secret) | resource |

infra/resources/prod/apim_platform.tf

Lines changed: 28 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ resource "azurerm_api_management_policy_fragment" "wallet_authentication" {
1717

1818
resource "azurerm_api_management_product" "wallet" {
1919
product_id = "it-wallet"
20-
display_name = "IT WALLET"
20+
display_name = "IT WALLET - Public"
2121
description = "Product for IT-Wallet APIs without subscription"
2222

2323
api_management_name = data.azurerm_api_management.platform_api_gateway.name
@@ -28,47 +28,34 @@ resource "azurerm_api_management_product" "wallet" {
2828
approval_required = false
2929
}
3030

31-
resource "azurerm_api_management_product" "wallet_private" {
32-
product_id = "it-wallet-private"
33-
display_name = "IT WALLET - Private"
34-
description = "Product for IT-Wallet APIs with subscription"
35-
36-
api_management_name = data.azurerm_api_management.platform_api_gateway.name
37-
resource_group_name = data.azurerm_api_management.platform_api_gateway.resource_group_name
38-
39-
published = true
40-
subscription_required = true
41-
approval_required = false
42-
}
43-
44-
resource "azurerm_api_management_api_version_set" "wallet_user" {
45-
name = "wallet-user-apis"
31+
resource "azurerm_api_management_api_version_set" "wallet_user_ioapp" {
32+
name = "wallet-user-ioapp-apis"
4633
api_management_name = data.azurerm_api_management.platform_api_gateway.name
4734
resource_group_name = data.azurerm_api_management.platform_api_gateway.resource_group_name
48-
display_name = "Wallet User"
35+
display_name = "Wallet User - IO App"
4936
versioning_scheme = "Segment"
5037
}
5138

52-
resource "azurerm_api_management_api_version_set" "wallet_support" {
53-
name = "wallet-support-apis"
39+
resource "azurerm_api_management_api_version_set" "wallet_user_uat_ioapp" {
40+
name = "wallet-user-uat-ioapp-apis"
5441
api_management_name = data.azurerm_api_management.platform_api_gateway.name
5542
resource_group_name = data.azurerm_api_management.platform_api_gateway.resource_group_name
56-
display_name = "Wallet Customer Support"
43+
display_name = "Wallet User UAT - IO App"
5744
versioning_scheme = "Segment"
5845
}
5946

60-
resource "azurerm_api_management_api" "wallet_user_v1" {
61-
name = "wallet-user-api-v1"
47+
resource "azurerm_api_management_api" "wallet_user_ioapp_v1" {
48+
name = "wallet-user-ioapp-api-v1"
6249
api_management_name = data.azurerm_api_management.platform_api_gateway.name
6350
resource_group_name = data.azurerm_api_management.platform_api_gateway.resource_group_name
6451
subscription_required = false
6552

66-
version_set_id = azurerm_api_management_api_version_set.wallet_user.id
53+
version_set_id = azurerm_api_management_api_version_set.wallet_user_ioapp.id
6754
version = "v1"
6855
revision = 1
6956

7057
description = "REST APIs consumed by IO App"
71-
display_name = "IT-Wallet User"
58+
display_name = "IT-Wallet User - IO App v1"
7259
path = "api/wallet"
7360
protocols = ["https"]
7461

@@ -78,19 +65,19 @@ resource "azurerm_api_management_api" "wallet_user_v1" {
7865
}
7966
}
8067

81-
resource "azurerm_api_management_api" "wallet_user_uat" {
82-
name = "wallet-user-api-uat"
68+
resource "azurerm_api_management_api" "wallet_user_uat_ioapp_v1" {
69+
name = "wallet-user-uat-ioapp-api-v1"
8370
api_management_name = data.azurerm_api_management.platform_api_gateway.name
8471
resource_group_name = data.azurerm_api_management.platform_api_gateway.resource_group_name
8572
subscription_required = false
8673

87-
version_set_id = azurerm_api_management_api_version_set.wallet_user.id
88-
version = "uat"
74+
version_set_id = azurerm_api_management_api_version_set.wallet_user_uat_ioapp.id
75+
version = "v1"
8976
revision = 1
9077

9178
description = "REST APIs consumed by IO App"
92-
display_name = "IT-Wallet User (UAT)"
93-
path = "api/wallet"
79+
display_name = "IT-Wallet User UAT - IO App v1"
80+
path = "api/wallet/uat"
9481
protocols = ["https"]
9582

9683
import {
@@ -99,63 +86,37 @@ resource "azurerm_api_management_api" "wallet_user_uat" {
9986
}
10087
}
10188

102-
resource "azurerm_api_management_api" "wallet_support_v1" {
103-
name = "wallet-support-api-v1"
104-
api_management_name = data.azurerm_api_management.platform_api_gateway.name
105-
resource_group_name = data.azurerm_api_management.platform_api_gateway.resource_group_name
106-
subscription_required = true
107-
108-
version_set_id = azurerm_api_management_api_version_set.wallet_support.id
109-
version = "v1"
110-
revision = 1
111-
112-
description = "REST APIs consumed by Customer Service Support"
113-
display_name = "IT-Wallet Customer Support"
114-
path = "api/wallet/support"
115-
protocols = ["https"]
116-
117-
import {
118-
content_format = "openapi-link"
119-
content_value = "https://raw.githubusercontent.com/pagopa/io-wallet/refs/heads/master/apps/io-wallet-support-func/openapi.yaml"
120-
}
121-
}
122-
12389
resource "azurerm_api_management_tag" "wallet" {
12490
api_management_id = data.azurerm_api_management.platform_api_gateway.id
12591
name = "it-wallet"
12692
}
12793

12894
resource "azurerm_api_management_api_tag" "wallet_user" {
129-
api_id = azurerm_api_management_api.wallet_user_v1.id
95+
api_id = azurerm_api_management_api.wallet_user_ioapp_v1.id
13096
name = azurerm_api_management_tag.wallet.name
13197
}
13298

13399
resource "azurerm_api_management_api_tag" "wallet_user_uat" {
134-
api_id = azurerm_api_management_api.wallet_user_uat.id
135-
name = azurerm_api_management_tag.wallet.name
136-
}
137-
138-
resource "azurerm_api_management_api_tag" "wallet_support" {
139-
api_id = azurerm_api_management_api.wallet_support_v1.id
100+
api_id = azurerm_api_management_api.wallet_user_uat_ioapp_v1.id
140101
name = azurerm_api_management_tag.wallet.name
141102
}
142103

143-
resource "azurerm_api_management_product_api" "wallet_user" {
144-
api_name = azurerm_api_management_api.wallet_user_v1.name
104+
resource "azurerm_api_management_product_api" "wallet_user_v1" {
105+
api_name = azurerm_api_management_api.wallet_user_ioapp_v1.name
145106
product_id = azurerm_api_management_product.wallet.product_id
146107
api_management_name = data.azurerm_api_management.platform_api_gateway.name
147108
resource_group_name = data.azurerm_api_management.platform_api_gateway.resource_group_name
148109
}
149110

150-
resource "azurerm_api_management_product_api" "wallet_support" {
151-
api_name = azurerm_api_management_api.wallet_support_v1.name
152-
product_id = azurerm_api_management_product.wallet_private.product_id
111+
resource "azurerm_api_management_product_api" "wallet_user_uat_v1" {
112+
api_name = azurerm_api_management_api.wallet_user_uat_ioapp_v1.name
113+
product_id = azurerm_api_management_product.wallet.product_id
153114
api_management_name = data.azurerm_api_management.platform_api_gateway.name
154115
resource_group_name = data.azurerm_api_management.platform_api_gateway.resource_group_name
155116
}
156117

157-
resource "azurerm_api_management_api_policy" "wallet_user" {
158-
api_name = azurerm_api_management_api.wallet_user_v1.name
118+
resource "azurerm_api_management_api_policy" "wallet_user_v1" {
119+
api_name = azurerm_api_management_api.wallet_user_ioapp_v1.name
159120
api_management_name = data.azurerm_api_management.platform_api_gateway.name
160121
resource_group_name = data.azurerm_api_management.platform_api_gateway.resource_group_name
161122
xml_content = <<XML
@@ -170,8 +131,8 @@ resource "azurerm_api_management_api_policy" "wallet_user" {
170131
XML
171132
}
172133

173-
resource "azurerm_api_management_api_policy" "wallet_user_uat" {
174-
api_name = azurerm_api_management_api.wallet_user_uat.name
134+
resource "azurerm_api_management_api_policy" "wallet_user_uat_v1" {
135+
api_name = azurerm_api_management_api.wallet_user_uat_ioapp_v1.name
175136
api_management_name = data.azurerm_api_management.platform_api_gateway.name
176137
resource_group_name = data.azurerm_api_management.platform_api_gateway.resource_group_name
177138
xml_content = <<XML
@@ -185,18 +146,3 @@ resource "azurerm_api_management_api_policy" "wallet_user_uat" {
185146
</policies>
186147
XML
187148
}
188-
189-
resource "azurerm_api_management_api_policy" "wallet_support" {
190-
api_name = azurerm_api_management_api.wallet_support_v1.name
191-
api_management_name = data.azurerm_api_management.platform_api_gateway.name
192-
resource_group_name = data.azurerm_api_management.platform_api_gateway.resource_group_name
193-
xml_content = <<XML
194-
<policies>
195-
<inbound>
196-
<base />
197-
<rewrite-uri template="@("/api/wallet/support/v1/" + context.Request.Url.Path)" />
198-
<set-backend-service backend-id="${azurerm_api_management_backend.psn.name}" />
199-
</inbound>
200-
</policies>
201-
XML
202-
}

infra/resources/prod/dns.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,13 @@ resource "azurerm_dns_txt_record" "wallet_io_pagopa_it" {
2525
tags = local.tags
2626
}
2727

28-
resource "azurerm_dns_a_record" "wallet_io_pagopa_it" {
28+
resource "azurerm_dns_cname_record" "wallet_io_pagopa_it" {
2929
name = "wallet"
30-
zone_name = data.azurerm_dns_zone.io_pagopa_it.name
3130
resource_group_name = data.azurerm_dns_zone.io_pagopa_it.resource_group_name
32-
ttl = 30
33-
records = ["iw-p-itn-cdn-fde-01-aza7ezdzg9buc8gm.a02.azurefd.net"]
31+
32+
zone_name = data.azurerm_dns_zone.io_pagopa_it.name
33+
record = "iw-p-itn-cdn-fde-01-aza7ezdzg9buc8gm.a02.azurefd.net"
34+
ttl = 60
3435

3536
tags = local.tags
3637
}

infra/resources/prod/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,9 @@ module "function_apps" {
160160
action_group_wallet_id = module.monitoring.action_group_wallet.id
161161
action_group_io_id = data.azurerm_monitor_action_group.io.id
162162

163-
health_check_path_user = "/api/v1/wallet/health"
163+
health_check_path_user = "/api/v1/wallet/health"
164164
health_check_path_user_uat = "/api/v1/wallet/health"
165-
health_check_path_support = "/api/v1/wallet/health"
165+
health_check_path_support = "/api/v1/wallet/health"
166166

167167
tags = local.tags
168168
}

0 commit comments

Comments
 (0)