Skip to content

Add new tests for CDN modules#1283

Open
mamu0 wants to merge 22 commits intomainfrom
feat-add-cdn-tests
Open

Add new tests for CDN modules#1283
mamu0 wants to merge 22 commits intomainfrom
feat-add-cdn-tests

Conversation

@mamu0
Copy link
Contributor

@mamu0 mamu0 commented Feb 3, 2026

This pull request introduces new test format with Unit, Contract, Integration and E2E tests.

depends-on: #1265
Resolves: CES-1661

gunzip and others added 20 commits January 27, 2026 14:06
- Introduced logic to handle existing CDN FrontDoor profiles.
- Updated resource references to use local variables for profile ID and identity.
- Added WAF policy and security policy resources with conditional creation.
- Enhanced origin configurations to support managed identity for storage access.
- Updated outputs to reflect changes in resource handling.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…, add profile SKU check for WAF compatibility
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@changeset-bot
Copy link

changeset-bot bot commented Feb 3, 2026

🦋 Changeset detected

Latest commit: ff26d19

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
azure_cdn Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

Tip

✅ All Terraform module locks are up to date

No module changes detected - everything is in sync!

📋 Pre-commit Output Log
[INFO] Initializing environment for https://github.com/antonbabenko/pre-commit-terraform.
Lock Terraform Registry modules..........................................Passed

Generated on Tue Feb 3 08:59:57 UTC 2026
Run lock_modules on folder: infra/resources/prod/

@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

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

Show Plan
  # module.mcp_registry.module.portal.azurerm_cdn_frontdoor_endpoint.this will be updated in-place
  ~ resource "azurerm_cdn_frontdoor_endpoint" "this" {
        id                       = "/subscriptions/02a23258-2e41-433c-8e9a-465b99e77bca/resourceGroups/dx-p-itn-common-rg-01/providers/Microsoft.Cdn/profiles/dx-p-weu-mcp-registry-afd-01/afdEndpoints/dx-p-weu-mcp-registry-fde-01"
        name                     = "dx-p-weu-mcp-registry-fde-01"
      ~ tags                     = {
            "CostCenter"     = "TS000 - Tecnologia e Servizi"
            "CreatedBy"      = "Terraform"
            "Environment"    = "Prod"
            "ManagementTeam" = "Developer Experience"
            "ModuleName"     = "azure_cdn"
            "ModuleSource"   = "DX"
          ~ "ModuleVersion"  = "0.3.2" -> "0.4.0"
            "Owner"          = "DevEx"
            "Source"         = "https://github.com/pagopa/dx/blob/main/infra/resources/prod"
        }
        # (3 unchanged attributes hidden)
    }

  # module.mcp_registry.module.portal.azurerm_cdn_frontdoor_profile.this will be updated in-place
  ~ resource "azurerm_cdn_frontdoor_profile" "this" {
        id                       = "/subscriptions/02a23258-2e41-433c-8e9a-465b99e77bca/resourceGroups/dx-p-itn-common-rg-01/providers/Microsoft.Cdn/profiles/dx-p-weu-mcp-registry-afd-01"
        name                     = "dx-p-weu-mcp-registry-afd-01"
      ~ tags                     = {
            "CostCenter"     = "TS000 - Tecnologia e Servizi"
            "CreatedBy"      = "Terraform"
            "Environment"    = "Prod"
            "ManagementTeam" = "Developer Experience"
            "ModuleName"     = "azure_cdn"
            "ModuleSource"   = "DX"
          ~ "ModuleVersion"  = "0.3.2" -> "0.4.0"
            "Owner"          = "DevEx"
            "Source"         = "https://github.com/pagopa/dx/blob/main/infra/resources/prod"
        }
        # (4 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

  # module.mcp_registry.module.portal.azurerm_dns_cname_record.this["mcp.dx.pagopa.it"] will be updated in-place
  ~ resource "azurerm_dns_cname_record" "this" {
        id                  = "/subscriptions/02a23258-2e41-433c-8e9a-465b99e77bca/resourceGroups/dx-p-itn-network-rg-01/providers/Microsoft.Network/dnsZones/dx.pagopa.it/CNAME/mcp"
        name                = "mcp"
      ~ tags                = {
            "CostCenter"     = "TS000 - Tecnologia e Servizi"
            "CreatedBy"      = "Terraform"
            "Environment"    = "Prod"
            "ManagementTeam" = "Developer Experience"
            "ModuleName"     = "azure_cdn"
            "ModuleSource"   = "DX"
          ~ "ModuleVersion"  = "0.3.2" -> "0.4.0"
            "Owner"          = "DevEx"
            "Source"         = "https://github.com/pagopa/dx/blob/main/infra/resources/prod"
        }
        # (6 unchanged attributes hidden)
    }

  # module.mcp_registry.module.portal.azurerm_dns_txt_record.validation["mcp.dx.pagopa.it"] will be updated in-place
  ~ resource "azurerm_dns_txt_record" "validation" {
        id                  = "/subscriptions/02a23258-2e41-433c-8e9a-465b99e77bca/resourceGroups/dx-p-itn-network-rg-01/providers/Microsoft.Network/dnsZones/dx.pagopa.it/TXT/_dnsauth.mcp"
        name                = "_dnsauth.mcp"
      ~ tags                = {
            "Cdn"            = "dx-p-weu-mcp-registry-afd-01"
            "CostCenter"     = "TS000 - Tecnologia e Servizi"
            "CreatedBy"      = "Terraform"
            "Environment"    = "Prod"
            "ManagementTeam" = "Developer Experience"
            "ModuleName"     = "azure_cdn"
            "ModuleSource"   = "DX"
          ~ "ModuleVersion"  = "0.3.2" -> "0.4.0"
            "Origin"         = "mcp.dx.pagopa.it"
            "Owner"          = "DevEx"
            "Source"         = "https://github.com/pagopa/dx/blob/main/infra/resources/prod"
        }
        # (4 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

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

Warning: Argument is deprecated

  with module.mcp_registry.module.portal.azurerm_cdn_frontdoor_custom_domain.this["mcp.dx.pagopa.it"],
  on .terraform/modules/mcp_registry.portal/custom_domain.tf line 14, in resource "azurerm_cdn_frontdoor_custom_domain" "this":
  14: resource "azurerm_cdn_frontdoor_custom_domain" "this" {

As of March 1, 2025, support for 'TLS10' will be retired from Azure Front
Door, therefore the 'TLS10' property value will be removed in v5.0 of the
provider.

@mamu0 mamu0 changed the base branch from main to chores/cdnsec February 3, 2026 09:17
Base automatically changed from chores/cdnsec to main February 6, 2026 11:56
@dpulls
Copy link

dpulls bot commented Feb 6, 2026

🎉 All dependencies have been resolved !

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2026

📋 Pre-commit Output Log
[INFO] Initializing environment for https://github.com/antonbabenko/pre-commit-terraform.
Lock Terraform Registry modules..................................(no files to check)Skipped
Terraform Providers Lock (on staged .terraform.lock.hcl files).......................Passed
- hook id: terraform_providers_lock_staged
- duration: 0.09s

No .terraform.lock.hcl files to process.

Terraform fmt........................................................................Passed
terraform_docs on modules............................................................Passed
terraform_docs on resources......................................(no files to check)Skipped
Terraform validate with tflint.......................................................Passed
Terraform validate...................................................................Passed
Terraform validate with trivy........................................................Passed

Generated on Fri Feb 6 12:08:28 UTC 2026
Run all checks on modified files

@mamu0 mamu0 marked this pull request as ready for review February 6, 2026 12:29
@mamu0 mamu0 requested a review from a team as a code owner February 6, 2026 12:29

data "azurerm_resource_group" "integration" {
name = provider::dx::resource_name(merge(local.naming_config, {
name = "integration",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
name = "integration",
name = "e2e",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know it's not ideal, but to avoid creating two identical CDNs, I leveraged the existing integration one. Do you think it would be better to create a dedicated one for E2E as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

As discussed in this morning, I believe it'd be better to have two different infrastructures for the two kind of tests. Keep in mind that also foundational infrastructure (vnet, peps, etc.) is also doubled

@@ -0,0 +1,71 @@

data "azurerm_resource_group" "integration" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
data "azurerm_resource_group" "integration" {
data "azurerm_resource_group" "e2e" {

@mamu0 mamu0 requested a review from Krusty93 February 10, 2026 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants