Skip to content

Commit

Permalink
azurerm_frontdoor update custom_host to be optional, add `redirec…
Browse files Browse the repository at this point in the history
…t_configuration` to documentation (#4601)

* CustomHost to be Optional in Redirect Configuration

* Fix for #4461 Front door caching issue
  • Loading branch information
naikajah authored and WodansSon committed Oct 11, 2019
1 parent 908652c commit 841ce3b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
9 changes: 4 additions & 5 deletions azurerm/resource_arm_front_door.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func resourceArmFrontDoor() *schema.Resource {
},
"custom_host": {
Type: schema.TypeString,
Required: true,
Optional: true,
},
"custom_path": {
Type: schema.TypeString,
Expand Down Expand Up @@ -1018,6 +1018,9 @@ func expandArmFrontDoorRedirectConfiguration(input []interface{}) frontdoor.Redi

// The way the API works is if you don't include the attribute in the structure
// it is treated as Preserve instead of Replace...
if customHost != "" {
redirectConfiguration.CustomHost = utils.String(customHost)
}
if customPath != "" {
redirectConfiguration.CustomPath = utils.String(customPath)
}
Expand Down Expand Up @@ -1352,10 +1355,6 @@ func flattenArmFrontDoorRoutingRule(input *[]frontdoor.RoutingRule) []interface{
c["cache_use_dynamic_compression"] = true
}
}
} else {
// Set Defaults
c["cache_query_parameter_strip_directive"] = string(frontdoor.StripNone)
c["cache_use_dynamic_compression"] = false
}

rc = append(rc, c)
Expand Down
20 changes: 19 additions & 1 deletion website/docs/r/front_door.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ The `frontend_endpoint` block supports the following:

* `session_affinity_ttl_seconds` - (Optional) The TTL to use in seconds for session affinity, if applicable. Defaults to `0`.

* `enable_custom_https_provisioning` - (Required) Name of the Frontend Endpoint.
* `custom_https_provisioning_enabled` - (Required) Name of the Frontend Endpoint.

* `web_application_firewall_policy_link_id` - (Optional) Defines the Web Application Firewall policy `ID` for each host.

Expand Down Expand Up @@ -178,6 +178,8 @@ The `routing_rule` block supports the following:

* `forwarding_configuration` - (Optional) A `forwarding_configuration` block as defined below.

* `redirect_configuration` - (Optional) A `redirect_configuration` block as defined below.

---

The `forwarding_configuration` block supports the following:
Expand All @@ -194,6 +196,22 @@ The `forwarding_configuration` block supports the following:

---

The `redirect_configuration` block supports the following:

* `custom_host` - (Optional) Set this to change the URL for the redirection.

* `redirect_protocol` - (Optional) Protocol to use when redirecting. Valid options are `HTTPOnly`, `HTTPSOnly`, `MatchRequest`. Defaults to `MatchRequest`

* `redirect_type` - (Optional) Status code for the redirect. Valida options are `Moved`, `Found`, `TemporaryRedirect`, `PermanentRedirect`. Defaults to `Found`

* `custom_fragment` - (Optional) The destination fragment in the portion of URL after '#'. Set this to add a fragment to the redirect URL.

* `custom_path` - (Optional) The path to retain as per the incoming request, or update in the URL for the redirection.

* `custom_query_string` - (Optional) Replace any existing query string from the incoming request URL.

---

The `custom_https_configuration` block supports the following:

* `certificate_source` - (Optional) Certificate source to encrypted `HTTPS` traffic with. Allowed values are `FrontDoor` or `AzureKeyVault`. Defaults to `FrontDoor`.
Expand Down

0 comments on commit 841ce3b

Please sign in to comment.