hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.6k stars 4.65k forks source link

Issue with rewrites in the gateway #18655

Closed elvovsky closed 5 months ago

elvovsky commented 2 years ago

Is there an existing issue for this?

Community Note

Terraform Version

0.13

AzureRM Provider Version

2.80

Affected Resource(s)/Data Source(s)

azurerm_application_gateway

Terraform Configuration Files

rewrite_rule_set {
    name = "edistribution"

    rewrite_rule {
      name          = "redirect-edistribution"
      rule_sequence = 100
      url  {
        path = "/exp/edistribution/v1/api/Invoices/pdf"
        reroute   = "false"
        query_string = ""

      }
    }
  }

Debug Output/Panic Output

The output does not show any errors.

Expected Behaviour

It does create a set and the rule. I expect it to have rewrite type "URL" with the component being URL path

Actual Behaviour

when the tf runs it creates type url, but component is "Both URL path and URL query string"

Steps to Reproduce

No response

Important Factoids

No response

References

No response

ms-zhenhua commented 2 years ago

Hi @elvovsky, if you only want to use path in url, you could try to set the components as path_only , the configuration may look like below:

url  {
    path = "/exp/edistribution/v1/api/Invoices/pdf"
    reroute   = "false"
    components = "path_only"
}
elvovsky commented 2 years ago

Hello @ms-zhenhua . Thank you ! I will try it. Not sure how I missed that in the documentation. I will post the results as soon as I had a chance to try

elvovsky commented 2 years ago

Hello @ms-zhenhua . It seems that "components" is relatively new and not available for version 2.80 of the provider, which is what is currently used in the script. I am not sure what version this was introduced in, however I see 3.20.0 has it. Is there something equivalent in the older version ?

ms-zhenhua commented 2 years ago

Hi @elvovsky, the components was imported in v3.19.0 by this PR which is used to resolve the similar issues which you met. And I am afraid I do not find any work around way in the older version.

elvovsky commented 2 years ago

Thanks @ms-zhenhua ! I will check if this works, I would need to make sure there is no issues with other elements, as it would be a big jump in version of azurerm. I will let you know .

elvovsky commented 2 years ago

Hello @ms-zhenhua ! I changed the script to use 3.19, then I got some other errors with protocol, whiche were also related to the version of the azurerm provider. Once I fixed that I got a different error , which was related to request routing rile having priority now as a required field, which was not required before. Now after I added priority, I get another error, which also only shows up in apply and not in plan. The error is Error: expanding request_routing_rule: If you wish to use rule priority, you will have to specify rule-priority field values for all the existing request routing rules. The line it is referencing is the definition of the app gateway resource. Can you help guiding me in the right direction here, as unless I get passed all these other issues, I can't really test of the original problem is solved

rcskosir commented 5 months ago

Thank you for taking the time to raise this! We use Issues in this repository to track feature enhancements and bugs in the Azure Provider. So that we can maintain focus on that, we instead ask that broader questions are raised using one of the Community Resources, such as the Azure Provider forum. With that in mind, I'm going to close this issue.

github-actions[bot] commented 4 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.