Skip to content

Commit

Permalink
chore: Alert OPEX x apim V2 (#527)
Browse files Browse the repository at this point in the history
* alert OPEX x apim V2

* fix

* fix
  • Loading branch information
pasqualespica authored Jun 18, 2024
1 parent dc309e4 commit f25c41a
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 40 deletions.
49 changes: 9 additions & 40 deletions .github/workflows/create_dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ on:

workflow_dispatch:

env:
TEMPLATE_DIR: azure-dashboard

permissions:
id-token: write
contents: read
Expand All @@ -28,6 +25,8 @@ jobs:
strategy:
matrix:
environment: [prod]
product: [apim_v1, apim_v2]
max-parallel: 1
environment:
name: ${{ matrix.environment }}
# Steps represent a sequence of tasks that will be executed as part of the job
Expand All @@ -39,44 +38,14 @@ jobs:
with:
persist-credentials: false

- name: Read terraform version
id: read-version
shell: bash
run: |
echo "TERRAFORM_VERSION=`cat .terraform-version`" >> $GITHUB_ENV
- name: Setup Terraform
# from https://github.com/hashicorp/setup-terraform/commits/main
uses: hashicorp/setup-terraform@8feba2b913ea459066180f9cb177f58a881cf146
with:
terraform_version: ${{ env.TERRAFORM_VERSION }}

- name: Login
id: login
# from https://github.com/Azure/login/commits/master
uses: azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2
# from https://github.com/pagopa/opex-dashboard-azure-action/
- uses: pagopa/opex-dashboard-azure-action@ece3bc2b133be74cabb50aec14cdb9b8051b886f
with:
environment: ${{ matrix.environment }}
api-name: ${{ matrix.product }} # empty to have `.opex/env` directory structure
config: .opex/${{ matrix.product }}/env/${{ matrix.environment }}/config.yaml
client-id: ${{ secrets.CLIENT_ID }}
tenant-id: ${{ secrets.TENANT_ID }}
subscription-id: ${{ secrets.SUBSCRIPTION_ID }}

# this action create a folder named /azure-dashboard
# from https://github.com/pagopa/opex-dashboard-azure-action/commits/main
- uses: pagopa/opex-dashboard-action@f39cecdd530f46451057c599fcf57c1fc3fa345e
with:
template: ${{ env.TEMPLATE_DIR }}
config: .opex/env/${{ matrix.environment }}/config.yaml

# we need to set env variables in the folder /azure-dashboard
- name: Copy Environments
run: |
cp -R .opex/env ./${TEMPLATE_DIR}
# now is possible to launch the command: terraform apply
- name: Terraform Apply
shell: bash
run: |
cd ./${TEMPLATE_DIR}
export ARM_CLIENT_ID="${{ secrets.CLIENT_ID }}"
export ARM_SUBSCRIPTION_ID=$(az account show --query id --output tsv)
export ARM_TENANT_ID=$(az account show --query tenantId --output tsv)
export ARM_USE_OIDC=true
bash ./terraform.sh apply ${{ matrix.environment }} -auto-approve
# from https://github.com/pagopa/opex-dashboard-azure-action/pkgs/container/opex-dashboard-azure-action
docker-version: sha256:e4245954566cd3470e1b5527d33bb58ca132ce7493eac01be9e808fd25a11c8d
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ build/
.env
#helm/charts/microservice-chart-1.9.0.tgz
helm/charts/microservice-chart-1.11.1.tgz
**/.terraform
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions .opex/apim_v2/env/prod/backend.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
subscription=PROD-pagoPA
4 changes: 4 additions & 0 deletions .opex/apim_v2/env/prod/backend.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource_group_name = "terraform-state-rg"
storage_account_name = "tfappprodpagopa"
container_name = "terraform-state"
key = "opex.pagopa-ecommerce-transactions-service-apimv2.terraform.tfstate"
13 changes: 13 additions & 0 deletions .opex/apim_v2/env/prod/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
oa3_spec: ./api-spec/transactions-api.yaml # If start with http the file would be downloaded from the internet
name: opex_pagopa-ecommerce-transactions-service-apimv2
location: West Europe
timespan: 5m # Default, a number or a timespan https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/scalar-data-types/timespan
# data_source: /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-api-rg/providers/Microsoft.ApiManagement/service/pagopa-p-apim
data_source: /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-api-rg/providers/Microsoft.ApiManagement/service/pagopa-p-weu-core-apim-v2
resource_type: api-management
action_groups:
- /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-monitor-rg/providers/microsoft.insights/actionGroups/PagoPA
- /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-monitor-rg/providers/microsoft.insights/actionGroups/SlackPagoPA
overrides:
hosts: # Use these hosts instead of those inside the OpenApi spec
- api.platform.pagopa.it
11 changes: 11 additions & 0 deletions .opex/apim_v2/env/prod/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
prefix = "pagopa"
env_short = "p"


tags = {
CreatedBy = "Terraform"
Environment = "Prod"
Owner = "pagoPA"
Source = "https://github.com/pagopa/pagopa-ecommerce-transactions-service"
CostCenter = "TS310 - PAGAMENTI & SERVIZI"
}

0 comments on commit f25c41a

Please sign in to comment.