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_rule with operator Any does not work #23504

Closed
1 task done
httran13 opened this issue Oct 10, 2023 · 2 comments · Fixed by #23541
Closed
1 task done

azurerm_cdn_frontdoor_rule with operator Any does not work #23504

httran13 opened this issue Oct 10, 2023 · 2 comments · Fixed by #23541

Comments

@httran13
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.6.0

AzureRM Provider Version

3.71.0

Affected Resource(s)/Data Source(s)

azurerm_cdn_frontdoor_rule

Terraform Configuration Files

resource "azurerm_cdn_frontdoor_rule" "rs_default_html" {
  depends_on = [azurerm_cdn_frontdoor_origin_group.blob_origin_group, azurerm_cdn_frontdoor_origin.st_blob_origin]

  name                      = "DefaultIndexHtml"
  cdn_frontdoor_rule_set_id = azurerm_cdn_frontdoor_rule_set.spa_rule_set.id
  order                     = 1
  behavior_on_match         = "Stop"

  actions {

    url_rewrite_action {
      source_pattern = "/"
      destination = "/${var.storage_account.container_name}/index.html"
      preserve_unmatched_path = false
    }
  }

  conditions {
    # https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/cdn_frontdoor_rule#url_filename_condition
    url_filename_condition {
      operator         = "Any"
      match_values     = null # Note i've tried this with [""], ["*"]
    }
  }
}

Debug Output/Panic Output

Output when match_values = null
╷
│ Error: expanding 'conditions': "url_filename_condition" is invalid: the 'match_values' field must not be set if the conditions 'operator' is set to 'Any'
│ 
│   with azurerm_cdn_frontdoor_rule.rs_default_html,
│   on fd.tf line 144, in resource "azurerm_cdn_frontdoor_rule" "rs_default_html":
│  144: resource "azurerm_cdn_frontdoor_rule" "rs_default_html" {
│ 
╵
Output when match_values = [""]
╷
│ Error: expected "conditions.0.url_filename_condition.0.match_values.0" to not be an empty string, got 
│ 
│   with azurerm_cdn_frontdoor_rule.rs_default_html,
│   on fd.tf line 165, in resource "azurerm_cdn_frontdoor_rule" "rs_default_html":
│  165:       match_values     = [""]
│ 
╵

Expected Behaviour

match_values is a required field but when setting anything and applying the plan, you get an error

Actual Behaviour

match_values is a required field but when setting anything and applying the plan, you get an error when Operator is Any

Steps to Reproduce

No response

Important Factoids

No response

References

No response

@WodansSon
Copy link
Collaborator

WodansSon commented Oct 12, 2023

@httran13, Thank you for opening this issue. I have opened the linked PR to address this issue. match_values are now optional if the operator is set to Any. If the operator is anything other than Any you will receive the below error:

Plan: 0 to add, 1 to change, 0 to destroy.
azurerm_cdn_frontdoor_rule.repro: Modifying... [id=/subscriptions/{subscription}/resourceGroups/afdx-repro23504/providers/Microsoft.Cdn/profiles/repro-profile/ruleSets/reproruleset/rules/DefaultIndexHtml]
╷
│ Error: expanding 'conditions': "url_filename_condition" is invalid: the 'match_values' field must be set if the conditions 'operator' is not set to 'Any'
│
│   with azurerm_cdn_frontdoor_rule.repro,
│   on main.tf line 66, in resource "azurerm_cdn_frontdoor_rule" "repro":
│   66: resource "azurerm_cdn_frontdoor_rule" "repro" {

WodansSon added a commit that referenced this issue Oct 18, 2023
* Initial Check-in...

* Update documentation...

* Fix test case reference...

* Remove ImportStep from Error test case...

* Add extra validation to test case...
@github-actions github-actions bot added this to the v3.77.0 milestone Oct 18, 2023
Copy link

github-actions bot commented May 4, 2024

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.