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

azurerm_cdn_frontdoor_firewall_policy - custom rules to accept JSChallenge #28717

Merged

Conversation

EValge-IT
Copy link
Contributor

@EValge-IT EValge-IT commented Feb 7, 2025

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

azurerm_cdn_frontdoor_firewall_policy Allow the creation of custom_rules with JSChallenge as the action.

PR Checklist

  • I have followed the guidelines in our Contributing Documentation.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added Documentation as required written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.
    For example: “resource_name_here - description of change e.g. adding property new_property_name_here

Changes to existing Resource / Data Source

  • I have added an explanation of what my changes do and why I'd like you to include them (This may be covered by linking to an issue above, but may benefit from additional explanation).

Testing

I am unable to run tests that provision new resources due to organisation restrictions. However, I built the provider locally and ran terraform against a current workspace. Behaviour was as expected.

  # azurerm_cdn_frontdoor_firewall_policy.afd_waf_policy[0] will be updated in-place
  ~ resource "azurerm_cdn_frontdoor_firewall_policy" "afd_waf_policy" {
        id                                        = "/subscriptions/<SUBSCRIPTION>/resourceGroups/rg-rg-name/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies/wafpolicy"
        name                                      = "wafpolicy"
        tags                                      = {  "excluded"      }
        # (8 unchanged attributes hidden)

      ~ custom_rule {
          ~ action                         = "Log" -> "JSChallenge"
            name                           = "jsChallenge"
            # (5 unchanged attributes hidden)

            # (6 unchanged blocks hidden)
        }

        # (14 unchanged blocks hidden)
    }
Plan: 0 to add, 1 to change, 0 to destroy.

azurerm_cdn_frontdoor_firewall_policy.afd_waf_policy[0]: Modifications complete after 1m16s [id=/subscriptions/<SUBSCRIPTION>/resourceGroups/rg-rg-name/providers/Microsoft.Network/frontDoorWebApplicationFirewallPolicies/wafpolicy]
Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

Change Log

Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.

  • azurerm_cdn_frontdoor_firewall_policy - added support for the JSChallenge action for custom_rule

This is a (please select all that apply):

  • Bug Fix
  • New Feature (ie adding a service, resource, or data source)
  • Enhancement
  • Breaking Change

Related Issue(s)

Fixes #28713

Note

If this PR changes meaningfully during the course of review please update the title and description as required.

Copy link
Collaborator

@WodansSon WodansSon left a comment

Choose a reason for hiding this comment

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

Hi @EValge-IT, Thanks for opening this PR, it mostly LGTM and I have left a minor comment in the code that needs to be addressed. There needs to be test cases added for this change to the Custom rules. I understand due to corporate policies you are not allowed to run tests in your environment, but if you can create some test cases for JSChallenge being set on Custom rules I can run those for you on our test server. Thanks again for the PR, looking forward to those updates! 🚀

Additional:

  • I have gotten a response from the service team and JSChallenge IS supported for custom rules but ONLY for Premium_AzureFrontDoor SKUs .

@WodansSon
Copy link
Collaborator

WodansSon commented Feb 7, 2025

Note: You can fix your lint error by running the below command in a command prompt that is opened to the root provider directory:

terrafmt fmt ./internal/services/containerapps/container_app_resource_test.go -f -v -c

Additional: I worked with HashiCorp engineers and got that test formatting issue fixed in main, so if you pull to your local branch that CI/CD job should pass for you now.

@WodansSon
Copy link
Collaborator

@EValge-IT, I was actually assigned another work item late Friday night which also addresses a related issue to this PR. I will go ahead and merge this PR and correct the documentation in the PR I currently have in draft.

Copy link
Collaborator

@WodansSon WodansSon left a comment

Choose a reason for hiding this comment

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

@EValge-IT, thanks for opening this PR, I have given it a look and it LGTM! 🚀

@WodansSon WodansSon merged commit f65f0a4 into hashicorp:main Feb 9, 2025
32 of 33 checks passed
@github-actions github-actions bot added this to the v4.19.0 milestone Feb 9, 2025
WodansSon added a commit that referenced this pull request Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants