-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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_frontdoor
- Add support for backend_pools_send_receive_timeout_seconds
#6604
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ import ( | |
"strings" | ||
"time" | ||
|
||
"github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2019-11-01/frontdoor" | ||
"github.com/Azure/azure-sdk-for-go/services/frontdoor/mgmt/2020-01-01/frontdoor" | ||
"github.com/hashicorp/go-azure-helpers/response" | ||
"github.com/hashicorp/terraform-plugin-sdk/helper/schema" | ||
"github.com/hashicorp/terraform-plugin-sdk/helper/validation" | ||
|
@@ -67,6 +67,13 @@ func resourceArmFrontDoor() *schema.Resource { | |
Required: true, | ||
}, | ||
|
||
"backend_pools_send_receive_timeout_seconds": { | ||
Type: schema.TypeInt, | ||
Optional: true, | ||
Default: 60, | ||
ValidateFunc: validation.IntBetween(0, 240), | ||
}, | ||
|
||
// remove in 3.0 | ||
"location": { | ||
Type: schema.TypeString, | ||
|
@@ -527,6 +534,7 @@ func resourceArmFrontDoorCreateUpdate(d *schema.ResourceData, meta interface{}) | |
backendPools := d.Get("backend_pool").([]interface{}) | ||
frontendEndpoints := d.Get("frontend_endpoint").([]interface{}) | ||
backendPoolsSettings := d.Get("enforce_backend_pools_certificate_name_check").(bool) | ||
backendPoolsSendReceiveTimeoutSeconds := int32(d.Get("backend_pools_send_receive_timeout_seconds").(int)) | ||
enabledState := d.Get("load_balancer_enabled").(bool) | ||
|
||
t := d.Get("tags").(map[string]interface{}) | ||
|
@@ -537,7 +545,7 @@ func resourceArmFrontDoorCreateUpdate(d *schema.ResourceData, meta interface{}) | |
FriendlyName: utils.String(friendlyName), | ||
RoutingRules: expandArmFrontDoorRoutingRule(routingRules, frontDoorPath), | ||
BackendPools: expandArmFrontDoorBackendPools(backendPools, frontDoorPath), | ||
BackendPoolsSettings: expandArmFrontDoorBackendPoolsSettings(backendPoolsSettings), | ||
BackendPoolsSettings: expandArmFrontDoorBackendPoolsSettings(backendPoolsSettings, backendPoolsSendReceiveTimeoutSeconds), | ||
FrontendEndpoints: expandArmFrontDoorFrontendEndpoint(frontendEndpoints, frontDoorPath), | ||
HealthProbeSettings: expandArmFrontDoorHealthProbeSettingsModel(healthProbeSettings, frontDoorPath), | ||
LoadBalancingSettings: expandArmFrontDoorLoadBalancingSettingsModel(loadBalancingSettings, frontDoorPath), | ||
|
@@ -683,10 +691,16 @@ func resourceArmFrontDoorRead(d *schema.ResourceData, meta interface{}) error { | |
return fmt.Errorf("setting `backend_pool`: %+v", err) | ||
} | ||
|
||
if err := d.Set("enforce_backend_pools_certificate_name_check", flattenArmFrontDoorBackendPoolsSettings(properties.BackendPoolsSettings)); err != nil { | ||
backendPoolSettings := flattenArmFrontDoorBackendPoolsSettings(properties.BackendPoolsSettings) | ||
|
||
if err := d.Set("enforce_backend_pools_certificate_name_check", backendPoolSettings["enforce_backend_pools_certificate_name_check"].(bool)); err != nil { | ||
return fmt.Errorf("setting `enforce_backend_pools_certificate_name_check`: %+v", err) | ||
} | ||
|
||
if err := d.Set("backend_pools_send_receive_timeout_seconds", backendPoolSettings["backend_pools_send_receive_timeout_seconds"].(int32)); err != nil { | ||
return fmt.Errorf("setting `backend_pools_send_receive_timeout_seconds`: %+v", err) | ||
} | ||
|
||
d.Set("cname", properties.Cname) | ||
d.Set("load_balancer_enabled", properties.EnabledState == frontdoor.EnabledStateEnabled) | ||
d.Set("friendly_name", properties.FriendlyName) | ||
|
@@ -832,7 +846,7 @@ func expandArmFrontDoorBackendEnabledState(isEnabled bool) frontdoor.BackendEnab | |
return frontdoor.Disabled | ||
} | ||
|
||
func expandArmFrontDoorBackendPoolsSettings(enforceCertificateNameCheck bool) *frontdoor.BackendPoolsSettings { | ||
func expandArmFrontDoorBackendPoolsSettings(enforceCertificateNameCheck bool, backendPoolsSendReceiveTimeoutSeconds int32) *frontdoor.BackendPoolsSettings { | ||
enforceCheck := frontdoor.EnforceCertificateNameCheckEnabledStateDisabled | ||
|
||
if enforceCertificateNameCheck { | ||
|
@@ -841,6 +855,7 @@ func expandArmFrontDoorBackendPoolsSettings(enforceCertificateNameCheck bool) *f | |
|
||
result := frontdoor.BackendPoolsSettings{ | ||
EnforceCertificateNameCheck: enforceCheck, | ||
SendRecvTimeoutSeconds: utils.Int32(backendPoolsSendReceiveTimeoutSeconds), | ||
} | ||
Comment on lines
859
to
862
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are there more settings here? would it make sense to move this into a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, I was thinking the same thing... but I wanted to avoid a breaking change so I just put it at the top level with the other backend pools settings. Not sure if we should pull it into a block yet, if another setting is exposed in a future API I think it would be appropriate to make the change at that time... Maybe open a 3.0 breaking change issue for this to fix in the future? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. well we now have 2 so it makes sense to move into a block (especially when we have such long names) if we did it in 3.0 we would still ideally want to depreacate the old properties & support both so people have a migration path. |
||
|
||
return &result | ||
|
@@ -1180,17 +1195,25 @@ func flattenArmFrontDoorBackendPools(input *[]frontdoor.BackendPool) []map[strin | |
return output | ||
} | ||
|
||
func flattenArmFrontDoorBackendPoolsSettings(input *frontdoor.BackendPoolsSettings) bool { | ||
func flattenArmFrontDoorBackendPoolsSettings(input *frontdoor.BackendPoolsSettings) map[string]interface{} { | ||
result := make(map[string]interface{}) | ||
|
||
// Set default values | ||
result["enforce_backend_pools_certificate_name_check"] = true | ||
result["backend_pools_send_receive_timeout_seconds"] = int32(60) | ||
|
||
if input == nil { | ||
return true | ||
return result | ||
} | ||
|
||
result := false | ||
result["enforce_backend_pools_certificate_name_check"] = false | ||
|
||
if enforceCertificateNameCheck := input.EnforceCertificateNameCheck; enforceCertificateNameCheck != "" { | ||
if enforceCertificateNameCheck == frontdoor.EnforceCertificateNameCheckEnabledStateEnabled { | ||
result = true | ||
} | ||
if enforceCertificateNameCheck := input.EnforceCertificateNameCheck; enforceCertificateNameCheck != "" && enforceCertificateNameCheck == frontdoor.EnforceCertificateNameCheckEnabledStateEnabled { | ||
result["enforce_backend_pools_certificate_name_check"] = true | ||
} | ||
|
||
if sendRecvTimeoutSeconds := input.SendRecvTimeoutSeconds; sendRecvTimeoutSeconds != nil { | ||
result["backend_pools_send_receive_timeout_seconds"] = *sendRecvTimeoutSeconds | ||
} | ||
|
||
return result | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be
backend_pool_send_receive_timeout_in_seconds
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was originally going to call it that too, but after researching it, it's a global setting for all backend pools thus the plural. 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh see i would have assumed it was applying to all of them without the s, but there is another property backend_pool? which is different the the other back end pools i can see why heh