Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New audit log implementation #64

Merged
merged 45 commits into from
Dec 3, 2024
Merged

New audit log implementation #64

merged 45 commits into from
Dec 3, 2024

Conversation

acuiuli
Copy link
Contributor

@acuiuli acuiuli commented Jul 10, 2024

List of changes

Motivation and context

This pr adds the implementation to manage the event register required for legal reason as described in the FIMS DR

Type of changes

  • Add new resources
  • Update configuration to existing resources
  • Remove existing resources

Env to apply

  • DEV
  • UAT
  • PROD

Does this introduce a change to production resources with possible user impact?

  • Yes, users may be impacted applying this change
  • No

Does this introduce an unwanted change on infrastructure? Check terraform plan execution result

  • Yes
  • No

Other information


If PR is partially applied, why? (reserved to mantainers)

Copy link

github-actions bot commented Jul 10, 2024

📖 Terraform Plan ('infra/resources/prod') - success

Terraform Plan
Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # module.web_apps.module.op_func.azurerm_linux_function_app.this will be updated in-place
  ~ resource "azurerm_linux_function_app" "this" {
      ~ app_settings                                   = {
          ~ "FIMS_STORAGE__queueServiceUri"                   = "https://iopfimsst.queue.core.windows.net" -> "https://iopfimsst.queue.core.windows.net/"
            # (15 unchanged elements hidden)
        }
        id                                             = "/subscriptions/ec285037-c673-4f58-b594-d7c480da4e8b/resourceGroups/io-p-weu-fims-rg-01/providers/Microsoft.Web/sites/io-p-weu-fims-op-func-01"
        name                                           = "io-p-weu-fims-op-func-01"
        tags                                           = {
            "CostCenter"                                     = "TS310 - PAGAMENTI & SERVIZI"
            "CreatedBy"                                      = "Terraform"
            "Environment"                                    = "Prod"
            "Owner"                                          = "IO Comunicazione"
            "Source"                                         = "https://github.com/pagopa/io-fims/blob/main/infra/prod/westeurope"
            "hidden-link: /app-insights-conn-string"         = "InstrumentationKey=ab45103a-cb4f-474b-933f-d802ed1082d5;IngestionEndpoint=https://westeurope-3.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=2a5ffa17-99f9-4d9b-a253-18dba6759d94"
            "hidden-link: /app-insights-instrumentation-key" = "ab45103a-cb4f-474b-933f-d802ed1082d5"
            "hidden-link: /app-insights-resource-id"         = "/subscriptions/ec285037-c673-4f58-b594-d7c480da4e8b/resourceGroups/io-p-rg-common/providers/microsoft.insights/components/io-p-ai-common"
        }
        # (26 unchanged attributes hidden)

        # (3 unchanged blocks hidden)
    }

  # module.web_apps_itn.module.user_func.azurerm_linux_function_app.this will be updated in-place
  ~ resource "azurerm_linux_function_app" "this" {
      ~ app_settings                                   = {
          ~ "WEBSITE_WARMUP_PATH"                             = "/api/health" -> "/api/v1/fims/health"
            # (16 unchanged elements hidden)
        }
        id                                             = "/subscriptions/ec285037-c673-4f58-b594-d7c480da4e8b/resourceGroups/io-p-itn-fims-rg-01/providers/Microsoft.Web/sites/io-p-itn-fims-user-func-01"
        name                                           = "io-p-itn-fims-user-func-01"
        tags                                           = {
            "CostCenter"                                     = "TS310 - PAGAMENTI & SERVIZI"
            "CreatedBy"                                      = "Terraform"
            "Environment"                                    = "Prod"
            "Owner"                                          = "IO Comunicazione"
            "Source"                                         = "https://github.com/pagopa/io-fims/blob/main/infra/prod/westeurope"
            "hidden-link: /app-insights-conn-string"         = "InstrumentationKey=ab45103a-cb4f-474b-933f-d802ed1082d5;IngestionEndpoint=https://westeurope-3.in.applicationinsights.azure.com/;LiveEndpoint=https://westeurope.livediagnostics.monitor.azure.com/;ApplicationId=2a5ffa17-99f9-4d9b-a253-18dba6759d94"
            "hidden-link: /app-insights-instrumentation-key" = "ab45103a-cb4f-474b-933f-d802ed1082d5"
            "hidden-link: /app-insights-resource-id"         = "/subscriptions/ec285037-c673-4f58-b594-d7c480da4e8b/resourceGroups/io-p-rg-common/providers/microsoft.insights/components/io-p-ai-common"
        }
        # (26 unchanged attributes hidden)

        # (3 unchanged blocks hidden)
    }

  # module.web_apps_itn.module.user_func.azurerm_linux_function_app_slot.this[0] will be updated in-place
  ~ resource "azurerm_linux_function_app_slot" "this" {
      ~ app_settings                                   = {
          ~ "WEBSITE_WARMUP_PATH"                             = "/api/health" -> "/api/v1/fims/health"
            # (16 unchanged elements hidden)
        }
        id                                             = "/subscriptions/ec285037-c673-4f58-b594-d7c480da4e8b/resourceGroups/io-p-itn-fims-rg-01/providers/Microsoft.Web/sites/io-p-itn-fims-user-func-01/slots/staging"
        name                                           = "staging"
        tags                                           = {
            "CostCenter"  = "TS310 - PAGAMENTI & SERVIZI"
            "CreatedBy"   = "Terraform"
            "Environment" = "Prod"
            "Owner"       = "IO Comunicazione"
            "Source"      = "https://github.com/pagopa/io-fims/blob/main/infra/prod/westeurope"
        }
        # (22 unchanged attributes hidden)

        # (2 unchanged blocks hidden)
    }

Plan: 0 to add, 3 to change, 0 to destroy.

Warning: Argument is deprecated

  with module.cosmos.module.comsosdb_sql_container_op_access_tokens.azurerm_cosmosdb_sql_container.this,
  on .terraform/modules/cosmos.comsosdb_sql_container_op_access_tokens/cosmosdb_sql_container/main.tf line 7, in resource "azurerm_cosmosdb_sql_container" "this":
   7:   partition_key_path = var.partition_key_path

`partition_key_path` will be removed in favour of the property
`partition_key_paths` in version 4.0 of the AzureRM Provider.

(and 14 more similar warnings elsewhere)

Warning: Deprecated attribute

  on .terraform/modules/cosmos.cosmosdb_account_fims/cosmosdb_account/output.tf line 54, in output "connection_strings":
  54:   value     = azurerm_cosmosdb_account.this.connection_strings

The attribute "connection_strings" is deprecated. Refer to the provider
documentation for details.

(and one more similar warning elsewhere)

─────────────────────────────────────────────────────────────────────────────

Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.

@github-actions github-actions bot added the user A change has been made to the user workspace label Jul 16, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jul 16, 2024

Codecov Report

Attention: Patch coverage is 51.31846% with 240 lines in your changes missing coverage. Please review.

Project coverage is 46.47%. Comparing base (df7f7df) to head (a752fae).
Report is 58 commits behind head on main.

Files with missing lines Patch % Lines
apps/op-app/src/use-cases/send-event-messge.ts 73.26% 50 Missing ⚠️
apps/op-app/src/adapters/redis/event.ts 0.00% 43 Missing and 1 partial ⚠️
apps/op-func/src/func.ts 0.00% 30 Missing ⚠️
apps/op-app/src/adapters/oidc/middleware.ts 0.00% 25 Missing and 1 partial ⚠️
apps/op-app/src/web.ts 0.00% 24 Missing ⚠️
apps/op-func/src/adapters/config.ts 0.00% 12 Missing and 1 partial ⚠️
apps/op-func/src/infra/storage/audit-event.ts 21.42% 11 Missing ⚠️
apps/op-func/src/adapters/storage-queue/config.ts 0.00% 9 Missing ⚠️
apps/op-func/src/adapters/event-queue/config.ts 0.00% 7 Missing and 1 partial ⚠️
apps/op-app/src/domain/session.ts 81.08% 7 Missing ⚠️
... and 5 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #64      +/-   ##
==========================================
- Coverage   54.83%   46.47%   -8.36%     
==========================================
  Files         109      127      +18     
  Lines        6002     5622     -380     
  Branches      369      229     -140     
==========================================
- Hits         3291     2613     -678     
- Misses       2661     2943     +282     
- Partials       50       66      +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@acuiuli acuiuli marked this pull request as ready for review July 16, 2024 14:32
@acuiuli acuiuli requested review from a team as code owners July 16, 2024 14:32
Copy link
Contributor

@Garma00 Garma00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that we don't have an env.example do we plan to add it so we can list the env variables needed?

apps/op-app/src/adapters/express/routes/interaction.ts Outdated Show resolved Hide resolved
apps/op-app/src/adapters/oidc/middleware.ts Show resolved Hide resolved
apps/op-app/src/adapters/redis/event.ts Outdated Show resolved Hide resolved
apps/op-app/src/adapters/redis/event.ts Outdated Show resolved Hide resolved
apps/op-app/src/adapters/storage/event-client.ts Outdated Show resolved Hide resolved
apps/op-app/src/use-cases/audit.ts Outdated Show resolved Hide resolved
apps/op-app/src/use-cases/audit.ts Outdated Show resolved Hide resolved
packages/io-fims-common/src/domain/audit-event.ts Outdated Show resolved Hide resolved
apps/op-app/src/use-cases/audit.ts Outdated Show resolved Hide resolved
apps/op-app/src/use-cases/audit.ts Outdated Show resolved Hide resolved
@lucacavallaro lucacavallaro merged commit fc660ac into main Dec 3, 2024
7 of 8 checks passed
@lucacavallaro lucacavallaro deleted the IOCOM-1383 branch December 3, 2024 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infra openid-provider A change to either openid-provider app service or functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants