Skip to content

Commit

Permalink
Merge pull request #31 from hashicorp/main
Browse files Browse the repository at this point in the history
Fork Sync: Update from parent repository
  • Loading branch information
mbialon authored Sep 28, 2023
2 parents 2d3136e + f93d250 commit 8337756
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ FEATURES:

BUG FIXES:

* `azurerm_api_management_api` : fix importing `openapi` format content file issue [GH-23348]
* `azurerm_api_management_api` - fix importing `openapi` format content file issue [GH-23348]
* `azurerm_cdn_frontdoor_rule` - allow a `cache_duration` of `00:00:00` [GH-23384]
* `azurerm_palo_alto_local_rulestack_prefix_list` - fix rulestack not being committed on delete [GH-23362]
* `azurerm_palo_alto_local_rulestack_fqdn_list` - fix rulestack not being committed on delete [GH-23362]
* `security_center_subscription_pricing_resource` - disabled extensions logic now works as expected [GH-22997]
Expand Down
47 changes: 47 additions & 0 deletions internal/services/cdn/cdn_frontdoor_rule_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@ func TestAccCdnFrontDoorRule_cacheDuration(t *testing.T) {
})
}

func TestAccCdnFrontDoorRule_cacheDurationZero(t *testing.T) {
// NOTE: Regression test case for issue #23376
data := acceptance.BuildTestData(t, "azurerm_cdn_frontdoor_rule", "test")
r := CdnFrontDoorRuleResource{}
data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.cacheDurationZero(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
})
}

func TestAccCdnFrontDoorRule_urlRedirectAction(t *testing.T) {
// NOTE: Regression test case for issue #18249
data := acceptance.BuildTestData(t, "azurerm_cdn_frontdoor_rule", "test")
Expand Down Expand Up @@ -503,6 +518,38 @@ resource "azurerm_cdn_frontdoor_rule" "test" {
`, template, data.RandomInteger)
}

func (r CdnFrontDoorRuleResource) cacheDurationZero(data acceptance.TestData) string {
template := r.template(data)
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
%s
resource "azurerm_cdn_frontdoor_rule" "test" {
depends_on = [azurerm_cdn_frontdoor_origin_group.test, azurerm_cdn_frontdoor_origin.test]
name = "accTestRule%d"
cdn_frontdoor_rule_set_id = azurerm_cdn_frontdoor_rule_set.test.id
order = 0
actions {
route_configuration_override_action {
cdn_frontdoor_origin_group_id = azurerm_cdn_frontdoor_origin_group.test.id
forwarding_protocol = "HttpsOnly"
query_string_caching_behavior = "IncludeSpecifiedQueryStrings"
query_string_parameters = ["foo", "clientIp={client_ip}"]
compression_enabled = true
cache_behavior = "OverrideIfOriginMissing"
cache_duration = "00:00:00"
}
}
}
`, template, data.RandomInteger)
}

func (r CdnFrontDoorRuleResource) urlRedirectAction(data acceptance.TestData) string {
template := r.template(data)
return fmt.Sprintf(`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ func CdnFrontDoorCacheDuration(i interface{}, k string) (_ []string, errors []er
return nil, []error{fmt.Errorf(`%q must be in the d.HH:MM:SS or HH:MM:SS format and must be equal to or lower than %q, got %q`, k, "365.23:59:59", v)}
}

if v == "00:00:00" {
return nil, []error{fmt.Errorf(`%q must be longer than zero seconds, got %q`, k, v)}
}

return nil, nil
}

Expand Down

0 comments on commit 8337756

Please sign in to comment.