-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/pagopa/rtp-apis into SRTP-4…
…1-send-rtp-openapi
- Loading branch information
Showing
22 changed files
with
336 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
data "azurerm_api_management" "this" { | ||
name = local.apim_name | ||
resource_group_name = local.apim_rg | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# ------------------------------------------------------------------------------ | ||
# Product. | ||
# ------------------------------------------------------------------------------ | ||
resource "azurerm_api_management_product" "rtp" { | ||
api_management_name = data.azurerm_api_management.this.name | ||
resource_group_name = data.azurerm_api_management.this.resource_group_name | ||
|
||
product_id = "rtp" | ||
display_name = "RTP Request To Pay" | ||
description = "RTP Request To Pay" | ||
|
||
subscription_required = false | ||
published = true | ||
} | ||
|
||
resource "azurerm_api_management_product_policy" "rtp_api_product" { | ||
product_id = azurerm_api_management_product.rtp.product_id | ||
api_management_name = data.azurerm_api_management.this.name | ||
resource_group_name = data.azurerm_api_management.this.resource_group_name | ||
|
||
xml_content = file("./api_product/base_policy.xml") | ||
} | ||
|
||
resource "azurerm_api_management_group" "rtp_group" { | ||
name = var.domain | ||
resource_group_name = data.azurerm_api_management.this.resource_group_name | ||
api_management_name = data.azurerm_api_management.this.name | ||
display_name = upper(var.domain) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
## RTP Mock API ## | ||
resource "azurerm_api_management_api" "rtp_mock_api" { | ||
name = "${var.env_short}-rtp-mock-api" | ||
api_management_name = data.azurerm_api_management.this.name | ||
resource_group_name = data.azurerm_api_management.this.resource_group_name | ||
|
||
revision = "1" | ||
description = "RTP MOCK API" | ||
display_name = "RTP MOCK API" | ||
path = "rtp/mock" | ||
protocols = ["https"] | ||
subscription_required = false | ||
|
||
depends_on = [azurerm_api_management_product.rtp] | ||
} | ||
|
||
resource "azurerm_api_management_product_api" "rtp_mock_product_api" { | ||
api_management_name = data.azurerm_api_management.this.name | ||
resource_group_name = data.azurerm_api_management.this.resource_group_name | ||
api_name = azurerm_api_management_api.rtp_mock_api.name | ||
product_id = azurerm_api_management_product.rtp.product_id | ||
depends_on = [azurerm_api_management_product.rtp, azurerm_api_management_api.rtp_mock_api] | ||
} | ||
|
||
|
||
## RTP Mock Operations ## | ||
resource "azurerm_api_management_api_operation" "rtp_mock_create_ticket" { | ||
operation_id = "rtp_mock_create_ticket" | ||
api_name = azurerm_api_management_api.rtp_mock_api.name | ||
api_management_name = data.azurerm_api_management.this.name | ||
resource_group_name = data.azurerm_api_management.this.resource_group_name | ||
display_name = "RTP Mock create ticket" | ||
method = "POST" | ||
url_template = "/api/v1/create" | ||
description = "Endpoint for create a rtp ticket api" | ||
} | ||
|
||
resource "azurerm_api_management_api_operation_policy" "rtp_mock_create_ticket_policy" { | ||
api_name = azurerm_api_management_api_operation.rtp_mock_create_ticket.api_name | ||
api_management_name = azurerm_api_management_api_operation.rtp_mock_create_ticket.api_management_name | ||
resource_group_name = azurerm_api_management_api_operation.rtp_mock_create_ticket.resource_group_name | ||
operation_id = azurerm_api_management_api_operation.rtp_mock_create_ticket.operation_id | ||
|
||
xml_content = templatefile("./api/test/mock_policy.xml", { | ||
env = var.env | ||
}) | ||
|
||
depends_on = [azurerm_api_management_api_operation.rtp_mock_create_ticket] | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
locals { | ||
project = "${var.prefix}-${var.env_short}-${var.location_short}-${var.domain}" | ||
product = "${var.prefix}-${var.env_short}" | ||
|
||
apim_name = "${local.product}-apim" | ||
apim_rg = "${local.product}-api-rg" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
terraform { | ||
required_version = ">=1.3.0" | ||
|
||
required_providers { | ||
azuread = { | ||
source = "hashicorp/azuread" | ||
version = "~> 2.52" | ||
} | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
version = "~> 3.108" | ||
} | ||
} | ||
|
||
backend "azurerm" {} | ||
} | ||
|
||
provider "azurerm" { | ||
features { | ||
key_vault { | ||
purge_soft_delete_on_destroy = false | ||
} | ||
} | ||
} | ||
|
||
module "__v3__" { | ||
# https://github.com/pagopa/terraform-azurerm-v3/releases/tag/v8.39.0 | ||
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git?ref=e64f39b63d46e8c05470e30eca873f44a0ab7f1b" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
variable "prefix" { | ||
type = string | ||
validation { | ||
condition = ( | ||
length(var.prefix) <= 6 | ||
) | ||
error_message = "Max length is 6 chars." | ||
} | ||
} | ||
|
||
variable "env" { | ||
type = string | ||
description = "Environment" | ||
} | ||
|
||
variable "env_short" { | ||
type = string | ||
validation { | ||
condition = ( | ||
length(var.env_short) <= 1 | ||
) | ||
error_message = "Max length is 1 chars." | ||
} | ||
} | ||
|
||
variable "location" { | ||
type = string | ||
} | ||
|
||
variable "location_short" { | ||
type = string | ||
description = "Location short like eg: neu, weu.." | ||
} | ||
|
||
variable "tags" { | ||
type = map(any) | ||
default = { | ||
CreatedBy = "Terraform" | ||
} | ||
} | ||
|
||
variable "domain" { | ||
type = string | ||
validation { | ||
condition = ( | ||
length(var.domain) <= 12 | ||
) | ||
error_message = "Max length is 12 chars." | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!-- | ||
IMPORTANT: | ||
- Policy elements can appear only within the <inbound>, <outbound>, <backend> section elements. | ||
- To apply a policy to the incoming request (before it is forwarded to the backend service), place a corresponding policy element within the <inbound> section element. | ||
- To apply a policy to the outgoing response (before it is sent back to the caller), place a corresponding policy element within the <outbound> section element. | ||
- To add a policy, place the cursor at the desired insertion point and select a policy from the sidebar. | ||
- To remove a policy, delete the corresponding policy statement from the policy document. | ||
- Position the <base> element within a section element to inherit all policies from the corresponding section element in the enclosing scope. | ||
- Remove the <base> element to prevent inheriting policies from the corresponding section element in the enclosing scope. | ||
- Policies are applied in the order of their appearance, from the top down. | ||
- Comments within policy elements are not supported and may disappear. Place your comments between policy elements or at a higher level scope. | ||
--> | ||
<policies> | ||
<inbound> | ||
<return-response> | ||
<set-status code="200" reason="OK" /> | ||
<set-header name="Content-Type" exists-action="override"> | ||
<value>application/json</value> | ||
</set-header> | ||
</return-response> | ||
</inbound> | ||
<backend> | ||
<base /> | ||
</backend> | ||
<outbound> | ||
<base /> | ||
</outbound> | ||
<on-error> | ||
<base /> | ||
</on-error> | ||
</policies> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<!-- | ||
IMPORTANT: | ||
- Policy elements can appear only within the <inbound>, <outbound>, <backend> section elements. | ||
- To apply a policy to the incoming request (before it is forwarded to the backend service), place a corresponding policy element within the <inbound> section element. | ||
- To apply a policy to the outgoing response (before it is sent back to the caller), place a corresponding policy element within the <outbound> section element. | ||
- To add a policy, place the cursor at the desired insertion point and select a policy from the sidebar. | ||
- To remove a policy, delete the corresponding policy statement from the policy document. | ||
- Position the <base> element within a section element to inherit all policies from the corresponding section element in the enclosing scope. | ||
- Remove the <base> element to prevent inheriting policies from the corresponding section element in the enclosing scope. | ||
- Policies are applied in the order of their appearance, from the top down. | ||
- Comments within policy elements are not supported and may disappear. Place your comments between policy elements or at a higher level scope. | ||
--> | ||
<policies> | ||
<inbound> | ||
<base /> | ||
</inbound> | ||
<backend> | ||
<base /> | ||
</backend> | ||
<outbound> | ||
<base /> | ||
</outbound> | ||
<on-error> | ||
<base /> | ||
</on-error> | ||
</policies> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
subscription=DEV-CSTAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
resource_group_name = "io-infra-rg" | ||
storage_account_name = "cstarinfrastterraformdev" | ||
container_name = "azurermstate" | ||
key = "rtp-apim-product-rtp-dev.terraform.tfstate" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# general | ||
prefix = "cstar" | ||
env_short = "d" | ||
env = "dev" | ||
domain = "rtp" | ||
location = "westeurope" | ||
location_short = "weu" | ||
|
||
tags = { | ||
CreatedBy = "Terraform" | ||
Environment = "DEV" | ||
Owner = "CSTAR" | ||
Source = "https://github.com/pagopa/cstar-infrastructure" | ||
CostCenter = "TS310 - PAGAMENTI & SERVIZI" | ||
Application = "RTP" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
subscription=PROD-CSTAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
resource_group_name = "io-infra-rg" | ||
storage_account_name = "cstarinfrastterraform" | ||
container_name = "azurermstate" | ||
key = "rtp-apim-product-rtp-prod.terraform.tfstate" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# general | ||
prefix = "cstar" | ||
env_short = "p" | ||
env = "prod" | ||
domain = "rtp" | ||
location = "westeurope" | ||
location_short = "weu" | ||
|
||
tags = { | ||
CreatedBy = "Terraform" | ||
Environment = "PROD" | ||
Owner = "CSTAR" | ||
Source = "https://github.com/pagopa/cstar-infrastructure" | ||
CostCenter = "TS310 - PAGAMENTI & SERVIZI" | ||
Application = "RTP" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
subscription=UAT-CSTAR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
resource_group_name = "io-infra-rg" | ||
storage_account_name = "cstarinfrastterraformuat" | ||
container_name = "azurermstate" | ||
key = "rtp-apim-product-rtp-uat.terraform.tfstate" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# general | ||
prefix = "cstar" | ||
env_short = "u" | ||
env = "uat" | ||
domain = "rtp" | ||
location = "westeurope" | ||
location_short = "weu" | ||
|
||
tags = { | ||
CreatedBy = "Terraform" | ||
Environment = "UAT" | ||
Owner = "CSTAR" | ||
Source = "https://github.com/pagopa/cstar-infrastructure" | ||
CostCenter = "TS310 - PAGAMENTI & SERVIZI" | ||
Application = "RTP" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../scripts/terraform.sh |